This file contains hidden or 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
| lettuce = 23 | |
| print ("Lettuce is worth ", lettuce) | |
| lettuce = lettuce + 1 | |
| print ("Lettuce is now worth ", lettuce) |
This file contains hidden or 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
| print('Knock knock.') | |
| while not input() == ("Who's there?"): | |
| print('Knock knock') | |
| print('Interrupting cow.') | |
| while not input() == ("Interrupting cow who?"): | |
| print('Interrupting cow.') | |
| print('Interrupting cow who', end='') | |
| print('MOO!') |
This file contains hidden or 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
| name = input("What is your name?") | |
| print("Hello " + name + ". It is nice to meet you") | |
| age = input("How old are you?") | |
| age = int(age) | |
| print("You were born in "+ str(2020 - age)) | |
| correct = input("Is this correct? Y/N") | |
| if correct == "Y": | |
| print("Awesome") | |
| else: |
This file contains hidden or 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
| name = input("Enter your name: ") | |
| print("Hello", name) |
This file contains hidden or 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
| import random | |
| value =['A', 'K', 'Q', 'J', '2', '3', '4', '5', '6', '7', '8', '9', '10'] | |
| suit =['Heart', 'Diamond', 'Club', 'Spade'] | |
| cardvalue = value[12] | |
| cardsuit = suit[0] | |
| specific_card = cardvalue+cardsuit |
This file contains hidden or 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
| a1 = input("What is your favorite color? ") | |
| a2 = input("What is your favorite food? ") | |
| print("Your favorite thing to eat is ", a1,""+a2) |
This file contains hidden or 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
| import random #import the random module | |
| #generate number in positive | |
| positive = random.randint(0,100) | |
| print("The random positive number is", positive) | |
| #generate number in negative | |
| negative = random.randint(-100,-1) | |
| print("The random negative number is", negative) |
This file contains hidden or 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
| import random | |
| value =['A', 'K', 'Q', 'J', '2', '3', '4', '5', '6', '7', '8', '9', '10'] | |
| suit =['Heart', 'Diamond', 'Club', 'Spade'] | |
| random_value = random.choice(value) | |
| random_suit = random.choice(suit) | |
| random_card = random_value,random_suit |
NewerOlder