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
number = input("Enter your house number: ") | |
street = input("Enter your street name: ") | |
town = input("Enter your town/city: ") | |
county = input("Enter your county: ") | |
postcode = input("Enter your postcode: ") |
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
kg = input("Enter the weight in KG ") | |
pounds = float(kg) * 2.2 | |
print("Your weight in pounds is " + str(pounds)) |
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
#three variables that store the inputs as a decimal (float) | |
height = float(input("Enter the tank height (cm): ")) | |
width = float(input("Enter the tank width (cm): ")) | |
depth = float(input("Enter the tank depth (cm): ")) | |
#calculation to work out the capacity | |
capacity = (height * width * depth) / 1000 | |
#outputs the capacity of the water tank | |
print("The tank holds" + round(capacity,2) + "litres of water") |
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
word = input("Please enter your name ") | |
print("hi: " + word) | |
word = input("Please enter a word ") | |
print("You entered the word " + word) |
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
colour = input("Enter the colour of the traffic light ") | |
if colour == "Red": | |
print("STOP") | |
elif colour == "Amber": | |
print("GET READY TO STOP") | |
else: | |
print("GO") | |
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
#asks the user to enter a city and stores it in a variable called city | |
city = input("What is the capital city of England? ") | |
#checks if the city variable has London stored in it | |
if city=="London": | |
#displays correct if the condition is true | |
print("Correct the capital city of England is London") | |
else: | |
#displays wrong if they have entered something else | |
print("Wrong, try again") |
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
score = int(input("Enter a score between 0 and 100: ")) | |
if score >=70: | |
print("That test score is a grade A") | |
elif score>=60: | |
print("That test score is a grade B") | |
elif score>=50: | |
print("That test score is a grade C") | |
elif score>=40: | |
print("That test score is a grade D") | |
else: |
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
#two inputs asking for the distance and passengers | |
km = float(input("Enter the distance of the taxi ride in kilometres (KM): ")) | |
passengers = int(input("Enter the number of passengers: ")) | |
#calculation to work out the cost | |
cost = 3 + ((km-1)*2) | |
#checks to see if the number of passengers is more than 5 so that the additional 50% cost can be added | |
if passengers > 5: | |
#calculates the extra cost if the condition is true | |
cost = cost * 1.5 | |
#displays the total cost of the journey |
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
timestable = input("Enter the timestable you wish to learn (1-12) ") | |
# loop that will repeat 13 times (0-12) | |
for x in range(0,13): | |
# the answer uses x which increases each time to work out the answer | |
answer = x * int(timestable) | |
# x is used in the print command to display what it is multiplying the number entered by | |
print(timestable + " x " + str(x) + " = " + str(answer)) | |
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
timestable = input("Enter the timestable you wish to learn (1-12) ") | |
# loop that will repeat 13 times (0-12) | |
for x in range(0,13): | |
# the answer uses x which increases each time to work out the answer | |
answer = x * int(timestable) | |
# x is used in the print command to display what it is multiplying the number entered by | |
print(timestable + " x " + str(x) + " = " + str(answer)) | |
OlderNewer