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
priyanka shukla
3,051 Pointshi what is the syntax error in the code?
start = 99 while start: print("{} bottles of milk on the wall, {} bottles of milk.".format(start, start)) print("Take one down and pour it on some cereal.") start += 1 print("{} bottles of milk on the wall.".format(start)) if start = 100: break
1 Answer
Samuel Ferree
31,723 PointsYou need a double equals '==', not a single '=' in your if statement.
A single equals '=' is used to make an assignment, A double equals '==' is used to test equality.
Also, when pasting code, wrap it in 3 backticks ( ` ), and it will display like so:
start = 99
while start:
print("{} bottles of milk on the wall, {} bottles of milk.".format(start, start))
print("Take one down and pour it on some cereal.")
start += 1
print("{} bottles of milk on the wall.".format(start))
if start == 100: #Use '==' instead of '='
break
Ari Misha
19,323 PointsAri Misha
19,323 PointsHiya there! The thing is why'd you even need a loop especially ,while, just to print something to screen just once? Remove everything from loop and move it into a function and then call the function , you're good to go.(: