This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guess_me =7 | |
start = 1 | |
while True: | |
if guess_me>start: | |
print('too low',start) | |
elif guess_me == start: | |
print('found it',start) | |
else: | |
print('too high',start) | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guess_me =7 | |
start = 1 | |
while True: | |
if guess_me>start: | |
print('too low',start) | |
elif guess_me == start: | |
print('found it',start) | |
else: | |
print('too high',start) | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Scope and Namespaces | |
animal = 'friutbat' | |
def print_global(): | |
print('inside print_global:', animal) | |
def change_and_print_global(): #error will occur if called | |
print('inside print_global:', animal) | |
animal ='catfish' | |
print('after change', animal) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
# this capitalize input until q is pressed | |
while True: | |
stuff = input("String to capitalize [type q to exit]: ") | |
if stuff =="q": | |
break | |
print(stuff.capitalize()) | |
''' | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
# this capitalize input until q is pressed | |
while True: | |
stuff = input("String to capitalize [type q to exit]: ") | |
if stuff =="q": | |
break | |
print(stuff.capitalize()) | |
''' | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drinks = { | |
'martini':{'vodka','vermouth'}, | |
'black russian' : {'vodka','kahlua'}, | |
'white russian' : {'cream','vodka','kahlua'} | |
} | |
bruss = drinks['black russian'] | |
wruss = drinks['white russian'] |