Menu

Using Python 2 Right Angle Triangle Two Sides 3 B 4 Using Python Pythagorean Theorem C2 A2 Q43902339

Using Python:

2) A right-angle triangle has two sides of a = 3 and b = 4.Using Python and Pythagorean theorem (c2 =a2+ b2), find the length of variable c. Print variable cto the console. (Hint: square root is equal to the power of1/2)

3) Assign any integer to variable x. Create an if statement, ifx is divisible by 2, then print ‘x is even’ replacing x with theactual variable. If x is not divisible by 2, then print ‘x isodd’.

4) Create a list named alphabet containing the values‘a’,’b’,’c’,’d’,’e’,’f’,’g’. Iterate through the list with afor-loop, printing the respective value of each loop.

5) Create a list named addition containing the values2,128,16,32,8,64,4. Sort the list using the sort function inPython. Create a variable named total_value. Iterate through thelist with a for-loop, adding the value to total_value. Print thefinal result of total_value to the console.

Expert Answer


Answer to Using Python: 2) A right-angle triangle has two sides of a = 3 and b = 4. Using Python and Pythagorean theorem (c2 = a2 …

OR