LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-19-2015, 10:31 AM   #1
JWarren131
LQ Newbie
 
Registered: Nov 2015
Location: Wittering, UK
Posts: 2

Rep: Reputation: Disabled
Python IF statement colon gives invalid syntax


Hey,
I am creating a maths quiz in python as part of my GSCE Computing course (UK), I am putting in different levels of difficulty and in one of my if statements for this I am getting invalid syntax over a colon. Here is the code:

Code:
diff=int(input("If you would like easy  difficulty, press 1. If you would like a challenge, press 2"))
if diff== "1":
         quizeasy()
When I run this code in IDLE (Python 3.5 32-bit), I get invalid syntax over my colon. If anyone could help that would be great!
Thanks!
 
Old 11-19-2015, 10:44 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Check your indentation. After the colon a single indent is required, more would mean you are in a different level of the program.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Python Newbie: SyntaxError: invalid syntax gdizzle Programming 1 07-08-2014 07:44 PM
[SOLVED] Usage of colon for if statement keif Programming 4 06-05-2014 04:41 PM
Invalid Syntax Error on Python Function antonia_alessandra Linux - Newbie 3 03-31-2013 02:49 AM
[python] syntax Error : invalid syntax Python_user Programming 2 09-06-2009 12:52 PM
[Python] Invalid Syntax - If statement LinuxCrayon Programming 4 12-07-2007 09:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration