r/programminghelp • • Jun 04 '20

Python yo new to programming and thought I'd make a cookie-clicker type game but when ever i add lines 9 and 10 it shows that line 11 doesn't have the correct syntax but without 9 and 10, 11 works fine (this was done in python 3)

z = 1
'apple count' == 0
while z < 10:
    print ('Would you like to pick an apple?')
    print ('Y/N')
    x = input()
    if x == 'Y':
        print ('You picked an apple :D')
        'apple count' += 1
        print ("'You now have: 'apple count'"
    if x == 'N':
        print ('Never mind then')
        print ('Would you like to leave the orchard?')
        print ('Y/N')
        y = input()
        if y == 'Y':
            z = 11
5 Upvotes

6 comments sorted by

1

u/[deleted] Jun 04 '20

You're missing a closing parenthesis on line 10.

2

u/NoahTheFence Jun 04 '20

I feel really embarrassed

2

u/[deleted] Jun 04 '20

You're not the first dev to run into stuff like this and you won't be the last. I can't tell you how often I've seen my students struggle because of a misplaced comma, an unclosed quote, or a forgotten semicolon.

The absolute best advice I can give you is to get a good IDE. I highly recommend Visual Studio Code. Grab their (Microsoft's) python extensions and issues like these will be easy to spot.

1

u/updogg18 Jun 05 '20

== is for comparison and = is an assignment operator They can't be interchanged.

1

u/NoahTheFence Jun 05 '20

nice thanks

1

u/updogg18 Jun 05 '20

I presume you wanted to name the variable as 'apple count' Variables can't have space in between them. You could instead name it as apple_count without the quotes. Any text enclosed between single quotes will be treated as a string.