From 94da6a37b366e07a19be290c657a19eee1820e22 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Wed, 15 Oct 2025 06:11:34 +0000 Subject: [PATCH 01/16] Created a code that includes mulltiple if and if else condition --- #Treasure Island.py | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 #Treasure Island.py diff --git a/#Treasure Island.py b/#Treasure Island.py new file mode 100644 index 0000000..c299814 --- /dev/null +++ b/#Treasure Island.py @@ -0,0 +1,48 @@ +#Treasure Island + +print(''' +******************************************************************************* + | | | | + _________|________________.=""_;=.______________|_____________________|_______ +| | ,-"_,="" `"=.| | +|___________________|__"=._o`"-._ `"=.______________|___________________ + | `"=._o`"=._ _`"=._ | + _________|_____________________:=._o "=._."_.-="'"=.__________________|_______ +| | __.--" , ; `"=._o." ,-"""-._ ". | +|___________________|_._" ,. .` ` `` , `"-._"-._ ". '__|___________________ + | |o`"=._` , "` `; .". , "-._"-._; ; | + _________|___________| ;`-.o`"=._; ." ` '`."\` . "-._ /_______________|_______ +| | |o; `"-.o`"=._`` '` " ,__.--o; | +|___________________|_| ; (#) `-.o `"=.`_.--"_o.-; ;___|___________________ +____/______/______/___|o;._ " `".o|o_.--" ;o;____/______/______/____ +/______/______/______/_"=._o--._ ; | ; ; ;/______/______/______/_ +____/______/______/______/__"=._o--._ ;o|o; _._;o;____/______/______/____ +/______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_ +____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____ +/______/______/______/______/______/______/______/______/______/______/[TomekK] +******************************************************************************* +''') + +print("Welcome to Treasure Island.") +print("Your mission is to find the treasure.") +choice1 = input("You're at a cross road. Where do you want to go? Type 'left' or 'right'\n") +lower_choice1 = choice1.lower() +if lower_choice1 == "left": + print("You have come to a lake. There is an island in the middle of the lake.") + choice2 = input("Type 'wait' to wait for a boat. Type 'swim' to swim across.\n") + lower_choice2 = choice2.lower() + if lower_choice2 == "wait": + print("You arrive at the island unharmed. There is a house with 3 doors. One red, one yellow and one blue.") + choice3 = input("Which colour do you choose?\n") + colour = choice3.lower() + if colour == "red": + print("You just got burned by the flame from a dinosaur mouth. Game Over.") + elif colour == "yellow": + print("You found the treasue and won the game. Congratulations! You are now rich. Get ready for the next adventure.") + else: + print("You got eaten by a blue dragon. Game Over.") + else: + print("You got attacked by an angry sea beast. Game Over.") +else: + print("You fell into a hole and died. Game Over.") + \ No newline at end of file From 71c707efed4844cdf14753cab0d286118626d100 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Mon, 20 Oct 2025 01:30:08 +0000 Subject: [PATCH 02/16] python practice 2 --- #For Loop in Python.py | 104 ++++++++++++++++++++++++++++++++ #Randomization | 87 ++++++++++++++++++++++++++ #Rock, Paper, Scissors Game:.py | 68 +++++++++++++++++++++ 3 files changed, 259 insertions(+) create mode 100644 #For Loop in Python.py create mode 100644 #Randomization create mode 100644 #Rock, Paper, Scissors Game:.py diff --git a/#For Loop in Python.py b/#For Loop in Python.py new file mode 100644 index 0000000..3be7f2f --- /dev/null +++ b/#For Loop in Python.py @@ -0,0 +1,104 @@ +#For Loop +fruits = ["apple", "banana", "cherry", "kiwi", "mango"] +for a in fruits: + print(a) + print("I love " + a) + + #Average Height Calcuation +student_heights = input("Input a list of student heights\n").split( ) +for n in range(0,len(student_heights)): + student_heights[n] = int(student_heights[n]) +total_height = 0 +for height in student_heights: + total_height += height +number_of_students = 0 +for student in range(0, len(student_heights)): + number_of_students = student + 1 +average_height = round(total_height / number_of_students) +print(f"The average height is {average_height}") + +#High score exercise +student_scores = input("Input a list of student scores: \n").split() +for n in range(0, len(student_scores)): + student_scores[n] = int(student_scores[n]) +highest_score = 0 +for score in student_scores: + if score > highest_score: + highest_score = score +print(f"The highest score in the class is: {highest_score}") + +#For loop with range +for num in range(1, 21, 5): + print(num) + +#Sum of numbers btw 1 and 100 +total = 0 +for num in range(1, 101): + total += num +print(total) + +#Sum of even numbers btw 1 and 100 +total = 0 +for num in range(0, 101, 2): + total += num +print(total) +#OR +total_x = 0 +for num in range(1, 101): + if num % 2 == 0: + total_x += num +print(total_x) + +#Mini Project +#FizzBuzz Game +#write a program that automatically prints the solution to the FizzBuzz game, for the numbers 1 through 100. +for numbers in range(1, 101): + if numbers % 3 == 0 and numbers % 5 == 0: + print("FizzBuzz") + elif numbers % 3 == 0: + print("Fizz") + elif numbers % 5 == 0: + print("Buzz") + else: + print(numbers) + + +##Password Generator Project +import random +letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p','q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] +numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] +symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+'] + +print("Welcome to the PyPassword Generator!") +num_letters = int(input("How many letters would you like in your password?\n")) +num_symbols = int(input("How many symbols would you like?\n")) +num_numbers = int(input("How many numbers would you like\n")) +#Level 1 +password = "" +for char in range(1, num_letters + 1): + rand_letter = random.choice(letters) + password += rand_letter +for char in range(1, num_symbols + 1): + rand_symbol = random.choice(symbols) + password += rand_symbol +for char in range(1, num_numbers + 1): + rand_number = random.choice(numbers) + password += rand_number +print(password) +#Or +#Level 2 +password_list = [] +for char in range(1, num_letters +1): + rand_letter = random.choice(letters) + password_list.append(rand_letter) +for char in range(1, num_symbols + 1): + rand_symbol = random.choice(symbols) + password_list.append(rand_symbol) +for char in range(1, num_numbers + 1): + rand_number = random.choice(numbers) + password_list.append(rand_number) +random.shuffle(password_list) +password = "" +for char in password_list: + password += char +print(f"Your password is {password}") \ No newline at end of file diff --git a/#Randomization b/#Randomization new file mode 100644 index 0000000..a494cc0 --- /dev/null +++ b/#Randomization @@ -0,0 +1,87 @@ +##Randomization +import random +import esters_code + +print(esters_code.tom) + +random_number = random.randint(1,100) +print(random_number) + +random_float = random.random() * 10 +print(random_float) + +love_score = random.randint(1, 100) +print(f"Your love score is {love_score}") + +#Mini project +#Create random sides of a coin: Heads or Tails +test_seed = int(input("Create a seed number: ")) +random.seed(test_seed) +#generate random integers btw 0 and 1 +random_side =random.randint(0,1) +if random_side == 1: + print("Heads") +else: + print("Tails") + + ##Offset and Appending Items to List + +states_of_america = ["Delaware", "Pennsylvania", "New Jersey", "Georgia", "Connecticut", "Massachusetts", "Maryland", "South Carolina", "New Hampshire", "Virginia", "New York", "North Carolina", "Rhode Island", "Vermont", "Kentucky", "Tennessee", "Ohio", "Louisiana", "Indiana", "Mississippi", "Illinois", "Alabama", "Maine", "Missouri", "Arkansas", "Michigan", "Florida", "Texas", "Iowa", "Wisconsin", "California", "Minnesota", "Oregon", "Kansas", "West Virginia", "Nevada", "Nebraska", "Colorado", "North Dakota", "South Dakota", "Montana", "Washington", "Idaho", "Wyoming", "Utah", "Oklahoma", "New Mexico", "Arizona", "Alaska",] +states_of_america.append("Esters Island") +states_of_america[0] +print(states_of_america[0]) +states_of_america[-2] = "Monkey Land" +states_of_america.extend(["Cupy Date", "Detty December", "Monkey Land"]) +states_of_america.insert(12, "Iceland") +states_of_america.remove("Iceland") +states_of_america.pop() +states_of_america.reverse() +states_of_america.sort() +print(states_of_america) + +my_country = states_of_america.copy() +print(my_country) + +###Mini Project 2 +##Who is paying the bill? +#Get to randomly select a person to pay the bills from a list of names + +import random + +name_csv = input("Give me everybody's names,separated by a comma.") +names = name_csv.split(", ") +num_names = len(names) +random_num = random.randint(0, num_names - 1) +name_chosen = names[random_num] +print(f"{name_chosen} is going to pay for the meal, today.") + +#Or use the random.choice() function +name_csv = input("Give me everybody's names,separated by a comma.") +names = name_csv.split(", ") +name_choice = random.choice(names) +print(f"{name_choice} is going to pay for the meal, today.") + +#Nested lists +box = [] +fruits = ["apple", "banana", "cherry", "strawberry", "mango", "grape", "orange", "melon", "kiwi", "pineapple"] +vegetables = ["carrot", "cabbage", "lettuce", "spinach", "cucumber", "tomato", "onion", "potato", "pea", "broccoli"] +box = [fruits, vegetables] +print(box) + +#Mini Test +#Position of treasure using two-digit numbers + +row1 = ["🟦", "🟦", "🟦"] +row2 = ["🟦", "🟦", "🟦"] +row3 = ["🟦", "🟦", "🟦"] +map = [row1, row2, row3] +print(f"{row1}\n{row2}\n{row3}") + +position = input("Where do you want to put your treasure?") +row = int(position[0]) +column = int(position[1]) +selected_row = map[row - 1] +selected_row[column - 1] = "X" +#Or +map[row - 1][column - 1] = "X" +print(f"{row1}\n{row2}\n{row3}") \ No newline at end of file diff --git a/#Rock, Paper, Scissors Game:.py b/#Rock, Paper, Scissors Game:.py new file mode 100644 index 0000000..8f0b10d --- /dev/null +++ b/#Rock, Paper, Scissors Game:.py @@ -0,0 +1,68 @@ +##Rock, Paper, Scissors Game: + +rock = ''' + _______ + ---' ____) + (_____) + (_____) + VK (____) + ---.__(___) + ''' +paper = ''' + _______ + ---' ____)____ + ______) + _______) + VK _______) + ---.__________) + ''' +scissors = ''' + _______ + ---' ____)____ + ______) + __________) + VK (____) + ---.__(___) + ''' +import random +fig = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n")) +if fig == 0: + print(rock) +elif fig == 1: + print(paper) +else: + print(scissors) +#Computer's choice +print("Computer's choice:") +computer_choice = random.randint(0,2) +if computer_choice ==0: + print(rock) +elif computer_choice == 1: + print(paper) +else: + print(scissors) + #Game logic +if fig == computer_choice: + print("It's tie, give it another try") + fig = int(input("Pick another number:")) + if fig == 0: + print(rock) + elif fig == 1: + print(paper) + else: + print(scissors) + #Player wins +elif fig == 0 and computer_choice == 2: + print("You win! Do you want to play again?") +elif fig == 1 and computer_choice == 2: + print("You win! Do you want to play again?") +elif fig == 2 and computer_choice == 1: + print("You win! Do you want to play again?") + #Computer wins +if computer_choice == 0 and fig == 2: + print("You lose!, do you want to play again?") +elif computer_choice == 1 and fig == 0: + print("You lose!, do you want to play again?") +elif computer_choice == 2 and fig == 1: + print("You lose!, do you want to play again?") + \ No newline at end of file From 518c16836cbadcce511df661800272a0f739b80f Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Fri, 16 Jan 2026 11:13:43 +0000 Subject: [PATCH 03/16] Python day 1 --- .../100 Days Python Coding/.idea}/.gitignore | 0 .../Day 1 python coding.py | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+) rename {.idea => .github/100 Days Python Coding/.idea}/.gitignore (100%) create mode 100644 .github/100 Days Python Coding/Day 1 python coding.py diff --git a/.idea/.gitignore b/.github/100 Days Python Coding/.idea/.gitignore similarity index 100% rename from .idea/.gitignore rename to .github/100 Days Python Coding/.idea/.gitignore diff --git a/.github/100 Days Python Coding/Day 1 python coding.py b/.github/100 Days Python Coding/Day 1 python coding.py new file mode 100644 index 0000000..4f74047 --- /dev/null +++ b/.github/100 Days Python Coding/Day 1 python coding.py @@ -0,0 +1,34 @@ +print("Day 1 - Python Print Function") +print("The function is declared like this:") +print("print('what to print')") + + +## String Manipulation +print("Hello World!\nHello World!") + #Concatenation +print("Hello" + " " + "Tomiwa") +#Input Function +input("WHat is your name?") +print("Hello" + input("What is your name?")) +#Exercise +print(len(input("What is your name?"))) + +#Variables +name = input("What is your name?") +length = len(name) +print(length) +#exercise +a = input("a:") +b = input("b:") +c = a +a = b +print("a =" + a) +print("b =" + c) + +# Project- Band_name_generator +print("Welcome to the Band Name Generator.") +City = input("WHat is the name of the city you grew in?\n") +Pet = input("What is the name of your pet?\n") +Band_name = City + " " + Pet +print("Your band name could be " + Band_name) + From bccd14884fc1143839b58fefeb75d4ec1b9b33e3 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Sat, 17 Jan 2026 07:51:46 +0000 Subject: [PATCH 04/16] python practice --- .../Day 2 python coding.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 2 python coding.py diff --git a/.github/100 Days Python Coding/Day 2 python coding.py b/.github/100 Days Python Coding/Day 2 python coding.py new file mode 100644 index 0000000..d468322 --- /dev/null +++ b/.github/100 Days Python Coding/Day 2 python coding.py @@ -0,0 +1,35 @@ +# Data types and casting +Two_digit_number = input("Type a two digit number: ") +# print(type(Two_digit_number)) +first_digit = int(Two_digit_number[0]) +second_digit = int(Two_digit_number[1]) +Output = first_digit + second_digit +print(Output) + +# Mathematical Operations +# BMI +height = input("Enter your height in m: ") +weight = input("Enter your weight in kg: ") +BMI = int(weight)/float(height)**2 +print(int(BMI)) + +# Number manipulation & F strings +age = int(input("What is your current age?")) +age_left_yrs = 90 - age +age_left_days = age_left_yrs * 365 +age_left_wks = age_left_yrs * 52 +age_left_mnths = age_left_yrs *12 +message = f"You have {age_left_days} days, {age_left_wks} weeks, and {age_left_mnths} months left." +print(message) + +# Project 2: Tip Calculator +print("Welcome to the tip calculator.") +bill = float(input("What was the total bill? $")) +tip = int(input("What percentage tip would you like to give? 10, 12, or 15? ")) +percentage_tip = tip / 100 +total_bill = bill * (1 + percentage_tip) +No_of_people = int(input("How many people to split the bill? ")) +each_person_bill = total_bill / No_of_people +rounded_bill = round(each_perso) +output = f"Each person should pay: ${each_person_bill}" +print(output) \ No newline at end of file From 2fbea7ee2e17b2a5a8b4782390913f2f68be5fea Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Mon, 19 Jan 2026 14:37:44 +0000 Subject: [PATCH 05/16] Python day 3 --- .../Day 3 python coding.py | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 3 python coding.py diff --git a/.github/100 Days Python Coding/Day 3 python coding.py b/.github/100 Days Python Coding/Day 3 python coding.py new file mode 100644 index 0000000..c8cba3a --- /dev/null +++ b/.github/100 Days Python Coding/Day 3 python coding.py @@ -0,0 +1,175 @@ +#Control overflow; if else and conditional statements +number = int(input("Which number do you want to check? ")) +if number %2 == 0: + print("This is an even number.") +else: + print("This is an odd number.") + +#Nested if and elif statements +# Ticket issuance +height = int(input("What is your height in cm? ")) +if height >= 120: + print("You can ride the rollercoaster!") + age = int(input("What is your age? ")) + if age <= 12: + print("Please pay $5.") + elif age <= 18: + print("Please pay $7.") + else: + print("Please pay $12.") +else: + print("Sorry, you have to grow taller before you can ride.") + +# BMI Calculator Advanced +height = float(input("Enter your height in m: ")) +weight = float(input("Enter your weight in kg: ")) +bmi = round(weight / height ** 2, 1) +if bmi < 18.5: + print(f"Your BMI is {bmi}, you are underweight.") +elif bmi <= 25: + print(f"Your BMI is {bmi}, you have a normal weight.") +elif bmi <= 30: + print(f"Your BMI is {bmi}, you are slightly overweight.") +elif bmi <= 35: + print(f"Your BMI is {bmi}, you are obese.") +else: + print(f"Your BMI is {bmi}, you are clinically obese.") + +# Exercise: Leap Year +year = int(input("Which year do you want to check? ")) +if year % 4 == 0: + if year % 100 == 0: + if year % 400 == 0: + print(f"The year {year} is a leap year.") + else: + print(f"The year {year} is not a leap year.") + else: + print(f"The year {year} is a leap year.") +else: + print(f"The year {year} is not a leap year.") + +# Multiple if statements in succession +height = int(input("What is your height in cm? ")) +bill = 0 +if height >= 120: + print("You can ride the rollercoaster!") + age = int(input("What is your age? ")) + if age <= 12: + bill = 5 + print("child ticket is $5.") + elif age <= 18: + bill = 7 + print("Youth ticket is $7.") + elif age >= 45 and age <= 55: + print("We have got a special offer for you. Your ticket is free.") + else: + bill = 12 + print("Adult ticket is $12.") + photo_shoot = input("Do you want a photo taken? Y or N. ") + if photo_shoot == "Y": + bill += 3 + print(f"Your final bill is ${bill}.") +else: + print("Sorry, you have to grow taller before you can ride.") + +# Exercise: Pizza Order +print("Welcome to Sumptuous Pizza Deliveries!") +size = input("What pizza size would you like to get? S, M, or L. ") +pepperoni = input("Do you want pepperoni? Y or N. ") +bill = 0 +if size == "S": + bill += 15 + print("Small pizza is $15.") +elif size == "M": + bill += 20 + print("Medium pizza is $20.") +else: + bill += 25 + print("Large pizza is $25.") +if pepperoni == "Y": + if size == "S": + bill += 2 + else: + bill += 3 +extra_cheese = input("Do you want extra cheese? Y or N. ") +if extra_cheese == "Y": + bill += 1 +print(f"Your final bill is: ${bill}.") + +# Exercise: Love Calculator +print("Welcome to the Love Calculator!") +print("Input your first and last names only to get your love score.") +name1 = input("What is your name? \n") +name2 = input("What is their name? \n") +combined_names = name1 + name2 +lower_case_names = combined_names.lower() +t = lower_case_names.count("t") +r = lower_case_names.count("r") +u = lower_case_names.count("u") +e = lower_case_names.count("e") +l = lower_case_names.count("l") +o = lower_case_names.count("o") +v = lower_case_names.count("v") +e = lower_case_names.count("e") +true = t + r + u + e +love = l + o + v + e +true_love = str(true) + str(love) +true_love_int = int(true_love) +print("Your love score is calculating...") +if true_love_int < 10 or true_love_int > 90: + print(f"Your score is {true_love_int}, you go together like coke and mentos.") +elif true_love_int >=40 and true_love_int <= 50: + print(f"Your score is {true_love_int}, you are alright together.") +else: + print(f"Your score is {true_love_int}, we hope you get along together.") + +# Project: Treasure Island +print(''' +******************************************************************************* + | | | | + _________|________________.=""_;=.______________|_____________________|_______ +| | ,-"_,="" `"=.| | +|___________________|__"=._o`"-._ `"=.______________|___________________ + | `"=._o`"=._ _`"=._ | + _________|_____________________:=._o "=._."_.-="'"=.__________________|_______ +| | __.--" , ; `"=._o." ,-"""-._ ". | +|___________________|_._" ,. .` ` `` , `"-._"-._ ". '__|___________________ + | |o`"=._` , "` `; .". , "-._"-._; ; | + _________|___________| ;`-.o`"=._; ." ` '`."\` . "-._ /_______________|_______ +| | |o; `"-.o`"=._`` '` " ,__.--o; | +|___________________|_| ; (#) `-.o `"=.`_.--"_o.-; ;___|___________________ +____/______/______/___|o;._ " `".o|o_.--" ;o;____/______/______/____ +/______/______/______/_"=._o--._ ; | ; ; ;/______/______/______/_ +____/______/______/______/__"=._o--._ ;o|o; _._;o;____/______/______/____ +/______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_ +____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____ +/______/______/______/______/______/______/______/______/______/______/[TomekK] +******************************************************************************* +''') + +print("Welcome to Treasure Island.") +print("Your mission is to find the lost treasure that is hidden at the end of a desserted island") +print("You just landed on the island by an helicopter and you are at the crossroad now. Where do you want to go?") +first_choice = input('Type "left" or "right" to choose your path.\n') +first_choice_lower = first_choice.lower() +first_move = first_choice_lower.strip() +if first_move == "left": + print("You have chosen the left path. You have successfully crossed the dark forest and now, you are at the lake side. What do you want to do?") + second_choice = input('Type "wait" to wait for a boat or type "swim" to swim across the lake. The choice is yours, make your decision quickly.\n') + second_choice_lower = second_choice.lower() + second_move = second_choice_lower.strip() + if second_move == "wait": + print("You have chosen the right choice. You have successfully boarded a boat and now, you have reached the island. You are now in front of the castle where the treasure is hidden. Wanna get the treasure?") + third_choice = input('You wanna proceed further? Type "Blue", "Red" or "Yellow" to choose the door you want to open. Be very careful, the wrong choice will cost you your dear life.\n') + third_choice_lower = third_choice.lower() + third_move = third_choice_lower.strip() + if third_move == "yellow": + print("Congratulations! You have found the treasure hidden for decades. Now, you can return home as a hero and conqueror. Your people will be proud of you. You have won the game.") + elif third_move == "red": + print("You just opened a door full of packs of hungry wolves, how would you survive? You have been eaten alive by the wolves. Game Over.") + else: + print("You just opened a door full of fire. You have been smoked to ashes by the fire. Game Over.") + else: + print("What a bad decision you just made! You have been eaten by a crocodile. Game Over.") +else: + print("You have chosen the right path. Unfortunately, you have been biten by a poisonous snake and died. Game Over.") \ No newline at end of file From 85a401fa975cf484c13288f1dce3a2c67139a67a Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Tue, 20 Jan 2026 11:05:15 +0000 Subject: [PATCH 06/16] Python practice --- .../Day 4 python coding.py | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 4 python coding.py diff --git a/.github/100 Days Python Coding/Day 4 python coding.py b/.github/100 Days Python Coding/Day 4 python coding.py new file mode 100644 index 0000000..cee51e9 --- /dev/null +++ b/.github/100 Days Python Coding/Day 4 python coding.py @@ -0,0 +1,114 @@ +# Random Module +import random +random_integer = random.randint(1, 20) +print(random_integer) +# Random_float +random_float = random.random() +print(random_float) + +# Exercise +test_seed = int(input("Create a seed number: ")) +random.seed(test_seed) +coin_side = random.randint(0, 1) +if coin_side == 0: + print("Heads") +else: + print("Tails") + +# Lists +states_of_america = ["Delaware", "Pennsylvania", "New Jersey", "Georgia", "Connecticut", "Massachusetts", "Maryland", "South Carolina", "New Hampshire", "Virginia", "New York", "North Carolina", "Rhode Island", "Vermont", "Kentucky", "Tennessee", "Ohio", "Louisiana", "Indiana", "Mississippi", "Illinois", "Alabama", "Maine", "Missouri", "Arkansas", "Michigan", "Florida", "Texas", "Iowa", "Wisconsin", "California", "Minnesota", "Oregon", "Kansas", "West Virginia", "Nevada", "Nebraska", "Colorado", "North Dakota", "South Dakota", "Montana", "Washington", "Idaho", "Wyoming", "Utah", "Oklahoma", "New Mexico", "Arizona", "Alaska", "Hawaii"] +print(states_of_america[0]) +print(states_of_america[-1]) +states_of_america.insert(0, "Puerto Rico") +states_of_america.insert(len(states_of_america), "News State") +print(states_of_america) + +# Exercise: Who is paying the bill? +test_seed = int(input("Create a seed number: ")) +random.seed(test_seed) +names_string = input("Give me everybody's names including yours separated by a comma. ") +names = names_string.split(", ") +name_length = len(names) +random_choice = random.randint(0, name_length - 1) +chosen_name = names[random_choice] +print(f"{chosen_name} is going to buy the meal today!") + +# Nested Lists +fruits = ["Strawberries", "Nectarines", "Apples", "Grapes", "Peaches", "Cherries", "Pears"] +vegetables = ["Spinach", "Kale", "Tomatoes", "Celery", "Potatoes"] +dirty_dozen = [fruits, vegetables] +print(dirty_dozen) + +# Exercise: Treasure Map +row1 = ["⬜️","️⬜️","️⬜️"] +row2 = ["⬜️","⬜️","️⬜️"] +row3 = ["⬜️️","⬜️️","⬜️️"] +map = [row1, row2, row3] +print(f"{row1}\n{row2}\n{row3}") +position = input("Where do you want to put the treasure? ") +horizontal = int(position[0]) +vertical = int(position[1]) +selected_row = map[vertical - 1] +selected_row[horizontal - 1] = "X" +print(f"{row1}\n{row2}\n{row3}") + +# Project: Rock Paper Scissors +rock = ''' + _______ + ---' ____) + (_____) + (_____) + VK (____) + ---.__(___) + ''' +paper = ''' + _______ + ---' ____)____ + ______) + _______) + VK _______) + ---.__________) + ''' +scissors = ''' + _______ + ---' ____)____ + ______) + __________) + VK (____) + ---.__(___) + ''' +import random +fig = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors. ")) +if fig == 0: + print(rock) +elif fig == 1: + print(paper) +else: + print(scissors) +computer_choice = random.randint(0, 2) +if computer_choice == 0: + print(f"Computer chose:\n{rock}") +elif computer_choice == 1: + print(f"Computer chose:\n{paper}") +else: + print(f"Computer chose:\n{scissors}") +if fig == 0 and computer_choice == 0: + print("It's a draw") +elif fig == 0 and computer_choice == 1: + print("You lose") +elif fig == 0 and computer_choice == 2: + print("You win") +elif fig == 1 and computer_choice == 0: + print("You win") +elif fig == 1 and computer_choice == 1: + print("It's a draw") +elif fig == 1 and computer_choice == 2: + print("You lose") +elif fig == 2 and computer_choice == 0: + print("You lose") +elif fig == 2 and computer_choice == 1: + print("You win") +elif fig == 2 and computer_choice == 2: + print("It's a draw") +else: + print("You typed an invalid number, try again") \ No newline at end of file From 3e2def5dc35dc4f58f4434c7aad13d01e3ab6001 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Wed, 21 Jan 2026 15:51:29 +0000 Subject: [PATCH 07/16] python practice 5 --- .../Day 5 python coding.py | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 5 python coding.py diff --git a/.github/100 Days Python Coding/Day 5 python coding.py b/.github/100 Days Python Coding/Day 5 python coding.py new file mode 100644 index 0000000..e889567 --- /dev/null +++ b/.github/100 Days Python Coding/Day 5 python coding.py @@ -0,0 +1,91 @@ +# # For Loop +fruits = ["apples", "pears", "oranges", "bananas"] +for fruit in fruits: + print(fruit) + print(fruit + "pie") +# Exercise 1: Average Height +student_heights = input("Input a list of student heights ").replace(',', ' ').split() +for n in range(0, len(student_heights)): + student_heights[n] = int(student_heights[n]) +total_height = 0 +for height in student_heights: + total_height += height +num_of_students = 0 +for student in student_heights: + num_of_students += 1 +average_height = round(total_height / num_of_students) +print(f"The average height is {average_height}") + +# Exercise 2: The Highest Score +student_scores = input("Input a list of student scores ").replace(', ', ' ').split() +for n in range(0, len(student_scores)): + student_scores[n] = int(student_scores[n]) +highest_score = 0 +for score in student_scores: + if score > highest_score: + highest_score = score + else: + highest_score = highest_score +print(f"The highest score in the class is: {highest_score}") + +# Exercise 3: Adding Even Numbers +total = 0 +for num in range(2, 101, 2): + total += num +print(total) +# or +total1 = 0 +for num in range(1, 101): + if num % 2 == 0: + total1 += num +print(total1) + +# Exercise 4: FizzBuzz Game +for num in range(1, 101): + if num % 3 == 0 and num % 5 == 0: + print("FizzBuzz") + elif num % 3 == 0: + print("Fizz") + elif num % 5 == 0: + print("Buzz") + else: + print(num) + +# Project: PyPassword Generator +import random +letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', + 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] +numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] +symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+'] +print("Welcome to the PyPassword Generator!") +no_letters = int(input("How many letters would you like in your password?\n")) +no_symbols = int(input("How many symbols would you like?\n")) +no_numbers = int(input("How many numbers would you like?\n")) +password = "" +for char in range(1, no_letters + 1): + password += random.choice(letters) +for char in range(1, no_symbols + 1): + password += random.choice(symbols) +for char in range(1, no_numbers + 1): + password += random.choice(numbers) +#Randomize password +randomized_password = "" +for num in range(1, len(password) + 1): + randomized_password += random.choice(password) +print(f"Your password is: {randomized_password}") +#or +password_list = [] +for char in range(1, no_letters + 1): + password_list.append(random.choice(letters)) +for char in range(1, no_symbols + 1): + password_list.append(random.choice(symbols)) +for char in range(1, no_numbers + 1): + password_list.append(random.choice(numbers)) +random.shuffle(password_list) +# Randomized password +password = "" +for char in password_list: + password += char +print(f"Your password is: {password}") \ No newline at end of file From 6f965c02dbb791e9841cfbeb62cf41905bb2ea9d Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Thu, 22 Jan 2026 10:25:54 +0000 Subject: [PATCH 08/16] python practice --- .../Day 6 python coding.py | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 6 python coding.py diff --git a/.github/100 Days Python Coding/Day 6 python coding.py b/.github/100 Days Python Coding/Day 6 python coding.py new file mode 100644 index 0000000..f9c75eb --- /dev/null +++ b/.github/100 Days Python Coding/Day 6 python coding.py @@ -0,0 +1,95 @@ +# Defining & calling function +def my_function(): + print("Hello, welcome to my world") + print("See you soon") +my_function() +# Exercise 1: Reeborg's World +def turn_right(): + turn_left() + turn_left() + turn_left() +#draw square +move() +turn_right() +move() +turn_right() +move() +turn_right() +move() +#Exercise 2 +def turn_right: + turn_left() + turn_left() + turn_left() +def jump(): + turn_left() + move() + turn_right() + move() + turn_right() + move() +def jump_hurdle(): + move() + jump() + turn_left() +#Hurdle race +for step in range(6): + jump_hurdle() + +#While loop +def turn_right: + turn_left() + turn_left() + turn_left() +def jump(): + turn_left() + move() + turn_right() + move() + turn_right() + move() + turn_left() +while not at_goal(): + if wall_in_front(): + jump() + else: + move() + +#exercise: jumping over hurdles with variable heights +def turn_right: + turn_left() + turn_left() + turn_left() +def jump(): + turn_left() + while wall_on_right(): + move() + turn_right() + move() + turn_right() + while front_is_clear(): + move() + turn_left() + +while not at_goal(): + if wall_in_front(): + jump() + else: + move + +#exercise: project +def turn_right: + turn_left() + turn_left() + turn_left() + +while not at_goal(): + if right_is_clear(): + turn_right() + move() + elif front_is_clear(): + move + else: + turn_left() + + #All code was run on Reeborg's World website \ No newline at end of file From 3a384d5ba0311af3405b219057b6686a42578fb6 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Fri, 23 Jan 2026 08:42:44 +0000 Subject: [PATCH 09/16] Hangman Game Project --- .../Day 7 python coding.py | 63 ++++++ .github/100 Days Python Coding/hangman_art.py | 66 ++++++ .../100 Days Python Coding/hangman_word.py | 210 ++++++++++++++++++ 3 files changed, 339 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 7 python coding.py create mode 100644 .github/100 Days Python Coding/hangman_art.py create mode 100644 .github/100 Days Python Coding/hangman_word.py diff --git a/.github/100 Days Python Coding/Day 7 python coding.py b/.github/100 Days Python Coding/Day 7 python coding.py new file mode 100644 index 0000000..8c5dd5d --- /dev/null +++ b/.github/100 Days Python Coding/Day 7 python coding.py @@ -0,0 +1,63 @@ +# Project: Hangman +import random +from hangman_art import stages, logo +from hangman_word import word_list +# from replit import clear + +# Logo +print(logo) + +# Randomly choose a word from the list +random_word = random.choice(word_list) +# print(random_word) + +# Number of lives available +lives = 6 +end_of_game = False + +# Create a list to display guessed letters if correct +display = [] +for letter in random_word: + display += "_" +print(display) +while not end_of_game: + +# Ask user to guess a letter from the word + guess = input("Guess a letter from the secret word: ").lower().strip() + + # User guessed a letter that is already guessed + if guess in display: + print(f"You've already guessed {guess}") + +# Check if the guessed letter is in the word + for position in range(len(random_word)): + letter = random_word[position] + if letter == guess: + display[position] = letter + if "_" not in display: + end_of_game = True + print("You win!") + print(display) + # clear() + + # Guess a wrong letter + if guess not in random_word: + print(f"You guessed {guess}, that's not in the word. You lose a life.") + lives -= 1 + if lives == 6: + print(stages[6]) + elif lives == 5: + print(stages[5]) + elif lives == 4: + print(stages[4]) + elif lives == 3: + print(stages[3]) + elif lives == 2: + print(stages[2]) + elif lives == 1: + print(stages[1]) + elif lives == 0: + print(stages[0]) + if lives == 0: + end_of_game = True + print("You lose!") \ No newline at end of file diff --git a/.github/100 Days Python Coding/hangman_art.py b/.github/100 Days Python Coding/hangman_art.py new file mode 100644 index 0000000..8d2e3f4 --- /dev/null +++ b/.github/100 Days Python Coding/hangman_art.py @@ -0,0 +1,66 @@ +logo = ''' +| | +| |__ __ _ _ __ __ _ _ __ ___ __ _ _ __ +| '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \ +| | | | (_| | | | | (_| | | | | | | (_| | | | | +|_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_| + __/ | + |___/ + ''' + +stages = [''' + +---+ + | | + O | + /|\ | + / \ | + | +========= +''', ''' + +---+ + | | + O | + /|\ | + / | + | +========= +''', ''' + +---+ + | | + O | + /|\ | + | + | +========= +''', ''' + +---+ + | | + O | + /| | + | + | +=========''', ''' + +---+ + | | + O | + | | + | + | +========= +''', ''' + +---+ + | | + O | + | + | + | +========= +''', ''' + +---+ + | | + | + | + | + | +========= +'''] \ No newline at end of file diff --git a/.github/100 Days Python Coding/hangman_word.py b/.github/100 Days Python Coding/hangman_word.py new file mode 100644 index 0000000..b5d7f92 --- /dev/null +++ b/.github/100 Days Python Coding/hangman_word.py @@ -0,0 +1,210 @@ +word_list = [ + 'abruptly', + 'absurd', + 'abyss', + 'affix', + 'askew', + 'avenue', + 'awkward', + 'axiom', + 'azure', + 'bagpipes', + 'bandwagon', + 'banjo', + 'bayou', + 'beekeeper', + 'bikini', + 'blitz', + 'blizzard', + 'boggle', + 'bookworm', + 'boxcar', + 'boxful', + 'buckaroo', + 'buffalo', + 'buffoon', + 'buxom', + 'buzzard', + 'buzzing', + 'buzzwords', + 'caliph', + 'cobweb', + 'cockiness', + 'croquet', + 'crypt', + 'curacao', + 'cycle', + 'daiquiri', + 'dirndl', + 'disavow', + 'dizzying', + 'duplex', + 'dwarves', + 'embezzle', + 'equip', + 'espionage', + 'euouae', + 'exodus', + 'faking', + 'fishhook', + 'fixable', + 'fjord', + 'flapjack', + 'flopping', + 'fluffiness', + 'flyby', + 'foxglove', + 'frazzled', + 'frizzled', + 'fuchsia', + 'funny', + 'gabby', + 'galaxy', + 'galvanize', + 'gazebo', + 'giaour', + 'gizmo', + 'glowworm', + 'glyph', + 'gnarly', + 'gnostic', + 'gossip', + 'grogginess', + 'haiku', + 'haphazard', + 'hyphen', + 'iatrogenic', + 'icebox', + 'injury', + 'ivory', + 'ivy', + 'jackpot', + 'jaundice', + 'jawbreaker', + 'jaywalk', + 'jazziest', + 'jazzy', + 'jelly', + 'jigsaw', + 'jinx', + 'jiujitsu', + 'jockey', + 'jogging', + 'joking', + 'jovial', + 'joyful', + 'juicy', + 'jukebox', + 'jumbo', + 'kayak', + 'kazoo', + 'keyhole', + 'khaki', + 'kilobyte', + 'kiosk', + 'kitsch', + 'kiwifruit', + 'klutz', + 'knapsack', + 'larynx', + 'lengths', + 'lucky', + 'mystify', + 'myth', + 'napkin', + 'nappy', + 'nervous', + 'nightclub', + 'nowadays', + 'nuisance', + 'nymph', + 'onyx', + 'ovary', + 'oxidize', + 'oxygen', + 'pajama', + 'peekaboo', + 'phlegm', + 'pixel', + 'pizazz', + 'pneumonia', + 'polka', + 'pshaw', + 'psyche', + 'puppy', + 'puzzling', + 'quartz', + 'queue', + 'quips', + 'quixotic', + 'quiz', + 'quizzes', + 'quorum', + 'razzmatazz', + 'rhubarb', + 'rhythm', + 'rickshaw', + 'schnapps', + 'scratch', + 'shiv', + 'snazzy', + 'sphinx', + 'spritz', + 'squawk', + 'squawk', + 'staff', + 'strength', + 'strengths', + 'stretch', + 'stronghold', + 'subway', + 'swivel', + 'syndrome', + 'twelfth', + 'thriftless', + 'unknown', + 'unworthy', + 'unzip', + 'uptown', + 'vaporize', + 'vixen', + 'vodka', + 'voodoo', + 'vortex', + 'voyeurism', + 'walkway', + 'waltz', + 'wave', + 'wavy', + 'waxy', + 'wellspring', + 'wheezy', + 'whiskey', + 'whizzing', + 'whomever', + 'wimpy', + 'witchcraft', + 'wizard', + 'woozy', + 'wristwatch', + 'yachtsman', + 'yippee', + 'yoked', + 'youthful', + 'yummy', + 'zap', + 'zephyr', + 'zigzag', + 'zigzagging', + 'zilch', + 'zippy', + 'zombie', + 'zoom', + 'zooming', + 'zigzag', + 'zigzagging', + 'zipper', + 'zippering', + 'zippered', + 'zippering', +] \ No newline at end of file From 20176c09ec19ca03b84c4ac4fbe1e48ee17c0e3f Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Mon, 26 Jan 2026 07:22:20 +0000 Subject: [PATCH 10/16] python practice --- .../Day 8 python coding.py | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 8 python coding.py diff --git a/.github/100 Days Python Coding/Day 8 python coding.py b/.github/100 Days Python Coding/Day 8 python coding.py new file mode 100644 index 0000000..d4a17c8 --- /dev/null +++ b/.github/100 Days Python Coding/Day 8 python coding.py @@ -0,0 +1,105 @@ +# Functions with input +def greet(): + print("Hello") + print("How are you doing?") + print("I am a great machine learning engineer") +greet() + +# Functions with parameters +def greet_my_friend(name): + print(f"Hello {name}") + print(f"How are you doing {name}?") + print(f"{name} is a good friend of mine") +greet_my_friend("Tomiwa") + +# Functions with positional arguments +def greet_with(name, location): + print(f"Hello {name}") + print(f"Tell me about you") + print(f"How can you relate similar situations in your {location}?") +greet_with("Blessing", "Abeokuta") + +# Functions with keyword arguments +def greet_colleagues(name, location, status): + print(f"Hello, my name is {name}") + print(f"I currently reside in {location}") + print(f"I am {status} at the moment hopefully my status may change soon.") +greet_colleagues(status="single", location="Lagos", name="Tomiwa") + +# Exercise 1: Paint Area Calculator +height = int(input("Height of wall: ")) +width = int(input("Width of wall: ")) +coverage_area = 5 +def paint_calc(h, w, c_a): + area = height * width + no_of_cans = round(area / coverage_area) + print(f"You will need {no_of_cans} cans of paint.") +paint_calc(h=height, w=width, c_a= coverage_area) + +# Exercise 2: Prime Number Checker +num = int(input("Input a number to check if it is a prime number or not: ")) +def prime_checker(number): + is_prime = True + for i in range(2, number - 1): + if number % i == 0: + is_prime = False + if is_prime == True: + print("It's a prime number.") + else: + print("It's not a prime number.") +prime_checker(number=num) + + +# Project: Caesar Cipher(encryption code) + +logo = """""" + ,adPPYba, ,adPPYYba, ,adPPYba, ,adPPYba, ,adPPYYba, 8b,dPPYba, + a8" "" "" `Y8 a8P_____88 I8[ "" "" `Y8 88P' "Y8 + 8b ,adPPPPP88 8PP""""""" `"Y8ba, ,adPPPPP88 88 + "8a, ,aa 88, ,88 "8b, ,aa aa ]8I 88, ,88 88 + `"Ybbd8"' `"8bbdP"Y8 `"Ybbd8"' `"YbbdP"' `"8bbdP"Y8 88 + 88 88 + "" 88 + 88 + ,adPPYba, 88 8b,dPPYba, 88,dPPYba, ,adPPYba, 8b,dPPYba, + a8" "" 88 88P' "8a 88P' "8a a8P_____88 88P' "Y8 + 8b 88 88 d8 88 88 8PP""""""" 88 + "8a, ,aa 88 88b, ,a8" 88 88 "8b, ,aa 88 + `"Ybbd8"' 88 88`YbbdP"' 88 88 `"Ybbd8"' 88 + a8" 88 88 + 88 88 88 +"""""" + +# from art import logo +print(logo) +alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] + +def caesar(word, shift_no, cipher_direction): + plain_word = "" + if cipher_direction == "decode": + shift_no *= -1 + for char in word: + if char in alphabet: + position = alphabet.index(char) + new_position = position + shift_no + if new_position > 25: + new_position -= 26 + new_letter = alphabet[new_position] + plain_word += new_letter + else: + plain_word += char + print(f"Here is the {cipher_direction}d result: {plain_word}") + +end_game = False +while not end_game: + direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n") + text = input("Type your message:\n").lower() + shift = int(input("Type the shift number:\n")) + shift %= 25 + caesar(word=text, shift_no=shift, cipher_direction=direction) + restart = input("Type 'yes' if you want to go again. Otherwise type 'no'.\n").lower() + if restart == "yes": + end_game = False + elif restart == "no": + end_game = True + print("Goodbye") \ No newline at end of file From f65b6c4c32033b06ad9c20db36fed713a67aa5dc Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Tue, 27 Jan 2026 22:33:55 +0000 Subject: [PATCH 11/16] python practice --- .../Day 9 python coding.py | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 9 python coding.py diff --git a/.github/100 Days Python Coding/Day 9 python coding.py b/.github/100 Days Python Coding/Day 9 python coding.py new file mode 100644 index 0000000..ea61a27 --- /dev/null +++ b/.github/100 Days Python Coding/Day 9 python coding.py @@ -0,0 +1,120 @@ +# Dictionary +programming_dict = { + "Bug": "An error in a program that prevents the program from running as expected.", + "Function": "A piece of code that you can easily call over and over again.", + 123: "Call out this number repeatedly.", +} +# Retrieving values from dictionary +# print(programming_dict["Bug"]) +# Adding new item to dictionary +programming_dict["Loop"] = "The action of doing something over and over again." + + +# Create an empty dictionary or make a dictionary empty +empty_dict = {} +# programming_dict = {} + +# Edit an item in your dictionary +programming_dict["Bug"] = "A moth in your computer." +# print(programming_dict) + +# Loop through a dictionary +for key in programming_dict: + print(key) + print(programming_dict[key]) + +# Exercise 1: Grading Program +student_scores = { + "Harry": 81, + "Ron": 78, + "Hermione": 99, + "Draco": 74, + "Neville": 62, +} + +student_grades = {} +for student in student_scores: + if student_scores[student] > 90: + student_grades[student] = "Outstanding" + elif student_scores[student] > 80: + student_grades[student] = "Exceeds Expectations" + elif student_scores[student] > 70: + student_grades[student] = "Acceptable" + elif student_scores[student] <= 70: + student_grades[student] = "Fail" + else: + student_grades[student] = "Not Graded" +print(student_grades) + +# Nesting Dictionary in Dictionary +travel_log = { + "France": {"Cities_visited": ["Paris", "Lille", "Dijon"], "Total_visits": 12}, + "Germany": {"Cities_visited": ["Berlin", "Hamburg", "Stuttgart"], "Total_visits": 5} +} + +# Nesting List in Dictionary +travelling_log = [ + { + "Country": "France", + "Cities_visited": ["Paris", "Lille", "Dijon"], + "Total_visits": 12 + }, + { + "Country": "Germany", + "Cities_visited": ["Berlin", "Hamburg", "Stuttgart"], + "Total_visits": 5 + } +] + + +# Exercise 2: Dictionary in List +travel_log = [ + { + "Country": "France", + "Visits": 12, + "Cities": ["Paris", "Lille", "Dijon"] + }, + { + "Country": "Germany", + "Visits": 5, + "Cities": ["Berlin", "Hamburg", "Stuttgart"] + } +] +def add_new_country(country_visited, times_visited, cities_visited): + new_country = {} + new_country["Country"] = country_visited + new_country["Visits"] = times_visited + new_country["cities"] = cities_visited + travel_log.append(new_country) +add_new_country("Russia", 2, ["Moscow", "Saint Petersburg"]) +print(travel_log) + +## Project: Blind Auction +from replit import clear +from art import logo_gavel +print(logo_gavel) +print("Welcome to the blind aution program.") +is_auction_ongoing = True +auction = {} + +def highest_bidder(bidding_record): + highest_bid = 0 + for bidder in bidding_record: + bid_amount = bidding_record[bidder] + if bid_amount > highest_bid: + highest_bid = bid_amount + winner = "" + winner = bidder + print(f"The winner is {winner} with a bid of ${highest_bid}.") + +while is_auction_ongoing: + name = input("What is your name?: ") + price = int(input("What is your bid?: $")) + auction[name] = price + other_bidders = input("Are there any other bidders? Type 'yes' or 'no'.\n") + if other_bidders == "yes": + clear() + is_auction_ongoing = True + elif other_bidders == "no": + is_auction_ongoing = False + highest_bidder(auction) \ No newline at end of file From 2ca4a697d4862671537e349e929f792b6261c94f Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Wed, 28 Jan 2026 06:15:46 +0000 Subject: [PATCH 12/16] python practice --- .../Day 10 python coding.py | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 10 python coding.py diff --git a/.github/100 Days Python Coding/Day 10 python coding.py b/.github/100 Days Python Coding/Day 10 python coding.py new file mode 100644 index 0000000..0a49819 --- /dev/null +++ b/.github/100 Days Python Coding/Day 10 python coding.py @@ -0,0 +1,123 @@ +# Functions with output +def format_name(f_name, l_name): + if f_name == "" or l_name == "": + return "You didn't provide valid inputs." + first_name = f_name.title() + last_name = l_name.title() + return f"{first_name} {last_name}" + +output = format_name(input("What is your first name?: "), input("What is your last name?:")) +print(output) + +# Exercise: Days in Month +def is_leap(year): + if year % 4 == 0: + if year % 100 == 0: + if year % 400 == 0: + return True + else: + return False + else: + return True + else: + return False + +def days_in_month(year, month): + """"Takes a year and a month and returns the number of days in that month"""" + if month > 12 or month < 1: + return "Invalid month" + month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + if is_leap(year) and month == 2: + return 29 + return month_days[month - 1] + +days = days_in_month(year=int(input("Enter a year: ")), month=int(input("Enter a month:"))) +print(days) + +# Docstring +""""Takes a year and a month and returns the number of days in that month"""" +# Docstring is a string that comes right after the function declaration and is used to explain the function. + +## Project: Calculator +#from art import logo_calculator +logo_calculator = """ + _____________________ + | _________________ | + | | JO 0. | | + | |_________________| | + | ___ ___ ___ ___ | + | | 7 | 8 | 9 | | + | | + | |___|___|___| |___| | + | | 4 | 5 | 6 | | - | | + | |___|___|___| |___| | + | | 1 | 2 | 3 | | x | | + | |___|___|___| |___| | + | | . | 0 | = | | / | | + | |___|___|___| |___| | + |_____________________| + + + 88 + 88 ,d + 88 88 +,adPPYba, ,adPPYYba, 88 ,adPPYba, 88 88 88 ,adPPYYba, MM88MMM +a8" "" "" `Y8 88 a8" "" 88 88 88 "" `Y8 88 +8b ,adPPPPP88 88 8b 88 88 88 ,adPPPPP88 88 +"8a, ,aa 88, ,88 88 "8a, ,aa "8a, ,a88 88 88, ,88 88, +`"Ybbd8"' `"8bbdP"Y8 88 `"Ybbd8"' `"YbbdP'Y8 88 `"8bbdP"Y8 "Y888 + + +,adPPYba, 8b,dPPYba, +a8" "8a 88P' "Y8 +8b d8 88 +"8a, ,a8" 88 +`"YbbdP"' 88 +""" +print(logo_calculator) +# Add + +def add(n1, n2): + return n1 + n2 + +# Subtract +def subtract(n1, n2): + return n1 - n2 + +# Multiply +def multiply(n1, n2): + return n1 * n2 + +# Divide +def divide(n1, n2): + return n1 / n2 + +operations = { + "+": add, + "-": subtract, + "*": multiply, + "/": divide +} + +def calculator(): + print(logo_calculator) + num1 = float(input("What's the first number?: ")) + for symbol in operations: + print(symbol) + still_calculating = True + + while still_calculating: + operation_symbol = input("Pick an operation:") + num2 = float(input("What's the next number?: ")) + cal_function = operations[operation_symbol] + cal_function(num1, num2) + answer = cal_function(num1, num2) + print(f"{num1} {operation_symbol} {num2} = {answer}") + + another_calc = input(f"Type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation:") + if another_calc == "y": + num1 = answer + else: + still_calculating = False + calculator() + +calculator() From 869b8ef12bf3d18b10597a134f9bad72fd100ff6 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Thu, 29 Jan 2026 07:53:59 +0000 Subject: [PATCH 13/16] Python Capstone Project 1 --- .../100 Days Python Coding/Capstone Project 1 | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/100 Days Python Coding/Capstone Project 1 diff --git a/.github/100 Days Python Coding/Capstone Project 1 b/.github/100 Days Python Coding/Capstone Project 1 new file mode 100644 index 0000000..4f16225 --- /dev/null +++ b/.github/100 Days Python Coding/Capstone Project 1 @@ -0,0 +1,68 @@ +# Capstone Project: Blackjack Program +import random +from replit import clear + +def deal_card(): + cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] + card = random.choice(cards) + return card + +def cal_score(cards): + if sum(cards) == 21 and len(cards) == 2: + return 0 + if 11 in cards and sum(cards) > 21: + cards.remove(11) + cards.append(1) + return sum(cards) + +def compare(user_score, computer_score): + if user_score == computer_score: + return "It's a draw!" + elif computer_score == 0: + return "The computer has a blackjack. You lose!" + elif user_score == 0: + return "You got a blackjack. You win!" + elif user_score > 21: + return "You went over. You lose!" + elif computer_score > 21: + return "The computer went over. You win!" + else: + if user_score > computer_score: + return "You have a higher score. You win!" + elif computer_score > user_score: + return "The computer has a higher score. You lose!" + +def blackjack(): + your_card = [] + computer_card = [] + game_over = False + for i in range(2): + your_card.append(deal_card()) + computer_card.append(deal_card()) + + while not game_over: + user_score = cal_score(your_card) + computer_score = cal_score(computer_card) + print(f"Your cards: {your_card}, current score: {user_score}") + print(f"Computer's first card:{computer_card[0]}") + + if user_score == 0 or computer_score == 0 or user_score > 21: + game_over = True + else: + get_card = input("Type 'y' to get another card, type 'n' to pass: ") + if get_card == "y": + your_card.append(deal_card()) + user_score = cal_score(your_card) + elif get_card == "n": + game_over = True + + while computer_score != 0 and computer_score < 17: + computer_card.append(deal_card()) + computer_score = cal_score(computer_card) + print(f"Your final hand: {your_card}, final score: {user_score}") + print(f"Computer's final hand: {computer_card}, final score: {computer_score}") + print(compare(user_score, computer_score)) + +while input("Do you want to play a game of Blackjack? Type 'y' or 'n': ") == "y": + clear() + blackjack() From 40c0adb92e104be73b1e047d72ef6af9d53fcfd9 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Fri, 30 Jan 2026 01:39:05 +0000 Subject: [PATCH 14/16] python practice --- .../Day 12 python coding.py | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 12 python coding.py diff --git a/.github/100 Days Python Coding/Day 12 python coding.py b/.github/100 Days Python Coding/Day 12 python coding.py new file mode 100644 index 0000000..89a4e00 --- /dev/null +++ b/.github/100 Days Python Coding/Day 12 python coding.py @@ -0,0 +1,70 @@ +# Namespaces: Local vs Global Scopes +lives = 6 +def live_left(): + lives = 1 + return lives +print(live_left()) +print(lives) + +# Project: Guess the Number +import random + +def difficulty_level(): + level = input("Choose a difficulty. Type 'easy' or 'hard': ") + if level == "easy": + return 10 + elif level == "hard": + return 5 + +def check_guess(guess, random_number, attempt): + if guess < 1 or guess > 100: + print("Invalid number. Please enter a number between 1 and 100.") + elif guess < random_number: + print("Too low.") + return attempt - 1 + elif guess > random_number: + print("Too high.") + return attempt - 1 + else: + print(f"You got it! The answer was {random_number}.") + +def play_game(): + + print("Welcome to the Number Guessing Game!") + print("I'm thinking of a number between 1 and 100. ") + rand_num = random.randint(1, 100) + + attempt = difficulty_level() + + guess = 0 + while guess != rand_num: + print(f"You have {attempt} attempts remaining to guess the number.") + guess = int(input("Make a guess: ")) + attempt = check_guess(guess, rand_num, attempt) + if attempt == 0: + print("You've run out of guesses, you lose!") + return + elif guess != rand_num: + print("Guess again.") + +play_game() + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 3d9fe3a9249b5e6ad4d4eaaa1dd8df6a1d39f49d Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Fri, 30 Jan 2026 11:39:21 +0000 Subject: [PATCH 15/16] python practice --- .../Day 13 python coding.py | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/100 Days Python Coding/Day 13 python coding.py diff --git a/.github/100 Days Python Coding/Day 13 python coding.py b/.github/100 Days Python Coding/Day 13 python coding.py new file mode 100644 index 0000000..43857a2 --- /dev/null +++ b/.github/100 Days Python Coding/Day 13 python coding.py @@ -0,0 +1,77 @@ +# Debugging +# Describe the problem +def my_function(): + for i in range(1, 21): + if i == 20: + print("You got it") +my_function() + +# Reproduce the bug +from random import randint +dice_ings = ["❶", "❷", "❸", "❹", "❺", "❻"] +dice_num = randint(1, 5) +print(dice_ings[dice_num]) + +# Play computer +year = int(input("What's your year of birth? ")) +if year > 1980 and year < 1994: + print("You are a millenial.") +elif year >= 1994: + print("You are a Gen Z.") + +# Fix the error +age = int(input("How old are you? ")) +if age > 18: + print(f"You can drive at age {age}.") + +# Print is your friend +pages = 0 +word_per_page = 0 +pages = int(input("Number of pages: ")) +word_per_page = int(input("Number of words per page: ")) +total_words = pages * word_per_page +print(total_words) + +# Use a debugger +def mutate(a_list): + b_list = [] + for item in a_list: + new_item = item * 2 + b_list.append(new_item) + print(b_list) +mutate([1,2,3,5,8,13]) + +# Exercise 1 +number = int(input("Which number do you want to check? ")) + +if number % 2 == 0: + print("This is an even number.") +else: + print("This is an odd number.") + +# Exercise 2 +year = int(input("Which year do you want to check? ")) + +if year % 4 == 0: + if year % 100 == 0: + if year % 400 == 0: + print("Leap year.") + else: + print("Not leap year.") + else: + print("Leap year.") + +else: +# print("Not leap year.") + +# Exercise 3 +for number in range(1, 101): + if number % 3 == 0 and number % 5 == 0: + print("FizzBuzz") + elif number % 3 == 0: + print("Fizz") + elif number % 5 == 0: + print("Buzz") + else: + print(number) + From bf072fb6d13ff90777a3af3067bdb17d66f15d65 Mon Sep 17 00:00:00 2001 From: Esters-10 Date: Sun, 1 Feb 2026 15:26:53 +0000 Subject: [PATCH 16/16] Capstone Project --- .../Capstone Project 2.py | 102 ++++++ .github/100 Days Python Coding/art.py | 19 ++ .github/100 Days Python Coding/data.py | 302 ++++++++++++++++++ 3 files changed, 423 insertions(+) create mode 100644 .github/100 Days Python Coding/Capstone Project 2.py create mode 100644 .github/100 Days Python Coding/art.py create mode 100644 .github/100 Days Python Coding/data.py diff --git a/.github/100 Days Python Coding/Capstone Project 2.py b/.github/100 Days Python Coding/Capstone Project 2.py new file mode 100644 index 0000000..c511491 --- /dev/null +++ b/.github/100 Days Python Coding/Capstone Project 2.py @@ -0,0 +1,102 @@ +## Capstone Project: Higher Lower Game +import random +from data import data +from replit import clear + +# Import asciiart in art +from art import logo, vs + +# Create a function that compares the follower_count of variable_a and variable_b and returns the one with the higher score. +def highest_follower(a_follower, b_follower): + highest_follower = 0 + if a_follower['follower_count'] > b_follower['follower_count']: + highest_follower = a_follower['follower_count'] + return highest_follower + else: + highest_follower = b_follower['follower_count'] + return highest_follower + + # Create a function that checks answer and returns the follower_count of the player's guess. +def check_answer(guess, a_follower, b_follower): + if guess == "a": + return a_follower['follower_count'] + elif guess == "b": + return b_follower['follower_count'] + else: + print("Invalid input. Please try again.") + +# Create a function that ask player if they want to play again. +def play_again(): + play_again = input("Do you want to play again? Type 'y' or 'n': ").lower() + if play_again == "y": + clear() + play_game() + else: + print("Goodbye!") + +def play_game(): + + # Randomly select dictionary from the list of data and assign it to variable_a and another to variable_b. Radomly generated dictionaries should return other items except follower_count. + variable_a = random.choice(data) + variable_b = random.choice(data) + + # Create a function that checks if variable_a and variable_b are the same. If they are, randomly select another dictionary from the list of data and assign it to variable_b. + def start_game(variable_a, variable_b): + print(logo) + while variable_a == variable_b: + variable_b = random.choice(data) + + print(f"Compare A: {variable_a['name']}, a {variable_a['description']},from {variable_a['country']}") + + print(vs) + + print(f"Against B: {variable_b['name']}, a {variable_b['description']},from {variable_b['country']}") + + start_game(variable_a, variable_b) + # Function that compares and returns the highest follower count + max_follower = highest_follower(a_follower=variable_a, b_follower=variable_b) + # print(f"Highest follower count: {max_follower}") + + # Create a function that will receive the player's answer. + guess = input("Who has more followers? Type 'A' or 'B': ").lower() + guess_count = check_answer(guess=guess, a_follower=variable_a, b_follower=variable_b) + # print(f"The guess_count: {guess_count}") + + # compare_answer(guess_count, max_follower) + score = 0 + if guess_count == max_follower: + score += 1 + # print(f"You're right! Current score: {score}") + else: + clear() + print(f"Sorry, that's wrong. Final score: {score}") + play_again() + +# Create a loop that runs while the player's guess is correct, and create a new variable for the next round. + while guess_count == max_follower: + clear() + print(f"You're right! Current score: {score}") + if variable_a['follower_count'] != max_follower: + variable_a = variable_a + else: + variable_a = variable_b + variable_b = random.choice(data) + + start_game(variable_a, variable_b) + max_follower = highest_follower(a_follower=variable_a, b_follower=variable_b) + guess = input("Who has more followers? Type 'A' or 'B': ").lower() + guess_count = check_answer(guess=guess, a_follower=variable_a, b_follower=variable_b) + # compare_answer(guess_count, max_follower) + if guess_count == max_follower: + score += 1 + # print(f"You're right! Current score: {score}") + else: + clear() + print(f"Sorry, that's wrong. Final score: {score}") + play_again() + +play_game() + + + + diff --git a/.github/100 Days Python Coding/art.py b/.github/100 Days Python Coding/art.py new file mode 100644 index 0000000..2a27806 --- /dev/null +++ b/.github/100 Days Python Coding/art.py @@ -0,0 +1,19 @@ +logo = """ + __ ___ __ + / / / (_)___ _/ /_ ___ _____ + / /_/ / / __ `/ __ \/ _ \/ ___/ + / __ / / /_/ / / / / __/ / +/_/ ///_/\__, /_/ /_/\___/_/ + / / /____/_ _____ _____ + / / / __ \ | /| / / _ \/ ___/ + / /___/ /_/ / |/ |/ / __/ / +/_____/\____/|__/|__/\___/_/ +""" + +vs = """ + _ __ +| | / /____ +| | / / ___/ +| |/ (__ ) +|___/____(_) +""" \ No newline at end of file diff --git a/.github/100 Days Python Coding/data.py b/.github/100 Days Python Coding/data.py new file mode 100644 index 0000000..894b63c --- /dev/null +++ b/.github/100 Days Python Coding/data.py @@ -0,0 +1,302 @@ +data = [ + { + 'name': 'Instagram', + 'follower_count': 346, + 'description': 'Social media platform', + 'country': 'United States' + }, + { + 'name': 'Cristiano Ronaldo', + 'follower_count': 215, + 'description': 'Footballer', + 'country': 'Portugal' + }, + { + 'name': 'Ariana Grande', + 'follower_count': 183, + 'description': 'Musician and actress', + 'country': 'United States' + }, + { + 'name': 'Dwayne Johnson', + 'follower_count': 181, + 'description': 'Actor and professional wrestler', + 'country': 'United States' + }, + { + 'name': 'Selena Gomez', + 'follower_count': 174, + 'description': 'Musician and actress', + 'country': 'United States' + }, + { + 'name': 'Kylie Jenner', + 'follower_count': 172, + 'description': 'Reality TV personality and businesswoman and Self-Made Billionaire', + 'country': 'United States' + }, + { + 'name': 'Kim Kardashian', + 'follower_count': 167, + 'description': 'Reality TV personality and businesswoman', + 'country': 'United States' + }, + { + 'name': 'Lionel Messi', + 'follower_count': 149, + 'description': 'Footballer', + 'country': 'Argentina' + }, + { + 'name': 'Beyoncé', + 'follower_count': 145, + 'description': 'Musician', + 'country': 'United States' + }, + { + 'name': 'Neymar', + 'follower_count': 138, + 'description': 'Footballer', + 'country': 'Brasil' + }, + { + 'name': 'National Geographic', + 'follower_count': 135, + 'description': 'Magazine', + 'country': 'United States' + }, + { + 'name': 'Justin Bieber', + 'follower_count': 133, + 'description': 'Musician', + 'country': 'Canada' + }, + { + 'name': 'Taylor Swift', + 'follower_count': 131, + 'description': 'Musician', + 'country': 'United States' + }, + { + 'name': 'Kendall Jenner', + 'follower_count': 127, + 'description': 'Reality TV personality and Model', + 'country': 'United States' + }, + { + 'name': 'Jennifer Lopez', + 'follower_count': 119, + 'description': 'Musician and actress', + 'country': 'United States' + }, + { + 'name': 'Nicki Minaj', + 'follower_count': 113, + 'description': 'Musician', + 'country': 'Trinidad and Tobago' + }, + { + 'name': 'Nike', + 'follower_count': 109, + 'description': 'Sportswear multinational', + 'country': 'United States' + }, + { + 'name': 'Khloé Kardashian', + 'follower_count': 108, + 'description': 'Reality TV personality and businesswoman', + 'country': 'United States' + }, + { + 'name': 'Miley Cyrus', + 'follower_count': 107, + 'description': 'Musician and actress', + 'country': 'United States' + }, + { + 'name': 'Katy Perry', + 'follower_count': 94, + 'description': 'Musician', + 'country': 'United States' + }, + { + 'name': 'Kourtney Kardashian', + 'follower_count': 90, + 'description': 'Reality TV personality', + 'country': 'United States' + }, + { + 'name': 'Kevin Hart', + 'follower_count': 89, + 'description': 'Comedian and actor', + 'country': 'United States' + }, + { + 'name': 'Ellen DeGeneres', + 'follower_count': 87, + 'description': 'Comedian', + 'country': 'United States' + }, + { + 'name': 'Real Madrid CF', + 'follower_count': 86, + 'description': 'Football club', + 'country': 'Spain' + }, + { + 'name': 'FC Barcelona', + 'follower_count': 85, + 'description': 'Football club', + 'country': 'Spain' + }, + { + 'name': 'Rihanna', + 'follower_count': 81, + 'description': 'Musician and businesswoman', + 'country': 'Barbados' + }, + { + 'name': 'Demi Lovato', + 'follower_count': 80, + 'description': 'Musician and actress', + 'country': 'United States' + }, + { + 'name': "Victoria's Secret", + 'follower_count': 69, + 'description': 'Lingerie brand', + 'country': 'United States' + }, + { + 'name': 'Zendaya', + 'follower_count': 68, + 'description': 'Actress and musician', + 'country': 'United States' + }, + { + 'name': 'Shakira', + 'follower_count': 66, + 'description': 'Musician', + 'country': 'Colombia' + }, + { + 'name': 'Drake', + 'follower_count': 65, + 'description': 'Musician', + 'country': 'Canada' + }, + { + 'name': 'Chris Brown', + 'follower_count': 64, + 'description': 'Musician', + 'country': 'United States' + }, + { + 'name': 'LeBron James', + 'follower_count': 63, + 'description': 'Basketball player', + 'country': 'United States' + }, + { + 'name': 'Vin Diesel', + 'follower_count': 62, + 'description': 'Actor', + 'country': 'United States' + }, + { + 'name': 'Cardi B', + 'follower_count': 67, + 'description': 'Musician', + 'country': 'United States' + }, + { + 'name': 'David Beckham', + 'follower_count': 82, + 'description': 'Footballer', + 'country': 'United Kingdom' + }, + { + 'name': 'Billie Eilish', + 'follower_count': 61, + 'description': 'Musician', + 'country': 'United States' + }, + { + 'name': 'Justin Timberlake', + 'follower_count': 59, + 'description': 'Musician and actor', + 'country': 'United States' + }, + { + 'name': 'UEFA Champions League', + 'follower_count': 58, + 'description': 'Club football competition', + 'country': 'Europe' + }, + { + 'name': 'NASA', + 'follower_count': 56, + 'description': 'Space agency', + 'country': 'United States' + }, + { + 'name': 'Emma Watson', + 'follower_count': 56, + 'description': 'Actress', + 'country': 'United Kingdom' + }, + { + 'name': 'Shawn Mendes', + 'follower_count': 57, + 'description': 'Musician', + 'country': 'Canada' + }, + { + 'name': 'Virat Kohli', + 'follower_count': 55, + 'description': 'Cricketer', + 'country': 'India' + }, + { + 'name': 'Gigi Hadid', + 'follower_count': 54, + 'description': 'Model', + 'country': 'United States' + }, + { + 'name': 'Priyanka Chopra Jonas', + 'follower_count': 53, + 'description': 'Actress and musician', + 'country': 'India' + }, + { + 'name': '9GAG', + 'follower_count': 52, + 'description': 'Social media platform', + 'country': 'China' + }, + { + 'name': 'Ronaldinho', + 'follower_count': 51, + 'description': 'Footballer', + 'country': 'Brasil' + }, + { + 'name': 'Maluma', + 'follower_count': 50, + 'description': 'Musician', + 'country': 'Colombia' + }, + { + 'name': 'Camila Cabello', + 'follower_count': 49, + 'description': 'Musician', + 'country': 'Cuba' + }, + { + 'name': 'NBA', + 'follower_count': 47, + 'description': 'Club Basketball Competition', + 'country': 'United States' + } +]