Link to home
Start Free TrialLog in
Avatar of amigan_99
amigan_99Flag for United States of America

asked on

Python Error - help please

What am I missing??

C:\Python33>python ex4.py
  File "ex4.py", line 10
    print "There are", cars, "cars available."
                    ^
SyntaxError: invalid syntax


The code:

cars = 100
space_in_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven

print "There are", cars, "cars available."      
print "there are only", drivers, "drivers available."
print "There will be", cars_not_driven, "empty cars today"
print "We can transport", carpool_capacity, "people today."
print "We have", passengers, "to carpool today."
print "We need to put about", average_passengers_per_car, "in each car."


python version info:


C:\Python33>python
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
ASKER CERTIFIED SOLUTION
Avatar of amigan_99
amigan_99
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amigan_99

ASKER

Now it runs correctly:

C:\Python33>python ex4.py
There are 100 cars available.
there are only 30 drivers available.
There will be 70 empty cars today
We can transport 120.0 people today.
We have 90 to carpool today.
We need to put about 3.0 in each car.
It is what it is.