0

I am making a program with riddles and even when I answer the question correctly, it tells me I got it wrong. I am using the latest version of python on repl.it and am fairly new to programming. Please add any ways I could make this code better and how to fix my issue. Thank you very much.

This is my code:

import random
from random import *
from random import choice as rnd_choice
import time
from time import *
import sys
from sys import *
a = 1
introtext = 1
timer = 0



if a == 1:

 HRcandle = ("You measure my life in hours and I serve you by expiring. I’m quick when I’m thin and 
slow when I’m fat. The wind is my enemy. What am I?  ") 

HRreflection = ("You can see me in water, but I never get wet. What am I?  ")
hardriddles = [HRcandle, HRreflection]
nicester = ["That was easy. Even a program could get that right. 1 point","Correct. 1 
point","Expected that. 1 point","Lucky human brat. 1 point. Next time, it won't be as easy", "Humans 
think they are so smart. Just because you got it right doesn't mean you are clever. 1 point", "Petty 
humans cheating to get the answer. 1 point", '''I can see you.
Getting the right answer. 1 point''', "I really do not like the stupid fact that I have to give you a 
point for that"]

 unicester = ["I knew humans were no match for my MAGNIFECENT questions. 0 points added." "Incorrect.         
0 points added.", "ANOTHER Incorrect Human?0 points added.", "Petty humans are no match for a 
programs intellegence. 0 points added.", "You thought you were so smart. WRONG. 0 points added.", 
"I've had enough of humans giving me INCORRECT answers. 0 points added."]

 NQ = ["Next...", "Moving on...", "Onto the next question...","Next Question","Now then, onto the 
 next riddle","Lets have another riddle","Next Riddle..."]

 if introtext == 1:

  points = int(0)

 print("Welcome to my realm...")

 sleep(2)

 print("My name is Lightless...")

 sleep(2)

 print("and you have entered my EscapefulRoom.")

 sleep(2)

 print("If at any point you want to check how many points you have just type points! at the next line 
of input")

 sleep(1)

 print("The amount of points determines wheather you get bronze, silver or gold")

 sleep(1)

 print("Now that you have entered, you have 2 choices")

 sleep(1)

 print('''To live life the hard way but go for the gold
 - - - - - - - - - - - - - - - - - - - - - - - -''')

 sleep(1)

 print("Or to live like a coward, and aim for the bronze")

modechoice = input("Do you want to enter? Yes or No: ")

if modechoice == "yes" or "yeah" or "yep":
 print("Well then, let me explain the rules of the realm... ")
 sleep(1)
 print ("You will be in my escapeful room")
 sleep(2)
 print("I will riddle you riddles of all sorts")
 sleep(1.5)
 print("From english to logic")
 sleep(1)
 print("From trivia to geographic")
 sleep(1)
 print("If you do not answer the riddles I riddle")
 sleep(0.25)
 print ("There is no need to fiddle")
 sleep(0.2365)
 print("For you would have failed")
 sleep(1)
 print("And Lightless...")
 sleep(2)
 print("DOES NOT LIKE FAILURES")
 sleep(2)
 print(" You have 30 seconds for each riddle. ")
 sleep
 print("Lets begin, shall we... ")
 sleep(2)
elif modechoice == ("points!"):
 if points > 1 or points == (0):
   print("You have", points, "points")
 elif points == 1:
   print ("You have 1 point")


if modechoice in ["yes", "yeah", "yep"]:


for b in range (0, 8):
  q1 = rnd_choice(hardriddles)
  if q1 == HRcandle:
    while True:
      sleep(1)
      timer + 1

  q1ansU = input(q1)
  q1ansU = q1ansU.lower()
  q1ansR = ("candle", "a candle", "a candl", "candles", "candle")


  if timer == 30 or q1ansU != q1ansR:
     print(rnd_choice(unicester))



  if q1 == HRreflection:
   for t in range (0,30):
    sleep(1)

   q1ansU = input(q1)
   q1ansU = q1ansU.lower()
   q1ansR = ("reflection", "a reflection", "your reflection", "reflecton", "reflected", "refliction", 
"reflecction", "eflection", "rrflection")
   hardriddles.remove(HRreflection)



   if q1ansU in q1ansR:
    print(rnd_choice(nicester))
    points + 1
   print(rnd_choice(NQ))
  elif q1ansU == ("points!"):
   if points > 1 or points == (0):
    print("You have", points, "points")
   elif points == 1:
    print ("You have 1 point")
Milky
  • 11
  • `if modechoice == "yes" or "yeah" or "yep":` does not do what you think it does. – user2390182 Mar 31 '20 at 11:36
  • Please use 4 spaces indent, your code is hard to read without it. Note that `points + 1` won't do anything, the result gets lost. You meant `points = points + 1` or `points += 1`. – Thierry Lathuille Mar 31 '20 at 11:37
  • @schwobaseggl i got this answer on another question and i still do not understand what it means – Milky Mar 31 '20 at 11:54

0 Answers0