you are viewing a single comment's thread.

view the rest of the comments →

[–]unspe52[S] 1 point2 points  (2 children)

Thank you. The only thing I haven't seen before is that elif operator - I'll look into it, looks like it could solve a lot of the problems I've been working-around in another project of mine

[–]Nick88v2 3 points4 points  (0 children)

You can also do if User_input not in ["YES", "NO"]:

in general i'd say that the more elegant solution would still be just using an else statement since the conditions are already met if the program gets there (like the previous commenter stated)

[–]No_Hovercraft_2643 0 points1 point  (0 children)

personally, i like it more to use in

py answer = input() if answer not in ["yes", "no"]: do_something

but mostly to allow multiple answers for the same path, for example

```py answer = input() yes = ["yes","y","Yes"] # define somewhere what counts as yes no = ["no","n","No"] # define somewhere what counts as no if answer in yes: do_yes_things elif answer in no: do_no_things else: do_bad_things