Created
June 6, 2023 15:03
-
-
Save Omay238/077be1221cbedf32a2979b4d6baaf2bf to your computer and use it in GitHub Desktop.
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
# This is for my SWiFT camp. | |
print("SWiFT camp session 1\n\n") | |
print("\n\nHello World Part 1\n") | |
print("Hello, World!") | |
print("\n\nHello World Part 2\n") | |
print("Hello" + ",", "World" + "!") | |
print("\n\nHello World Part 3\n") | |
favorite_number = 3.141592653589793 | |
print("My favorite number is", favorite_number) | |
my_name = "Leonard" | |
print("My name is", my_name) | |
print("\n\nTip Calculator\n") | |
price1 = 11 | |
tip1 = 20 | |
total1 = price1 * (1 + (tip1 / 100)) | |
print("A meal with a price of $" + str(price1), "and a tip of", str(tip1) + "% costs $" + str(total1)) | |
price2 = 24.87 | |
tip2 = 22 | |
total2 = price2 * (1 + (tip2 / 100)) | |
print("A meal with a price of $" + str(price2), "and a tip of", str(tip2) + "% costs $" + str(total2)) | |
price3 = (3**5 + 16 // 3) | |
tip3 = (169 % 13) + (5//3) | |
total3 = price3 * (1 + (tip3 / 100)) | |
print("A meal with a price of $" + str(price3), "and a tip of", str(tip3) + "% costs $" + str(total3)) | |
price4 = ((50+17) % 8)**5 | |
tip4 = (169 % 13) + (5//3) | |
total4 = price4 * (1 + (tip4 / 100)) | |
print("A meal with a price of $" + str(price4), "and a tip of", str(tip4) + "% costs $" + str(total4)) | |
print("\n\nStrings\n") | |
first_name = "Leonard" | |
middle_name = "Grezgorz" | |
last_name = "Maculo" | |
full_name = first_name + middle_name + last_name | |
print(f"The length of my full name is {len(full_name)}") | |
print(f"My full name backwards is {full_name[::-1]}") | |
print(f"My middle name is {full_name[7:15]}") | |
print(f"Every third letter of my name gives {full_name[0:-1:3]}") | |
demo_string = "I am an awesome programmer!" | |
print(f"{demo_string[13:15]*2}{demo_string[-1]}".upper()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment