Skip to content
← Back to Community
Options
Profile icon
GangstaPichu

How to I make multiple options for this?

image

Answered by dillonjoshua68 [earned 5 cycles]
View Answer
Voters
Profile icon
GangstaPichu
Comments
hotnewtop
Profile icon
Highwayman

U can add several elifs after the first of. They are almost exactly the same thing as if statements, but they only get checked if the statements above them were not true/do not run,

Profile icon
GangstaPichu

@Highwayman How would you go about putting it in?

Profile icon
Highwayman

@GangstaPichu

ans = input("gimmeh pswd") if ans == "bob": print("yeyyy!") elif ans == "tom": print("NU go awayyyy") elif ans == "pswd": print("I shall not pass!!") else print("ah I’m just kidding come on in.")
Profile icon
GangstaPichu

@Highwayman ans = input("Assassin ").lower()
if ans == "assassin":
elif ans == print("Thief "):

I don't think I'm doing this right. I get either syntax error or expected indent?

Profile icon
dillonjoshua68

Is is possible for u to invite someone to the repl (if you want to) or do you want me to explain here? @GangstaPichu btw it’s just like PSEUDOCODE... the CASE...OF...OTHERWISE...ENDCASE statement

Profile icon
GangstaPichu

@dillonjoshua68 Yeah, I can do that. Also, I have no idea what that is. I just started coding yesterday. I know some just very basic stuff is all. This project is just something to help me ease into coding since it can be very hard for my mind to grasp.

Profile icon
GangstaPichu
Profile icon
dillonjoshua68

like this use this format
an use multiple elif statements to give multiple options, also use the print statement to display the options available

image
@GangstaPichu

Profile icon
dillonjoshua68

i forked it @GangstaPichu

Profile icon
GangstaPichu

@dillonjoshua68 I didn't know you can use a thing like or. Also, I see you did f' how does that work?

Profile icon
GangstaPichu

@GangstaPichu I should've looked better at it. I just saw it. Lol

Thanks a lot for the help though on it. Been puzzled by this. :)

Profile icon
dillonjoshua68
Profile icon
dillonjoshua68
Profile icon
golfextre
Profile icon
golfextre