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 megearhart4 2 50 Yesterday, 05:27 PM
Last Post: ichabod801
  kivy - packaging touchtracer syntax error cram 2 85 Oct-14-2019, 08:30 PM
Last Post: cram
  sqlite3.OperationalError: near "%": syntax error Linuxdesire 2 143 Oct-13-2019, 02:54 AM
Last Post: Linuxdesire
  def Display Data Invalid Syntax error Linuxdesire 1 88 Oct-11-2019, 05:10 AM
Last Post: stranac
  Invalid Syntax error mustfirst 8 149 Oct-07-2019, 06:39 PM
Last Post: buran
  Syntax Error with Argument Parser aditya_man 1 97 Sep-30-2019, 01:21 PM
Last Post: ichabod801
  Need help with "unexpected expression syntax error" PyCoder 2 118 Sep-29-2019, 05:42 AM
Last Post: PyCoder
  Error Syntax -HackerRank challenge RavCOder 9 260 Sep-20-2019, 02:57 PM
Last Post: perfringo
Exclamation Get syntax error. Dont understand why beLIEve 21 1,142 Aug-25-2019, 02:28 PM
Last Post: ThomasL
  Syntax error for a reason I don't understand DanielCook 2 171 Aug-07-2019, 11:49 AM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)