We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I defined a simple dictionary. If the value it gets is true, the program prints "Not Weird", and if it's false "Weird" is printed. Then I simply created a bunch of statements that evaluate to either True or False.
Sure, one could argue that this is against the rules because the task was all about if-else statements, but I wanted to see if an alternative solution was better.
EDIT: Replaced the list comprehension with a simple boolean expression
Python If-Else
You are viewing a single comment's thread. Return to all comments →
Fairly straightforward even without using if-else statements:
I defined a simple dictionary. If the value it gets is true, the program prints "Not Weird", and if it's false "Weird" is printed. Then I simply created a bunch of statements that evaluate to either True or False.
Sure, one could argue that this is against the rules because the task was all about if-else statements, but I wanted to see if an alternative solution was better.
EDIT: Replaced the list comprehension with a simple boolean expression