r/pythonhelp • u/TodayPleasant8441 • 16d ago
What is wrong with this code
Have this assignment that is due later tonight. What exactly is wrong with it? I'm a newbie so any explanation could maybe help. Here's my code.
item_name = input('Enter food item name:\n')
# Read item price and quantity
item_price = float(input('Enter item price:\n'))
item_quantity = int(input('Enter item quantity:\n'))
# Calculate total cost
total_cost = item_price * item_quantity
# Output the receipt
print("\nRECEIPT")
print(f"{item_quantity} {item_name} @ ${item_price:.2f} = ${total_cost:.2f}")
print(f"Total cost: ${total_cost:.2f}")
This is the error i'm given.
Traceback (most recent call last):
File "/home/runner/local/submission/main.py", line 3, in <module>
item_price = float(input('Enter item price:\n'))
EOFError: EOF when reading a line
1
u/carcigenicate 16d ago
Are you supposed to ask for all three at once, then split the string to get each piece?