Ask coding questions

← Back to all posts
I got an error and I don't know why.
IndyRishi (150)

This is the same error I've gotten before!

Answered by CoolCoderSJ (508) [earned 5 cycles]
View Answer
Comments
hotnewtop
CoolCoderSJ (508)

The while loop on Line 41 shouldn’t be indented. As an alternate way, I would make a small function that holds the path2_1or2_2 input, then checks (WITH AN IF STATEMENT) if its 1 or 2, and if its not, call the function again. This would call the input again and run the if statement again. Your function would also hold lines 45-58.

IndyRishi (150)

@CoolCoderSJ Huh. I'm not good enough at coding to do that.

JBloves27 (1727)

Noice job answering questions! @CoolCoderSJ

Wilke000 (624)

How did you get the profile glitch @JBYT27 ?

CoolCoderSJ (508)

@IndyRishi It would only be somethin like this:

def path2_1or2_2func():
     path2_1or2_2 = input("Do you keep picking flowers or cry for help?\n")
     If path2_1or2_2 != 1 and path2_1or2_2 != 2:
          path2_1or2_2func()
     elif path2_1or2_2 == 1:
#Stuf
     elif path2_1or2_2 == 2: 
#stuf 

And calll path2_1or2_2func() in your elif statement (The one where you currently have the path2_1or2_2 input thingy)
Pls dont copy that (It has really bad indenting) and you should try it on your own.

CoolCoderSJ (508)

@JBYT27 thanks, I’m just really bored right now

Wilke000 (624)

@IndyRishi and I just tripled your upvotes @CoolCoderSJ you saved @IndyRishi and me's life because this is a school project

CoolCoderSJ (508)

@Wilke000 erm
1) I honestly dont care for upvotes
2) If its a school project, you should technically try to apply class content, not ask others for help (Sorry if i sound salty here)

JBloves27 (1727)

I just searched it up XD @Wilke000

IndyRishi (150)

@CoolCoderSJ It is a book report not a coding project I just decided to make my report using python.

CoolCoderSJ (508)

@JBYT27 @Wilke000 when u get pinged for an answered 14 days ago post.....

Wilke000 (624)

lol @CoolCoderSJ, I haven't been on repl.it in a while