Q want help understanding this function with Python language

Q: want help understanding this function with Python language, thanks:

Function double takes a number and returns twice its value.

What value does double(7) produce?______

What value does double(5.7) produce? _____

Write a return statement to complete the function definition:

def double(num):

Solution

def double(num):
return 2 * num;
  
print double(7);
print double(5.7);

Output:

sh-4.3$ python main.py                                                                                                                                                                                                                                 

14                                                                                                                                                                                                                                                     

11.4

What value does double(7) produce? 14

What value does double(5.7) produce? 11.4

Q: want help understanding this function with Python language, thanks: Function double takes a number and returns twice its value. What value does double(7) pro

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site