Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Help (Syntax error)
#1
This code is not working:
import time
guess = ''
answer = ''
points = 0
lives = 9
heart = u"\u2661"
def correct():
    points += 1
    print("correct!")
    time.sleep(0.2)
    print("Lives left: " + lives * heart

def checkanswer():
    if answer == Guess
        Correct()
    if answer != Guess
        Wrong()
This gives the error:
File "C:/Users/bcola/Desktop/Other/python/Guessing game.py", line 13
def checkanswer():
^
SyntaxError: invalid syntax



Please help
Quote
#2
You are missing a ) at then end of line 11. Always look at the line before what the error says when you get a Syntax error.
micseydel likes this post
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  syntax error on return statement l_butler 5 86 May-31-2020, 02:26 PM
Last Post: pyzyx3qwerty
  Syntax Error with = sign and more Kathleen57 3 208 May-03-2020, 03:52 AM
Last Post: buran
  Syntax Error Invalid Syntax / ghost Variable Atlaas 2 207 Apr-14-2020, 11:48 PM
Last Post: Atlaas
  Python 3.7, Windows 7, Syntax Error hughdent 1 258 Mar-23-2020, 10:09 AM
Last Post: buran
  Syntax error oguzcan 10 537 Mar-17-2020, 07:37 PM
Last Post: Larz60+
  Syntax error gray1306 4 250 Mar-08-2020, 09:38 PM
Last Post: deanhystad
  Syntax error - precedence Rev2k 3 313 Jan-03-2020, 08:36 PM
Last Post: Rev2k
  Keep getting "invalid syntax error" jpringle1 3 556 Dec-25-2019, 04:43 PM
Last Post: Gribouillis
  'invalid syntax' error rix 3 355 Dec-12-2019, 11:14 PM
Last Post: stullis
  Syntax Error (elif statement) Kanashi 0 479 Nov-20-2019, 11:29 PM
Last Post: Kanashi

Forum Jump:


Users browsing this thread: 1 Guest(s)