Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE USE PYTHON, THIS IS CODEHS. IDK WHAT IS WRONG WITH MY CODE. THANKS IN ADVANCE & GOD BLESS :D Exercise 5.4.4: Square with Return
PLEASE USE PYTHON, THIS IS CODEHS. IDK WHAT IS WRONG WITH MY CODE. THANKS IN ADVANCE & GOD BLESS :D
Exercise 5.4.4: Square with Return Values points Write a function to square a number using return values. Squaring a number means multiplying it by itself. Then make several calls to that function in your start function to test it out. Your square function should only return a value, not print anything. For example a function call like x = square(5) should put the value 25 in x. Print out x to be sure your function returns the correct value. Note: Be sure to include comments for all functions that you use or create. 5.4.4: Square with Return values Save Submit + Continue RUN CODE TEST CASES ASSIGNMENT | DOCS | GRADE MORE Test Cases Check Code Expand All Minimize All 1 - def square(x): 2 square_X = X* X 3 return square_x 4 5 X = 8 6 print(square(x)) 7 8 X = 3 9 print (square(x)) le 11 X = 2 12 print(square(x)) Test Pass Message Great! You should define a function called square Great! Your function should return a value You should call your function square a few times Store the retum value so you can verify it is correct Your result: Exercise 5.4.5: Quadruple with Return Values Spoint Write a function called quadruple that quadruples a number and returns the result. Then make several calls to the quadruple function to test it out. For example, if you made a call like * = quadruple(3) then x should hold the value 12. Print the value of x to verify your function works correctly. Note: Be sure to include comments for all functions that you use or create. Save Submit + Continue RUN CODE TEST CASES ASSIGNMENT DOCS | GRADE MORE 5.4.5: Quadruple with Return 1 - def quadruple(x): quadruple_X = X* X *xx 3 return quadruple_x 4 5 y = 8 Test Cases Check Code Expand All Minimize All Test Pass Message Great! You should define a function called quadruple Your function should return a Great! value X You should call your function quadruple a few times Store the return value so you can verify it is correctStep 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