diff --git a/Day 1/band-generator.py b/Day 1/band-generator.py index 48538d9..ef35ece 100644 --- a/Day 1/band-generator.py +++ b/Day 1/band-generator.py @@ -1,14 +1,14 @@ #1. Create a greeting for your program. -print("Hello there! Welcome to Band Generator.") +print("welcome to Day 1 of 100 days of Python") #2. Ask the user for the city that they grew up in. -city = input("Please tell us your city name. \n") +city = input("In which city you grew in?\n") #3. Ask the user for the name of a pet. -pet = input("Please tell us your pet's name. \n") +pet = input("What is name of your pet? \n") #4. Combine the name of their city and pet and show them their band name. band_name = f"{city} {pet}" #5. Make sure the input cursor shows on a new line. -print(f"Your band name should be {band_name}.") \ No newline at end of file +print(f"Your band name should be {band_name}.") diff --git a/Day 1/exercise1.py b/Day 1/exercise1.py index 02441a6..88b5c1f 100644 --- a/Day 1/exercise1.py +++ b/Day 1/exercise1.py @@ -1,5 +1,4 @@ '''Write a program in main.py that prints the some notes from the previous lesson using what you have learnt about the Python print function.''' -print("100 Days of Python") +print("I am doing the challenge 100 Days of Python") print("This is the Day 1.") -print("We can print single quotes like this ' '.") \ No newline at end of file diff --git a/Day 1/exercise2.py b/Day 1/exercise2.py index b7ed4b3..8819a96 100644 --- a/Day 1/exercise2.py +++ b/Day 1/exercise2.py @@ -11,7 +11,7 @@ print('e.g. print("Hello " + "world")') print(("New lines can be created with a backslash and n.") ''' - +#Fixed print("Day 1 - String Manipulation") print('String Concatenation is done with the "+" sign.') print('e.g. print("Hello " + "world")') @@ -68,4 +68,4 @@ def test_1(self): print(".\n.\n.") unittest.main(verbosity=1, exit=False) -os.remove("testing_copy.py") \ No newline at end of file +os.remove("testing_copy.py") diff --git a/Day 1/exercise3.py b/Day 1/exercise3.py index 4f35884..aff5188 100644 --- a/Day 1/exercise3.py +++ b/Day 1/exercise3.py @@ -3,4 +3,4 @@ ''' string = input("Enter the string : ") -print(len(string)) \ No newline at end of file +print(len(string)) diff --git a/Day 1/exercise4.py b/Day 1/exercise4.py index 23c59cf..d1d7c45 100644 --- a/Day 1/exercise4.py +++ b/Day 1/exercise4.py @@ -1,5 +1,5 @@ '''Write a program that switches the values stored in the variables a and b.''' -a, b = map(int, input().split(" ")) -a, b = b, a -print(a, b) +x, y = map(int, input().split(" ")) +x, y = y, x +print(x, y) diff --git a/Day 1/main.py b/Day 1/main.py index 1eaa088..f301245 100644 --- a/Day 1/main.py +++ b/Day 1/main.py @@ -1 +1 @@ -print("Hello World !") \ No newline at end of file +print("Hello World!") diff --git a/Day 2/exercise1.py b/Day 2/exercise1.py index 88fdf71..c31e354 100644 --- a/Day 2/exercise1.py +++ b/Day 2/exercise1.py @@ -11,4 +11,4 @@ sum = int(two_digit_number[0])+int(two_digit_number[1]) print(f"Sum of digits of {two_digit_number} is {sum}.") except ValueError: - print("Please enter an integer.") + print("Please enter only two digit integer.") diff --git a/Day 2/exercise2.py b/Day 2/exercise2.py index b21d7ce..e8c9feb 100644 --- a/Day 2/exercise2.py +++ b/Day 2/exercise2.py @@ -13,7 +13,11 @@ # Write your code below this line 👇 try: - bmi = float(weight)/(float(height)**2) - print(f"Your BMI is {bmi}.") + height = float(height) + weight = float(weight) + + bmi = weight / (height ** 2) + print("Your BMI is:", round(bmi, 2)) + except ValueError: - print("Please enter integer or float values only.") + print("Invalid input. Please enter numeric values only.") diff --git a/Day 2/exercise3.py b/Day 2/exercise3.py index 51aa71a..8dd37aa 100644 --- a/Day 2/exercise3.py +++ b/Day 2/exercise3.py @@ -8,6 +8,16 @@ Where x, y and z are replaced with the actual calculated numbers. ''' +''' +Create a program using maths and f-Strings that tells us how many days, weeks, months we have left if we live until 90 years old. + +It will take your current age as the input and output a message with our time left in this format: + +You have x days, y weeks, and z months left. + +Where x, y and z are replaced with the actual calculated numbers. +''' + # 🚨 Don't change the code below 👇 age = input("What is your current age?") # 🚨 Don't change the code above 👆 @@ -15,14 +25,10 @@ # Write your code below this line 👇 try: - age = int(age) - years_left = 90 - age - months_left = years_left * 12 - weeks_left = years_left * 52 - days_left = years_left * 365 - - print( - f"You have {years_left} years, {months_left} months, {weeks_left} weeks and {days_left} days left.") - + a = 90-int(age) + x = a*365 + y = a*52 + z = a*12 + print("You have", x,"days", y,"weeks", "and",z ,"months left") except ValueError: - print("Enter age in integer only.") + print("please enter age value in Integer") diff --git a/Day 2/main.py b/Day 2/main.py index 2704622..73a7832 100644 --- a/Day 2/main.py +++ b/Day 2/main.py @@ -1,4 +1,3 @@ mystery = 734_529.678 print(type(mystery)) - -print(6+4/2-(1*2)) \ No newline at end of file +print(6+4/2-(1*2)) diff --git a/Day 2/tip_calculator.py b/Day 2/tip_calculator.py index c88f913..f745c67 100644 --- a/Day 2/tip_calculator.py +++ b/Day 2/tip_calculator.py @@ -7,8 +7,7 @@ tip_rate = input( "What percent of bill do you wish to pay as tip : 10, 12 or 15 ? ") try: - amount = (float(bill)/int(persons)) * ((100+int(tip_rate))/100) - print(f"You need to pay ${round(amount,2)} per person.") - + share = ((float(bill)/int(persons))*(1+(float(tip_rate)/100))) + print("Each person should pay",round((share),2)) except ValueError: - print("Please enter float or integer values only.") + print("please enter the value in correct format") diff --git a/Day 3/exercise1.py b/Day 3/exercise1.py index 30f1445..7b74967 100644 --- a/Day 3/exercise1.py +++ b/Day 3/exercise1.py @@ -2,4 +2,11 @@ Write a program that works out whether if a given number is an odd or even number. ''' -print("Even") if int(input()) % 2 == 0 else print("Odd") +try: + sum = int(input("enter the no. to check: ")) + if sum %2 ==0: + print(f"the no.{sum} is even") + else : + print(f"the no.{sum} is Odd") +except ValueError: + print("please enter integer value only") diff --git a/Day 3/exercise2.py b/Day 3/exercise2.py index 614add8..ee33725 100644 --- a/Day 3/exercise2.py +++ b/Day 3/exercise2.py @@ -14,17 +14,15 @@ weight = input("Enter weight in kgs : ") try: - bmi = round(float(weight)/(float(height)**2)) - - if bmi < 18.5: - print(f"Your BMI is {bmi} and you are underweight.") - elif bmi < 25: - print(f"Your BMI is {bmi} and you are normal.") - elif bmi < 30: - print(f"Your BMI is {bmi} and you are slightly overweight.") - elif bmi < 35: - print(f"Your BMI is {bmi} and you are obese.") - else: - print(f"Your BMI is {bmi} and you are clinically obese.") + BMI = float(float(weight)/(float(height)*float(height))) + print(BMI) + if BMI< 18.5: + print("you are underweight") + elif BMI<25: + print("you are Normalweight") + elif BMI <30: + print("you are Obese") + else : + print("you are clinically Obese") except ValueError: - print("Enter integer or float values only.") + print("please enter only float values") diff --git a/Day 3/exercise3.py b/Day 3/exercise3.py index cfbf2f9..12a0207 100644 --- a/Day 3/exercise3.py +++ b/Day 3/exercise3.py @@ -7,18 +7,19 @@ ''' try: - year = int(input("Enter year : ")) - + year = int(input("Please enter the year: ")) + if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: - print("Leap Year !") + print(f"The year {year} is a Leap Year") else: - print("Not a leap year !") + print(f"The year {year} is NOT a Leap Year") else: - print("Leap Year !") + print(f"The year {year} is a Leap Year") else: - print("Not a leap year !") - + print(f"The year {year} is NOT a Leap Year") + except ValueError: - print("Enter integer values only.") + print("Please enter the year in integer format only.") + diff --git a/Day 3/exercise4.py b/Day 3/exercise4.py index fa6ef2e..03d95b9 100644 --- a/Day 3/exercise4.py +++ b/Day 3/exercise4.py @@ -11,26 +11,33 @@ Extra cheese for any size pizza: + $1 ''' -size = input("Which size of pizza ? S, M or L : ") -pepperoni = input("Do you want pepperoni? Y or N : ") -cheese = input("Do you want extra cheese ? Y or N : ") +size = input("Choose your pizza size (S/M/L): ").upper() +add_pepperoni = input("Do you want pepperoni? (Y/N): ").upper() +extra_cheese = input("Do you want extra cheese? (Y/N): ").upper() bill = 0 -if size == 'S': +# Base price +if size == "S": bill += 15 -elif size == 'M': +elif size == "M": bill += 20 -else: +elif size == "L": bill += 25 +else: + print("Invalid pizza size entered!") + exit() -if pepperoni == 'Y': - if size == 'S': +# Pepperoni +if add_pepperoni == "Y": + if size == "S": bill += 2 else: bill += 3 -if cheese == 'Y': +# Extra cheese +if extra_cheese == "Y": bill += 1 -print(f"Your total bill is {bill}.") +print(f"Your final bill is: ${bill}") + diff --git a/Day 3/exercise5.py b/Day 3/exercise5.py index cf3b96f..d533473 100644 --- a/Day 3/exercise5.py +++ b/Day 3/exercise5.py @@ -14,26 +14,22 @@ # Write your code below this line 👇 -name_string = (name1+name2).lower() +combined = (name1 + name2).lower() -t = name_string.count("t") -r = name_string.count("r") -u = name_string.count("u") -e = name_string.count("e") +# Count TRUE letters +t = combined.count("t") +r = combined.count("r") +u = combined.count("u") +e1 = combined.count("e") +true = t + r + u + e1 -l = name_string.count("l") -o = name_string.count("o") -v = name_string.count("v") -e = name_string.count("e") +# Count LOVE letters +l = combined.count("l") +o = combined.count("o") +v = combined.count("v") +e2 = combined.count("e") +love = l + o + v + e2 -true = t+r+u+e -love = l+o+v+e +score = int(str(true) + str(love)) -true_love = int(str(true)+str(love)) - -if true_love < 10 or true_love > 90: - print(f"Your score is {true_love}") -elif 40 <= true_love <= 50: - print(f"Your score is {true_love}, you are alright together.") -else: - print(f"Your score is {true_love}") +print(f"Your love score is {score}") diff --git a/Day 3/main.py b/Day 3/main.py index 3f4779e..fe674a5 100644 --- a/Day 3/main.py +++ b/Day 3/main.py @@ -11,22 +11,25 @@ - photo : + $3 ''' +print("Welcome to the Rollercoaster Ride!") + height = int(input("What is your height in cms? : ")) +age = int(input("Please enter your age in years: ")) +photo = input("Do you want framed picture of your ride (Y/N): ").upper() + +price = 0 if height >= 120: - bill = 0 - age = int(input("How old are you ? : ")) - if age <= 12: - bill += 5 + if age < 12: + price += 5 elif age < 18: - bill += 7 + price += 7 else: - bill += 12 + price += 12 - photo = input("Do you want photo? : ") if photo == "Y": - bill += 3 + price += 3 - print(f"Your total bill is {bill}.") + print(f"Total price for your ride is ${price}") else: - print("You are not eligible for the rollercoaster ride.") + print("Sorry! You must be at least 120 cm tall to ride.") diff --git a/Day 3/treasure_island.py b/Day 3/treasure_island.py index 7d8687f..01f80bd 100644 --- a/Day 3/treasure_island.py +++ b/Day 3/treasure_island.py @@ -41,4 +41,4 @@ else: print("You get attacked by an angry trout. Game Over.") else: - print("You fell into a hole. Game Over.") + print("You fell into a deadly hole. Game Over.") diff --git a/Day 4/exercise1.py b/Day 4/exercise1.py index be6c6c3..c9550e3 100644 --- a/Day 4/exercise1.py +++ b/Day 4/exercise1.py @@ -13,8 +13,8 @@ # 🚨 Don't change the code above 👆 # Write your code below this line 👇 -randomSide = random.randint(0, 1) -if randomSide == 1: +toss = random.randint(0,1) +if toss == 1: print("Heads") else: print("Tails") diff --git a/Day 4/exercise2.py b/Day 4/exercise2.py index 3f104be..033139f 100644 --- a/Day 4/exercise2.py +++ b/Day 4/exercise2.py @@ -3,20 +3,17 @@ ''' import random + # 🚨 Don't change the code below 👇 test_seed = int(input("Create a seed number: ")) random.seed(test_seed) # Split string method -namesAsCSV = input("Give me everybody's names, seperated by a comma. ") -names = namesAsCSV.split(", ") +namesAsCSV = input("Give me everybody's names, separated by a comma: ") +names = namesAsCSV.split(",") # 🚨 Don't change the code above 👆 # Write your code below this line 👇 -num_items = len(names) -# Generate random numbers between 0 and the last index. -random_choice = random.randint(0, num_items - 1) -# Pick out random person from list of names using the random number. -person_who_will_pay = names[random_choice] +payer = random.choice(names) -print(person_who_will_pay + " is going to buy the meal today!") +print(f"{payer} is going to buy the meal today!️") diff --git a/Day 4/exercise3.py b/Day 4/exercise3.py index e269098..96082b0 100644 --- a/Day 4/exercise3.py +++ b/Day 4/exercise3.py @@ -12,20 +12,18 @@ row1 = ["⬜️", "⬜️", "⬜️"] row2 = ["⬜️", "⬜️", "⬜️"] row3 = ["⬜️", "⬜️", "⬜️"] -map = [row1, row2, row3] +treasure_map = [row1, row2, row3] print(f"{row1}\n{row2}\n{row3}") -position = input("Where do you want to put the treasure? ") +position = input("Where do you want to put the treasure? ") # e.g. "23" # 🚨 Don't change the code above 👆 -# Write your code below this row 👇 -horizontal = int(position[0]) -vertical = int(position[1]) - -map[vertical - 1][horizontal - 1] = "X" -print(f"{row1}\n{row2}\n{row3}") +# ✅ Write your code below this row 👇 +column = int(position[0]) # 1st digit → column +row = int(position[1]) # 2nd digit → row +# Since Python uses 0-based indexing +selected_row = treasure_map[row - 1] +selected_row[column - 1] = "❌" -# Write your code above this row 👆 - -# 🚨 Don't change the code below 👇 +# ✅ Final map display print(f"{row1}\n{row2}\n{row3}") diff --git a/Day 4/game.py b/Day 4/game.py index fb2c037..67008e3 100644 --- a/Day 4/game.py +++ b/Day 4/game.py @@ -1,54 +1,30 @@ -''' -Rock Paper Scissor -''' +# ROCK PAPER SCISSOR game import random -rock = ''' - _______ ----' ____) - (_____) - (_____) - (____) ----.__(___) -''' - -paper = ''' - _______ ----' ____)____ - ______) - _______) - _______) ----.__________) -''' - -scissors = ''' - _______ ----' ____)____ - ______) - __________) - (____) ----.__(___) -''' - -game_images = [rock, paper, scissors] - -user_choice = int( - input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n")) -print(game_images[user_choice]) - -computer_choice = random.randint(0, 2) -print("Computer chose:") -print(game_images[computer_choice]) - -if user_choice >= 3 or user_choice < 0: - print("You typed an invalid number, you lose!") -elif user_choice == 0 and computer_choice == 2: - print("You win!") -elif computer_choice == 0 and user_choice == 2: - print("You lose") -elif computer_choice > user_choice: - print("You lose") -elif user_choice > computer_choice: - print("You win!") -elif computer_choice == user_choice: - print("It's a draw") +list = ["Rock","Paper","Scissors"] +user = int(input("Choose your turn (0, 1, 2 for rock, paper, scissor respectively): ")) +print(f"you chose {list[user]}") +com_choice = random.randint(0,2) +print(f"the computer chose {list[com_choice]}") +if user == 0: + if com_choice == 0: + print("Draw") + elif com_choice ==1: + print("you lost") + else: + print("you won") +elif user == 1: + if com_choice == 1: + print("Draw") + elif com_choice ==2: + print("you lost") + else: + print("you won") + +else: + if com_choice == 2: + print("Draw") + elif com_choice ==0: + print("you lost") + else: + print("you won") diff --git a/Day 5/exercise1.py b/Day 5/exercise1.py index 1ce8fa1..32d1512 100644 --- a/Day 5/exercise1.py +++ b/Day 5/exercise1.py @@ -1,4 +1,5 @@ ''' +EXERCISE 1: You are going to write a program that calculates the average student height from a List of heights. e.g. student_heights = [180, 124, 165, 173, 189, 169, 146] @@ -10,14 +11,13 @@ student_heights = input("Input a list of student heights ").split() for n in range(0, len(student_heights)): student_heights[n] = int(student_heights[n]) -# 🚨 Don't change the code above 👆 +# 🚨 Don't change the code above👆 # Write your code below this row 👇 - -total_height = 0 - -for height in student_heights: - total_height += height - -print(f"Average height of students is {round(total_height/len(student_heights))}") +summ = 0 +t_num = len(student_heights) +for n in range(0, t_num): + summ += int(student_heights[n]) +avg_height = round(summ/t_num, 2) +print(f"avg height is {avg_height}") diff --git a/Day 5/exercise2.py b/Day 5/exercise2.py index e5f0e68..4bc2d20 100644 --- a/Day 5/exercise2.py +++ b/Day 5/exercise2.py @@ -9,18 +9,13 @@ ''' # 🚨 Don't change the code below 👇 -student_scores = input("Input a list of student scores ").split() +student_scores = input("Input a list of student scores: ").split() for n in range(0, len(student_scores)): student_scores[n] = int(student_scores[n]) -print(student_scores) -# 🚨 Don't change the code above 👆 - -# Write your code below this row 👇 - -max_score = 0 +highest = 0 for score in student_scores: - if score > max_score: - max_score = score + if score > highest: + highest = score -print(f"The highest score in the class is: {max_score}") +print(f"The highest score in the class is: {highest}") diff --git a/Day 5/exercise3.py b/Day 5/exercise3.py index 7adfcb5..4b9b927 100644 --- a/Day 5/exercise3.py +++ b/Day 5/exercise3.py @@ -1,17 +1,14 @@ ''' -You are going to write a program that calculates the sum of all the even numbers from 1 to 100, including 1 and 100. +You are going to write a program that calculates the sum of all the even numbers from 1 to 100, +including 1 and 100. e.g. 2 + 4 + 6 + 8 +10 ... + 98 + 100 -Important, there should only be 1 print statement in your console output. It should just print the final total and not every step of the calculation. +Important, there should only be 1 print statement in your console output. +It should just print the final total and not every step of the calculation. ''' #Write your code below this row 👇 - -total = 0 - -for num in range(1,101): - if num % 2 == 0: - total += num - -print(total) \ No newline at end of file +n =100/2 +Sum = int(n*(n+1)) +print(f"the sum of all the even nos. from 1 to 100: {Sum}") diff --git a/Day 5/exercise4.py b/Day 5/exercise4.py index b543384..4f88e42 100644 --- a/Day 5/exercise4.py +++ b/Day 5/exercise4.py @@ -11,13 +11,14 @@ ''' # Write your code below this row 👇 - -for num in range(1, 101): - if num % 3 == 0 and num % 5 == 0: - print("FizzBuzz") - elif num % 3 == 0 and num % 5 != 0: - print("Fizz") - elif num % 3 != 0 and num % 5 == 0: - print("Buzz") +for num in range(1,101): + if num % 3 == 0: + if num % 5 ==0: + print("FizzBuzz") + else: + print("Fizz") else: - print(num) + if num % 5 ==0: + print("Buzz") + else: + print(num) diff --git a/Day 5/password_generator.py b/Day 5/password_generator.py index 7946875..513aa4e 100644 --- a/Day 5/password_generator.py +++ b/Day 5/password_generator.py @@ -10,38 +10,31 @@ nr_symbols = int(input(f"How many symbols would you like?\n")) nr_numbers = int(input(f"How many numbers would you like?\n")) -# Eazy Level - Order not randomised: -# e.g. 4 letter, 2 symbol, 2 number = JduE&!91 -password = "" -for char in range(1, nr_letters + 1): - password += random.choice(letters) -for char in range(1, nr_symbols + 1): - password += random.choice(symbols) +#Easy level (Non randomised order) +password = [] -for char in range(1, nr_numbers + 1): +for char in range(1,nr_letters + 1): + password += random.choice(letters) +for char in range(1, nr_symbols+1): + password += random.choice(symbols) +for char in range(1,nr_numbers): password += random.choice(numbers) - -print(f"Your easy password is {password}") - -# Hard Level - Order of characters randomised: -# e.g. 4 letter, 2 symbol, 2 number = g^2jk8&P -password_list = [] - -for char in range(1, nr_letters + 1): - password_list.append(random.choice(letters)) - -for char in range(1, nr_symbols + 1): - password_list += random.choice(symbols) - -for char in range(1, nr_numbers + 1): - password_list += random.choice(numbers) - -random.shuffle(password_list) - -password = "" -for char in password_list: - password += char - -print(f"Your hard password is: {password}") +password = ''.join(password) +print(f"Easy password is: {password}") + +#Tough level (Randomised Order) +Tpassword = [] + +for char in range(1,nr_letters + 1): + Tpassword.append(random.choice(letters)) +for char in range(1, nr_symbols+1): + Tpassword.append(random.choice(symbols)) +for char in range(1,nr_numbers): + Tpassword.append(random.choice(numbers)) + +random.shuffle(Tpassword) +Tpassword = ''.join(Tpassword) + +print(f"Hard password is: {Tpassword}") diff --git a/Day 6/hurdle1.py b/Day 6/hurdle1.py index 8a5b832..5f9ed92 100644 --- a/Day 6/hurdle1.py +++ b/Day 6/hurdle1.py @@ -7,8 +7,7 @@ def turn_right(): turn_left() turn_left() -def complete(): - move() +def jump(): turn_left() move() turn_right() @@ -16,6 +15,9 @@ def complete(): turn_right() move() turn_left() - -for _ in range(6): - complete() \ No newline at end of file + +while not at_goal(): + if wall_in_front(): + jump() + else: + move() diff --git a/Day 6/hurdle2.py b/Day 6/hurdle2.py index 5267cf0..1e8a474 100644 --- a/Day 6/hurdle2.py +++ b/Day 6/hurdle2.py @@ -8,8 +8,7 @@ def turn_right(): turn_left() turn_left() -def complete(): - move() +def jump(): turn_left() move() turn_right() @@ -19,4 +18,7 @@ def complete(): turn_left() while not at_goal(): - complete() \ No newline at end of file + if wall_in_front(): + jump() + else: + move() diff --git a/Day 6/hurdle3.py b/Day 6/hurdle3.py index 33584b1..369b745 100644 --- a/Day 6/hurdle3.py +++ b/Day 6/hurdle3.py @@ -17,7 +17,7 @@ def jump(): turn_left() while not at_goal(): - if front_is_clear(): - move() + if wall_in_front(): + jump() else: - jump() \ No newline at end of file + move() diff --git a/Day 6/hurdle4.py b/Day 6/hurdle4.py index c1865c2..f96829a 100644 --- a/Day 6/hurdle4.py +++ b/Day 6/hurdle4.py @@ -19,7 +19,7 @@ def jump(): turn_left() while not at_goal(): - if front_is_clear(): - move() + if wall_in_front(): + jump() else: - jump() \ No newline at end of file + move() diff --git a/Day 6/maze.py b/Day 6/maze.py index 9881f67..edc187e 100644 --- a/Day 6/maze.py +++ b/Day 6/maze.py @@ -14,4 +14,4 @@ def turn_right(): elif front_is_clear(): move() else: - turn_left() \ No newline at end of file + turn_left() diff --git a/Day 7/challenge1.py b/Day 7/challenge1.py index 41463dc..230d81f 100644 --- a/Day 7/challenge1.py +++ b/Day 7/challenge1.py @@ -5,16 +5,15 @@ # TODO-1 - Randomly choose a word from the word_list and assign it to a variable called chosen_word. -chosen_word = random.choice(word_list) +chosen = random.choice(word_list) # TODO-2 - Ask the user to guess a letter and assign their answer to a variable called guess. Make guess lowercase. -guess = input("Guess a letter: ").lower() +guess = input("Guess a letter among the word_list: ").lower() # TODO-3 - Check if the letter the user guessed (guess) is one of the letters in the chosen_word. -for letter in chosen_word: - if guess == letter: - print("Right") - else: - print("Wrong") +if guess == chosen: + print("you guessed Right") +else: + print("you guessed Wrong") diff --git a/readme_checklist.md b/readme_checklist.md new file mode 100644 index 0000000..a6137c3 --- /dev/null +++ b/readme_checklist.md @@ -0,0 +1,8 @@ +checklist +day 1: [X] +day 2: [X] +day 3: [X] +day 4: [X] +day 5: [X] +day 6: [X] +day 7: [ ]