Question: question 2 and question 4 python code 1. Write a function which calculates the area of rectangle. Consider the number of arguments needed, and what

question 2 and question 4
python code
question 2 and question 4 python code 1. Write a function which

1. Write a function which calculates the area of rectangle. Consider the number of arguments needed, and what they should be named 2. Write a function which calculates the area of a square, but do so using your previous function from 1. (above). Calculating the area of a square is pretty simple. Why would one want to write a function for it then, rather then just write it in their code directly? 3. What are x and y after this code is executed? >> I-8 >> y = x + 1 >> (y + 2x) // 6 >> y = -(y+1) >> y = x/y 4. Using only the material seen so far, write a function which returns the absolute value of a float. For example, if you give your function "5.0" it should return 5.0, if you give your function -18.0" it should return 18.0. Do not use "if statements or built-in Python functions. Note: this one is a bit tricky, but give it a shot! 5. There are three variables: a, b, and c. Write code to rotate/shift the variables so that a's value is stored in 0, b's value is stored in cand c's value is stored in a. An example on the Python shell): >>> # Original Values >>> a 5 >>> b 10 15 >>> # Your code wilt erecute >>> # New values after your code has been executed: >>> a 15 >>> b 5 >>> C 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!