Skip to content

Instantly share code, notes, and snippets.

View yosefsadek's full-sized avatar
🎯
Focusing

Youssef Alsherif yosefsadek

🎯
Focusing
View GitHub Profile
#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
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:
#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")
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")
@yosefsadek
yosefsadek / ادخال كلمة
Created January 17, 2020 22:37
بلغة البايثون
word = input("Please enter your name ")
print("hi: " + word)
word = input("Please enter a word ")
print("You entered the word " + word)
#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")
@yosefsadek
yosefsadek / برنامج تحول القياسات كيلوجرام الي باوند
Created January 17, 2020 22:22
برنامج تحول القياسات كيلوجرام الي باوند بلغة البايثون
kg = input("Enter the weight in KG ")
pounds = float(kg) * 2.2
print("Your weight in pounds is " + str(pounds))
@yosefsadek
yosefsadek / برنامج العنوان
Last active January 17, 2020 22:21
برنامج العنوان بلغة البايثون
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: ")