Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 3-control-flow/12_grades.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

grade = 58

#First Way
if grade >= 55:
print('You passed.')
else:
print('You failed.')

#Second Way
print("You Passed" if grade >= 55 else "You Failed")
25 changes: 24 additions & 1 deletion 6-functions/29_fortune_cookie_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,27 @@ def fortune():

fortune()
fortune()
fortune()
fortune()

# Upadted Version

import random

options = [
'Don’t pursue happiness – create it.',
'All things are difficult before they are easy.',
'The early bird gets the worm, but the second mouse gets the cheese.',
'If you eat something and nobody sees you eat it, it has no calories.',
'Someone in your life needs a letter from you.',
'Don’t just think. Act!',
'Your heart will skip a beat.',
'The fortune you search for is in another cookie.',
'Help! I’m being held prisoner in a Chinese bakery!'
]

def fortune():
print(random.choice(options)) #No need to gen Random int as python can choose by itself

fortune()
fortune()
fortune()