Lesson 1
print("hello world")
print("how tall are you?")
print("Game Over")
print("Game Over")
print("Bob’s car has 4 wheels")
Lesson 2: Variables and Concatenation
language="python"
print("I am learning to program into", language)
town="rochdale"
country="england"
print("The town i live in is", town, "the country i live in is", country)
Favourite_Band="Nirvana"
print("My favorite band is", Favourite_Band, "and i listen at least once a week")
favorite_animal = "red panda"
second_favorite_animal = "snow leopard"
print("My favorite animal is", favorite_animal, "and my second favorite animal is" ,second_favorite_animal,
"I have seen them both in Chester Zoo.")
favorite_animal = "red panda"
second_favorite_animal = "snow leopard"
print("My favorite animal is", favorite_animal, "and my second favorite animal is" ,second_favorite_animal,
"I have seen them both in Chester Zoo.")
favorite_starter = "Garlic Bread "
favorite_main = "Chicken tikka masala"
favorite_desert = "Brownie"
print("My favorite starter is", favorite_starter, "and then i have" ,favorite_main, "Then to finish it off i
have" ,favorite_desert)
# Asking for the user's name
name = input("Enter your name: ")
# Welcoming the user to the game using their name
print("Welcome to the game, " + name + "!")
Lesson 3
name= input("What is your name?")
print("Hi", name, "thats a lovely name")
film = input("What is your favorite film?")
print("I also like watching", film,)
town =input("What town do you live in?")
print("I love visiting", town,)
first_name=input("What is your first name?")
last_name=input("what is your last name?")
print("Hello", first_name, last_name)
name=input("Enter your name")
rage=input("Enter your age")
print("Your name is ", name, "and your are" ,age, "years old")
name=input("Enter your name")
doctor=input("Which doctor are you here to see?")
time=input("What time is your appointment?")
print("Thank you", name, "doctor" ,doctor, "will be ready to see you at", time)
Lesson 4
Avengers=["Captain America", "Thor", "The Hulk", "Iron Man"]
print(Avengers)
print(Avengers[2])
Food=["Garlic bread", "Curry", "Chilli Con Carnie", "Mash", "Pigs in blanket"]
print("These are my 5 favourite foods", Food)
print("My least favourite is" ,Food[0], "and my favourite is", Food[0],)
Songs=["1. For all the cows", "2. Gallons of rubbing alcohol flow through the strip", "3. Please please please
let me get what i want", "4. Something", "5. Brain Stew"]
print("These are my favourite songs", Songs)
#List backwards
my_list = [1, 2, 3, 4, 5]
reversed_list = my_list[::-1]
print(reversed_list)
#Alphabetically
my_list = ['banana', 'apple', 'orange']
sorted_list = sorted(my_list)
print(sorted_list)
#Adding
my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
Lesson 5
length = int(input("What is the length of the square?"))
width = int(input("What is the width of the square?"))
calculation = length*width
print("The area of the square is",calculation,"meters-squaered")
base = int(input("What is the length of the base of the triangle?"))
height = int(input("What is the height of the triangle?"))
area = 0.5 * base * height
print("The area of the triangle is" ,area, )
age= int(input("How old are you?"))
dogage = age * 4
print("Youre the age of", age, "and in dog years you are", dogage,)
start = 20
pens = 5
pencils = 3
spent = pens + pencils
left = start - spent
print("After spending", spent, "Alex has", "£", left, "left.")
name_2 = input("What is your name?")
birthday = int(input("When is your birthday (in days)"))
in_a_day = 86400
seconds = birthday * in_a_day
print("Your name is", name_2, "and have",seconds,"seconds until your birthday" )
name = input("What's your name? ")
print("Hello",name,)
age_years = int(input("How old are you? "))
age_months = age_years * 12
age_weeks = age_years * 52
print("You are ",age_months," months old.")
print("You are" ,age_weeks, "weeks old.")
favorite_number = int(input("What's your favorite number? "))
favorite_food = input("What's your favorite food? ")
print("Your favorite food", favorite_food, favorite_number, "times:", favorite_food * favorite_number)
def kilo(kilos):
pounds = kilos * 2.2
return pounds
farm = float(input("Enter the weight of bananas in kilograms: "))
supermarket = kilo(farm)
print("The weight of bananas at the supermarket is approximately", supermarket, "pounds.")
Lesson 6
answer = input("Do cats bark?")
if answer == "no":
print("Wrong")
else:
if answer == "yes":
print("Correct")
correct_password = "password"
password = input("Enter the password: ")
if password == correct_password:
print("Access granted. Welcome!")
else:
print("Access denied. Incorrect password.")
score = float(input("Enter score: "))
if score >= 80:
print("Excellent")
elif score > 60:
print("Super")
elif score >= 40:
print("Pass")
else:
print("Fail")
ages = input("Enter your age: ")
age = int(ages)
if age >= 18:
print("You are an adult")
else:
if age <= 18:
print("You are a child")
print("Hello")
feeling = input("How are you feeling? ")
if feeling.lower() == "happy":
print("Glad to hear it!")
elif feeling.lower() == "sad":
print("Here's a joke for you: What? Chicken butt")
else:
print("Didnt get what you said. Only reply with happy or sad.")
import time
custom_balance = float(input("Enter your bank account balance: "))
withdraw = float(input("Enter the amount you would like to withdraw: "))
if withdraw > 0 and withdraw <= custom_balance:
print("Your money will be with you shortly.")
time.sleep(3)
print("Money withdrawn, You now have" "£", withdraw,)
else:
print("This is not possible.")
color = input("Enter the traffic light color: ")
if color.lower() == "red":
print("STOP")
elif color.lower() == "yellow":
print("Get ready")
elif color.lower() == "green":
print("GO")
else:
print("Error: Invalid color entered.")
goals = int(input("Enter the number of goals scored: "))
if goals == 0:
print("The game was boring")
elif goals >= 1 & goals <= 2:
print("Not the most interesting game")
elif goals >= 3 & goals <= 5:
print("It was a very interesting game")
else:
print("The football match was an unmissable game!")
score = 0
#quiz
print("Welcome to the Quiz!")
name = input("What's your name? ")
age = input("How old are you, " + name + "? ")
play_game = input("Hi " + name + ", do you want to play a game? (yes/no) ")
if play_game.lower() == 'yes':
print("Great, let's start the quiz!")
answer = input("Who was the first President in America? ")
if answer.lower() == 'george washington':
print("Correct")
score += 1
print("Your score is", score)
else:
print("Wrong")
score -= 1
print("Your score is", score)
answer = input("What came first, the orange or the orange? ")
if answer.lower() == 'orange':
print("Correct")
score += 1
print("Your score is", score)
else:
print("Wrong")
score -= 1
print("Your score is", score)
answer = input("Would i?")
if answer == 'Would you?':
print("Correct (Would i?)")
score = score+1
print("Your score is", score)
else:
print("Wrong(would you?)")
score = score-1
print("Your score is", score)
answer = input("What did jeffery play at 1998 festivle")
if answer == 'Me?':
print("Correct")
score = score+1
print("Your score is", score)
else:
print("Wrong")
score = score-1
print("Your score is", score)
answer = input("Who is the man behind the slaughter")
if answer == 'Purple guy':
print("Correct")
score = score+1
print("Your score is", score)
else:
print("Wrong")
score = score-1
print("Your score is", score)
print("Congratulations! Your total score is", score, "well done!")
if score <= 1:
print(name, "you have done badly...")
elif score <= 3:
print(name, "you have done okay.")
elif score <= 4:
print(name, "you have done well!")
else:
print(name, "you are a super star!")
else:
print("That's okay, you're playing anyway! But let's play another time!")