Question: #Note: use print() to add spaces between items and when needed in the receipt #(e.g. between user entries and between the entries and the receipt)
#Note: use print() to add spaces between items and when needed in the receipt
#(e.g. between user entries and between the entries and the receipt)
#1 Ask the user for a number using the prompt: NUMBER?
#Convert the user entered number to an integer
#Calculate the square of the number and display the result on screen with the following text before it:
#Your number squared is
#add a space here with the print() statement
x = input("NUMBER?")
x = int(x)
x = x**2
print("Your number squared is",x)
print()
#2 Ask the user for a number using the prompt: Your lucky number?
#Convert the user entered number to an integer
#Calculate the number raised to the fourth power and display the result on screen with the following text before it:
#Your luck raised to the fourth power is
#add a space here with the print() statement
x = input("Your lucky number?")
x = int(x)
x = x**4
print("Your luck raised to the fourth power is",x)
print()
#3 Ask the user for a first number using the prompt: first number?
#Ask the user for a second number using the prompt: second number?
#Convert the two numbers to integers
#Multiply the first number by the second number and display the result on screen with the following text before it:
#Result:
#add a space here with the print() statement
a = input("first number?")
b = input("second number?")
a = int(a)
b = int(b)
c = a*b
print("Result:",c)
print()
#4 Ask the user for a first number using the prompt: first integer?
#Ask the user for a second number using the prompt: second integer?
#Convert the two numbers to integers
#Subtract the first number from the second number and display the result on screen with the following text before it:
#The difference is:
#add a space here with the print() statement
#5 Ask the user for an item name using the prompt Item name?
#Ask the user for the item price using the prompt Item price?
#Ask the user for the item quantity using the prompt How many are you ordering?
#Convert the item price and item quantity to integers using int()
#Calculate the total cost by multiplying the item price by the number ordered by the user
#Display your results in the following format:
#Your order of [number ordered] [item name] will total [total cost]
#add a space here with the print() statement
iname = input("Item name")
iprice = input("Item price")
iquant = input("How many you are ordering?")
iprice = int(iprice)
iquant = int(iquant)
tc = iprice * iquant
print("Your order if",iquant,iname,"will total",tc)
print()
"""
#6Develop a simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn.Do not forget to assign each user
entry to a unique variable name:
Item1 name?
Item1 price?
Item1 quantity?
add a space here with the print() statement
Item2 name?
Item2 price?
Item2 quantity?
add a space here with the print() statement
b. Convert the price and quantity variables to integers
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the two items
d. Display the results using the format:
RECEIPT
You ordered:[item1 name] and [item2 name]**Note: there are 2 spaces between the colon and first item name
Total cost: $ [total price for both items calculated in 3c above]
"""
whats wrong with my code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
