Reconsider moving the introduction of the elif command forward #3551
MarleenGilsing
started this conversation in
Language Ideas
Replies: 1 comment
-
I strongly agree with the idea to move |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While making the quiz of level 13 (and/or) I noticed that programs with the and/or commands often naturally require a elif option.
For example:
print 'Welcome to the movie theater'
popcorn = ask 'Would you like some popcorn?'
drink = ask 'Would you like a drink?'
if popcorn = 'yes' and drink = 'yes'
print 'That will be 6 dollars please'
if popcorn = 'no' and drink = 'yes'
print 'That will be 3 dollars please'
if popcorn = 'yes' and drink = 'no'
print 'That will be 3 dollars please'
if popcorn = 'no' and drink = 'no'
print 'Ok'
print 'Enjoy the movie'
In this example there are a lot of if statements under each other, that should actually be elif statements. Also with elif this code could be shorter because now some options are the same.
I know we were kind of done with moving commands up and down, and it can be quite a hassle. But maybe it's worth reconsidering the elif position.
(On the other hand, we did chose to introduce elif with the colon, so level 17 would be more interesting. Because only learning the colon by itself is quite boring).
@Felienne and fellow teachers, what do you think? Do the students need the elif earlier or are they fine as is?
Beta Was this translation helpful? Give feedback.
All reactions