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
import time,os | |
input("hello") | |
time.sleep(1) | |
os.system("clear") | |
input("from") | |
time.sleep(1) | |
input("clear") |
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
import os,time # We need to import these modules in order to use the sleep and system functions later. | |
os.system('clear') | |
print("Question 1. Which of the following is the correct code?") | |
print("\n\n") | |
print("A. print(hello world) \n") | |
print("B. Print('hello world)") | |
print("C. Print('hello world')") | |
input("\n\nPress enter to see the answer") | |
time.sleep(1) |
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
name = input("What's your name?") | |
if name == "Mr West": | |
print("You're awesome!") |
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
name = input("What's your name?") | |
if name == "Mr West": | |
print("You're awesome!") |
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
age = int(input("How old are you?")) | |
if age > 50: | |
print("You're ancient!") |
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
age = int(input("Please enter your age: ")) | |
if age < 0 or age > 150: | |
print("Invalid age!") |
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
answer = input("Do you want me to sing a song?") | |
if answer == "yes": | |
print("La! la! la! la! la!") #This code is indented! | |
print("Goodbye!")# This code is not indented! |
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
print("Good morning, I am your wake-up assistant!") | |
day = input("Is it a schoolday or the weekend?") | |
if day == "schoolday": | |
print("You had better get dressed then!") | |
else: | |
print("Go back to bed you fool!") | |
print("Goodbye from me, see you tomorrow!") |
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
choice = input("What do you want to eat?") | |
if choice == "cereal"): | |
print("There's milk in the fridge!") | |
print("We only have corn flakes.") | |
elif choice in ["tea","coffee"]: | |
print("You can't just have a drink!") | |
elif choice == "full english": | |
print("Ahh, my favourite!") | |
else: | |
print("We don't have that, sorry.") |
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
answer = input("Do you like Marmite?") | |
if answer in ["YES","Yes","yes","yep","YEH","y"]: | |
print("Urgh, you are weird and have no taste buds!") |
OlderNewer