Python Forum

Full Version: urgent I got a syntax errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is what I am asked to do :

Five Star Retro Video rents VHS tapes and DVDs to the same connoisseurs who like to buy LP record albums. The store rents new videos for $3.00 a night, and oldies for $2.00 a night.

Write a program that the clerks at Five Star Retro Video can use to calculate the total charge for a customer’s video rentals.

The program should prompt the user for the number of each type of video and output the total cost.

An example of the program input and output is shown below:

Enter the number of new videos: 3
Enter the number of oldies: 2

The total cost is $13.0




And this is my code :

import math
a = eval input("Please enter the number of your new videos ")
b = eval input("Please enter the number of your oldies")
w = (a*3)
z = (b*2)
The total cost is = print(w+z)



And this is what I got :


File "fivestar.py", line 1
import math
^
IndentationError: unexpected indent


File "fivestar.py", line 2
a = eval input("Please enter the number of your new videos ")
^
SyntaxError: invalid syntax

File "fivestar.py", line 6
The total cost is = print(w+z)
^
SyntaxError: invalid syntax


I will be grateful for your help Big Grin
Use Code Tags.
There are many errors in this short code.
Look like you have a starting whitespace in line 1 as you get IndentationError.
import math

a = int(input("Please enter the number of your new : "))
b = int(input("Please enter the number of your oldies: "))
videos = a * 3
oldies = b * 2
print(f'The total cost is ${videos + oldies}')
Output:
Please enter the number of your new : 3 Please enter the number of your oldies: 2 The total cost is $13
I guess this task you have gotten to solve,but you have not looked into Python to learn the most basic stuff🧐
(Feb-28-2021, 01:37 PM)snippsat Wrote: [ -> ]Use Code Tags.
There are many errors in this short code.
Look like you have a starting whitespace in line 1 as you get IndentationError.
import math

a = int(input("Please enter the number of your new : "))
b = int(input("Please enter the number of your oldies: "))
videos = a * 3
oldies = b * 2
print(f'The total cost is ${videos + oldies}')
Output:
Please enter the number of your new : 3 Please enter the number of your oldies: 2 The total cost is $13
I guess this task you have gotten to solve,but you have not looked into Python to learn the most basic stuff🧐

God bless you thank you soo muuchh Heart