Question
Using Python: 2) A right-angle triangle has two sides of a = 3 and b = 4. Using Python and Pythagorean theorem (c 2 =
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 c to the console. (Hint: square root is equal to the power of 1/2)
3) Assign any integer to variable x. Create an if statement, if x is divisible by 2, then print x is even replacing x with the actual variable. If x is not divisible by 2, then print x is odd.
4) Create a list named alphabet containing the values a,b,c,d,e,f,g. Iterate through the list with a for-loop, printing the respective value of each loop.
5) Create a list named addition containing the values 2,128,16,32,8,64,4. Sort the list using the sort function in Python. Create a variable named total_value. Iterate through the list with a for-loop, adding the value to total_value. Print the final result of total_value to the console.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started