Python Forum
urgent I got a syntax errors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
urgent I got a syntax errors
#1
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
Reply
#2
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🧐
Reply
#3
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Python Homework (Urgent help needed!!) chickenseizuresalad 6 4,297 Oct-11-2021, 01:59 AM
Last Post: Underscore
Exclamation urgent , Python homework alm 2 2,313 May-09-2021, 11:19 AM
Last Post: Yoriz
Heart Urgent homework help needed Medou 4 2,737 Nov-24-2020, 09:28 AM
Last Post: buran
  [Urgent] build code GodMaster 2 1,810 Mar-23-2020, 12:25 AM
Last Post: jefsummers
  Bifid Genkey (Urgent) Laura123 2 2,055 Mar-09-2020, 08:09 PM
Last Post: micseydel
  Python Homework Help *Urgent GS31 2 2,591 Nov-24-2019, 01:41 PM
Last Post: ichabod801
  Need help! Please! Urgent! foxylen 1 2,300 Feb-27-2019, 05:50 PM
Last Post: buran
  (Not urgent) IDLE issue with methods vinfer12 5 3,964 Mar-22-2018, 09:00 PM
Last Post: Gribouillis
  Machine Learning Antivirus [Urgent] Echoo0o 4 4,902 Jul-28-2017, 01:57 PM
Last Post: nilamo
  whats wrong with my code? syntax errors r6lay 5 6,505 Mar-16-2017, 04:14 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020