is this good?
age = 65
if age <18:
print("Minor LMAO😹")
elif 50<= age <60:
print("Ancient AAAH")
else:
print("Only ashes left💀")
is this good?
age = 65
if age <18:
print("Minor LMAO😹")
elif 50<= age <60:
print("Ancient AAAH")
else:
print("Only ashes left💀")
If you're 34 it'll print "Only ashes left💀", but the choice itself is fine
age = 65
match age:
case if age < 18:
print("Minor LMAO😹")
case if 50 <= age < 60:
print("Ancient AAAH")
case _:
print("Only ashes left💀")
here you go bud, cleaner code
Naah for such small problem OP's solution is okay. No need for match-case if there aren't any complex conditions.
No it doesn't python code should be written the pythonic way which for such problems, match case just doesn't look good. Also, it is really redundant and only increases the headaches of people looking at the code.
if you try writing this correctly with match-case, you will end up writing if statements within the cases, and at that point you can't call it cleaner
thank you everyone and yes my code does work
https://imgur.com/a/sFfGD1u
https://imgur.com/OO5wpSS
how to fix because the code you paste didn't have the indents. me confuse bro
any programmers out here wanna tell me how to start out with java? any specific courses to learn from?
i got some experience in python and c# but only basics for uni