i am beginner in python need help in these 2 question Write a program that asks
ID: 3786487 • Letter: I
Question
i am beginner in python need help in these 2 question
Write a program that asks a user how many widgets they want to buy and prints out what the user should pay. Widgets costs 10 dollars. Use the discount table below:
Example: If the user enters 15, they should pay 15*10 – (5/100)*15*10 = 142.50 dollars
Quantity
Discount
1-10
No Discount
11-20
5%
21-50
10%
Above 50
15%
d) Ask a user to input two numbers and print out the smaller number. If the numbers are equal, print out that the numbers are equal.
i am going to attach a problem that i did by myself i need asnwer like that
A) Write a program that asks a user for a grade. If (and only if) the grade is greater than zero and less than 101, print “The grade is valid”
Quantity
Discount
1-10
No Discount
11-20
5%
21-50
10%
Above 50
15%
grade input("Enter grade "O grade nt(grade) if grade 0 and grade 101 print ("The grade is valid.")Explanation / Answer
# first question
widget_count = input("Enter number of widget: ")
cost = 10*widget_count
discount = 0
if widget_count <= 10:
discount = 0
elif widget_count <= 20:
discount = cost*.05
elif widget_count <= 50:
discount = cost*.1
else:
discount = cost*.15
cost = cost - discount
print("total cost " + str(cost))
# ----------------------------------------------------------
# second question
num1 = input("Enter number1: ")
num2 = input("Enter number2: ")
if num1 == num2:
print("numbers are equal")
elif num1 < num2:
print(num1)
else:
print(num2)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.