This forum is now read-only. Please use our new forums! Go to forums
1.4 How to make "else:" do nothing?
I’m working on A Day at the Supermarket 1.4 and curiously, I can make the “if” statement work just fine, but the trouble I’m having is how to make the “else:” statement do nothing. I tried various things such as:
else: return “nothing.”
else: return 0
Thoughts?
Answer 50b0e86b1fd37a027c0000db
Answer 50b52dfaba18aef087000063
For the line after “else:” use the “pass” no-op python keyword
It looks a little bit like this
else: pass
(The indentation gets lost when I submit the edit. The preview looks fine.)
1 comments

If you press control+K you can leave a code sample, which you can also find in the visual GUI which looks like this -> {}
Answer 50d9ace8f9a480e85500445e
A = [0,1,2,3,4,5,6,7,8,9,10,11,12,13]
for num in A: if (num%2==0): print num else: ‘odd’
1 comments

control + K still does not help with indentation!!!
Answer 51c2e5548c1ccc8bbd007e20
just do something that doesn’t affect anything, like x = x (make sure this is a variable in your script)
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
I agree it’s 100% unecessary