Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
if statement not working
#5
I tried this:
#Math God
#By Trenton Varnadoe
#Made in 2018
#You answer questions correctly in under a minute. Each correct answer is worth 50 points. Get one wrong and you get a strike. Three strikes and the game ends. There are three subjects: quadratics, interest, and order of ops. Each contain 50 questions selected at random within that subject.
import time
print("Welcome to Math God! Made by Trent Varnadoe in 2018!")
print("In this game, you have a minute to answer the math problem correctly. If you get it wrong or run out of time, you get a strike. Three strikes and the game is over.")
while True:
	mode = str(input("There are three modes to this game: quadratic, interest, and order of operations. Type 'q' for quadratics, 'i' for interest, and 'o' for order of ops."))
	try:
		if mode = 'p':
  			print("You have selected quadratics.")
		elif mode == 'i':
  			print("You have selected interest.")
		elif mode == 'o':
  			print("You have selected order of operations.")
  	except:
  		input("Sorry, but you didn't correctly choose a valid mode. Press any key to continue.")
and this is what I got:
PauseError: Bad input on line 11.
Any idea on what I'm doing wrong?
Reply


Messages In This Thread
if statement not working - by trent101010 - Mar-08-2018, 07:14 PM
RE: if statement not working - by wavic - Mar-08-2018, 07:48 PM
RE: if statement not working - by sparkz_alot - Mar-08-2018, 08:19 PM
RE: if statement not working - by trent101010 - Mar-08-2018, 10:52 PM
RE: if statement not working - by trent101010 - Mar-11-2018, 05:02 PM
RE: if statement not working - by wavic - Mar-11-2018, 07:07 PM
RE: if statement not working - by trent101010 - Mar-12-2018, 06:17 PM
RE: if statement not working - by Larz60+ - Mar-11-2018, 08:53 PM
RE: if statement not working - by wavic - Mar-14-2018, 03:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question If, elif, and else statement not working PickleScripts 3 943 Mar-30-2023, 02:53 PM
Last Post: PickleScripts
  If statement not working correctly? MrKnd94 2 863 Nov-16-2022, 02:49 AM
Last Post: deanhystad
  If Statement not working...Why? Milfredo 2 2,232 Oct-17-2020, 03:23 AM
Last Post: Milfredo
  Invoking function in if else statement, not working! ibaad1406 13 5,717 May-30-2019, 09:05 PM
Last Post: ibaad1406
  If statement not working oldcity 4 3,143 Oct-14-2018, 10:45 AM
Last Post: oldcity
  why is this try.....except statement not working? HenryJ 3 8,804 Feb-06-2018, 06:15 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020