Name: Anonymous 2013-09-19 20:32
Hi I'm new and need some help with my python coding homework. A complete noob at this.
5) Consider a triangle with sides of length 3, 7 and 9. The law of cosine states that given the three sides of a triangle (a, b and c) and the angle C between the sides a and b: c^2 = a^2 +b^2-2*a*b*cos(C). Write Python code to calculate the three angles in the triangle.
7) Define a function calls addNumber(x, y) that takes in two number and returns the sum of the two numbers. 8) Write a function to convert temperature from Celsius to Fahrenheit scale. C to F Conversion: Multiply by 9, then divide by 5, then add 32.
9) The Pythagoras' Theorem for a right-angle triangle can be written as a2+b2 = c2, where a and b are sides of the right angle and c is the hypotenuse. Write a function to compute the hypotenuse given sides a and b of the triangle. 10) Write the function reverseWord(word) that returns the word in the reverse order.
11) For a quadratic equation in the form of ax2+bx+c, the discriminant, D is b2-4ac. Write a function to compute the discriminant, D.
12) Write a function to compute the Body Mass Index of a person. BMI = weight(kg) / ( height(m)*height(m) )
5) Consider a triangle with sides of length 3, 7 and 9. The law of cosine states that given the three sides of a triangle (a, b and c) and the angle C between the sides a and b: c^2 = a^2 +b^2-2*a*b*cos(C). Write Python code to calculate the three angles in the triangle.
7) Define a function calls addNumber(x, y) that takes in two number and returns the sum of the two numbers. 8) Write a function to convert temperature from Celsius to Fahrenheit scale. C to F Conversion: Multiply by 9, then divide by 5, then add 32.
9) The Pythagoras' Theorem for a right-angle triangle can be written as a2+b2 = c2, where a and b are sides of the right angle and c is the hypotenuse. Write a function to compute the hypotenuse given sides a and b of the triangle. 10) Write the function reverseWord(word) that returns the word in the reverse order.
11) For a quadratic equation in the form of ax2+bx+c, the discriminant, D is b2-4ac. Write a function to compute the discriminant, D.
12) Write a function to compute the Body Mass Index of a person. BMI = weight(kg) / ( height(m)*height(m) )