Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Justo Montoya
3,799 PointsDistance = speed*time program
Hey guys i'm trying to write a simple program to practice my basic python skills but I keep getting a syntax error when I declare the distance = speed*time formula
speed==70
time==int(input("You're driving at 70mph down a long and lonesome road. How many hours have you been driving?")
distance==speed * time
print("You've driven {} miles.".format(distance))
I have tried to use one = instead of 2 & i've also tried to modify the indentation but I still get the syntax error.
2 Answers
Gunhoo Yoon
5,027 PointsRe-posting your fixed version of code.
#Don't forget to use one = sign when assigning value.
speed = 70
#You missed extra parenthesis at the end. You need two. Rest is all good.
time = int(input("You're driving at 70mph down a long and lonesome road. How many hours have you been driving?"))
distance = speed * time
print("You've driven {} miles.".format(distance))
Gunhoo Yoon
5,027 PointsTo assign value to a variable you assign it with =
== is used for equality check.
Justo Montoya
3,799 Pointsyeah I tried it with only one = as well but it did not work. I'm not sure what i'm doing wrong
Gunhoo Yoon
5,027 PointsI'll try to fix it than.