Please leave the fixed code and comments, thank you! 1. The following code should print out a random number between 1 and 10, why will it not function correctly? from random import randint print (randint(10, 1)) 2. Why does the following code not return the expected value? def calcDiscountPrice(price, percentage): discount = price * percentage discountPrice = price - discount return discount 3. Why does the following code not return the expected value? def main(): value = int(input("Enter number:")) tenPercent(value) print ("Ten percent is ", result) def tenPercent(num): return num * .1 main()
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Please leave the fixed code and comments, thank you!
1.
The following code should print out a random number between 1 and 10, why will it not function correctly?
from random import randint
print (randint(10, 1))
Why does the following code not return the expected value?
def calcDiscountPrice(price, percentage):
discount = price * percentage
discountPrice = price - discount
return discount
Why does the following code not return the expected value?
def main():
value = int(input("Enter number:"))
tenPercent(value)
print ("Ten percent is ", result)
def tenPercent(num):
return num * .1
main()
Step by step
Solved in 7 steps with 3 images