Skip to content

Instantly share code, notes, and snippets.

@lowkeyshift
Last active April 10, 2018 22:08
Show Gist options
  • Save lowkeyshift/9b1bc5126d3223aafcc5f80d2b12d5c5 to your computer and use it in GitHub Desktop.
Save lowkeyshift/9b1bc5126d3223aafcc5f80d2b12d5c5 to your computer and use it in GitHub Desktop.
Jessica_code_practice
Master_list = []
while True:
grocery = input('Please enter grocery item: ')
if grocery.lower() == 'exit':
print('You did not enter a grocery item, please try again.')
break
else:
Master_list = Master_list + [grocery]
print('This is your listed grocery items you have entered.')
for grocery in Master_list:
print(' ' + grocery)
@lowkeyshift
Copy link
Author

See what I did with the if/else statement. If exit stop everything, but else run the rest of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment