From 98842c8e059a333362485f02e369ebe470bcf064 Mon Sep 17 00:00:00 2001 From: Alejosz1902 <111547538+Alejosz1902@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:51:12 +0000 Subject: [PATCH] Exercises completed --- .learn/resets/01-Console/app.py | 1 + .learn/resets/02-Declare-Variables/app.py | 1 + .../03-Print-Variables-In-The-Console/app.py | 1 + .learn/resets/04-Multiply-Two-Values/app.py | 1 + .learn/resets/05-User-Inputed-Values/app.py | 4 +++ .learn/resets/06-String-Concatenation/app.py | 6 +++++ .learn/resets/07-Create-a-Basic-HTML/app.py | 13 ++++++++++ .learn/resets/08.1-Your-First-If/app.py | 3 +++ .../08.2-How-Much-The-Wedding-Costs/app.py | 12 +++++++++ .learn/resets/09-Random-Numbers/app.py | 8 ++++++ .../10-Calling-Your-First-Function/app.py | 6 +++++ .../10.1-Creating-Your-First-Function/app.py | 6 +++++ .learn/resets/11-Create-A-New-Function/app.py | 3 +++ .../resets/12-Rand-From-One-to-Twelve/app.py | 8 ++++++ .learn/resets/13-Your-First-Loop/app.py | 6 +++++ .learn/resets/14-Create-A-For-Loop/app.py | 5 ++++ .learn/resets/15-Looping-With-FizzBuzz/app.py | 5 ++++ .learn/resets/16-Random-Colors-Loop/app.py | 25 +++++++++++++++++++ .learn/resets/17-Russian-Roulette/app.py | 15 +++++++++++ .learn/resets/18-The-Beatles/app.py | 2 ++ .learn/resets/19-Bottles-Of-Milk/app.py | 1 + .vscode/settings.json | 5 +++- exercises/01-Console/app.py | 3 ++- exercises/02-Declare-Variables/app.py | 2 ++ .../03-Print-Variables-In-The-Console/app.py | 6 ++++- exercises/04-Multiply-Two-Values/app.py | 2 ++ exercises/05-User-Inputed-Values/app.py | 2 +- exercises/06-String-Concatenation/app.py | 3 ++- exercises/07-Create-a-Basic-HTML/app.py | 2 ++ exercises/08.1-Your-First-If/app.py | 6 +++++ .../08.2-How-Much-The-Wedding-Costs/app.py | 7 +++++- exercises/09-Random-Numbers/app.py | 2 +- .../10-Calling-Your-First-Function/app.py | 3 ++- .../10.1-Creating-Your-First-Function/app.py | 1 + exercises/11-Create-A-New-Function/app.py | 4 +++ exercises/12-Rand-From-One-to-Twelve/app.py | 3 ++- exercises/13-Your-First-Loop/app.py | 2 +- exercises/14-Create-A-For-Loop/app.py | 5 +++- exercises/15-Looping-With-FizzBuzz/app.py | 10 +++++++- exercises/16-Random-Colors-Loop/app.py | 5 +++- exercises/17-Russian-Roulette/app.py | 5 +++- exercises/18-The-Beatles/app.py | 12 +++++++++ exercises/19-Bottles-Of-Milk/app.py | 8 ++++++ 43 files changed, 216 insertions(+), 14 deletions(-) create mode 100644 .learn/resets/01-Console/app.py create mode 100644 .learn/resets/02-Declare-Variables/app.py create mode 100644 .learn/resets/03-Print-Variables-In-The-Console/app.py create mode 100644 .learn/resets/04-Multiply-Two-Values/app.py create mode 100644 .learn/resets/05-User-Inputed-Values/app.py create mode 100644 .learn/resets/06-String-Concatenation/app.py create mode 100644 .learn/resets/07-Create-a-Basic-HTML/app.py create mode 100644 .learn/resets/08.1-Your-First-If/app.py create mode 100644 .learn/resets/08.2-How-Much-The-Wedding-Costs/app.py create mode 100644 .learn/resets/09-Random-Numbers/app.py create mode 100644 .learn/resets/10-Calling-Your-First-Function/app.py create mode 100644 .learn/resets/10.1-Creating-Your-First-Function/app.py create mode 100644 .learn/resets/11-Create-A-New-Function/app.py create mode 100644 .learn/resets/12-Rand-From-One-to-Twelve/app.py create mode 100644 .learn/resets/13-Your-First-Loop/app.py create mode 100644 .learn/resets/14-Create-A-For-Loop/app.py create mode 100644 .learn/resets/15-Looping-With-FizzBuzz/app.py create mode 100644 .learn/resets/16-Random-Colors-Loop/app.py create mode 100644 .learn/resets/17-Russian-Roulette/app.py create mode 100644 .learn/resets/18-The-Beatles/app.py create mode 100644 .learn/resets/19-Bottles-Of-Milk/app.py diff --git a/.learn/resets/01-Console/app.py b/.learn/resets/01-Console/app.py new file mode 100644 index 00000000..ff00ab34 --- /dev/null +++ b/.learn/resets/01-Console/app.py @@ -0,0 +1 @@ +# print "Hello World!" on the console \ No newline at end of file diff --git a/.learn/resets/02-Declare-Variables/app.py b/.learn/resets/02-Declare-Variables/app.py new file mode 100644 index 00000000..83e80593 --- /dev/null +++ b/.learn/resets/02-Declare-Variables/app.py @@ -0,0 +1 @@ +# ✅ ↓ your code here ↓ ✅ diff --git a/.learn/resets/03-Print-Variables-In-The-Console/app.py b/.learn/resets/03-Print-Variables-In-The-Console/app.py new file mode 100644 index 00000000..f62f6922 --- /dev/null +++ b/.learn/resets/03-Print-Variables-In-The-Console/app.py @@ -0,0 +1 @@ +# ✅ ↓ your code here ↓ ✅ \ No newline at end of file diff --git a/.learn/resets/04-Multiply-Two-Values/app.py b/.learn/resets/04-Multiply-Two-Values/app.py new file mode 100644 index 00000000..83e80593 --- /dev/null +++ b/.learn/resets/04-Multiply-Two-Values/app.py @@ -0,0 +1 @@ +# ✅ ↓ your code here ↓ ✅ diff --git a/.learn/resets/05-User-Inputed-Values/app.py b/.learn/resets/05-User-Inputed-Values/app.py new file mode 100644 index 00000000..b569ee62 --- /dev/null +++ b/.learn/resets/05-User-Inputed-Values/app.py @@ -0,0 +1,4 @@ +age = int(input('What is your age?\n')) +# ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅ + +print("Your age is: "+str(age)) \ No newline at end of file diff --git a/.learn/resets/06-String-Concatenation/app.py b/.learn/resets/06-String-Concatenation/app.py new file mode 100644 index 00000000..97521fb2 --- /dev/null +++ b/.learn/resets/06-String-Concatenation/app.py @@ -0,0 +1,6 @@ +# ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅ + + +## Don't change anything below this line +the_new_string = my_var1 + ' ' + my_var2 +print(the_new_string) diff --git a/.learn/resets/07-Create-a-Basic-HTML/app.py b/.learn/resets/07-Create-a-Basic-HTML/app.py new file mode 100644 index 00000000..ab15ceb0 --- /dev/null +++ b/.learn/resets/07-Create-a-Basic-HTML/app.py @@ -0,0 +1,13 @@ +a = '' +b = '' +c = '' +d = '' +e = '' +f = '' +g = '' +h = '<body>' + +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + +# ✅ ↓ start coding below here ↓ ✅ + diff --git a/.learn/resets/08.1-Your-First-If/app.py b/.learn/resets/08.1-Your-First-If/app.py new file mode 100644 index 00000000..6928dd3f --- /dev/null +++ b/.learn/resets/08.1-Your-First-If/app.py @@ -0,0 +1,3 @@ +total = int(input('How much money do you have in your pocket\n')) + +# ✅ ↓ YOUR CODE HERE ↓ ✅ diff --git a/.learn/resets/08.2-How-Much-The-Wedding-Costs/app.py b/.learn/resets/08.2-How-Much-The-Wedding-Costs/app.py new file mode 100644 index 00000000..ad0a1008 --- /dev/null +++ b/.learn/resets/08.2-How-Much-The-Wedding-Costs/app.py @@ -0,0 +1,12 @@ +user_input = int(input('How many people are coming to your wedding?\n')) + +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + + +if user_input <= 50: + price = 4000 +# ✅ ↓ Your code here ↓ ✅ + + +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ +print('Your wedding will cost '+str(price)+' dollars') \ No newline at end of file diff --git a/.learn/resets/09-Random-Numbers/app.py b/.learn/resets/09-Random-Numbers/app.py new file mode 100644 index 00000000..9e4d5316 --- /dev/null +++ b/.learn/resets/09-Random-Numbers/app.py @@ -0,0 +1,8 @@ +import random + +def get_randomInt(): + # ✅ ↓ CHANGE ONLY THIS ONE LINE BELOW ↓ ✅ + random_number = random.random() + return random_number + +print(get_randomInt()) \ No newline at end of file diff --git a/.learn/resets/10-Calling-Your-First-Function/app.py b/.learn/resets/10-Calling-Your-First-Function/app.py new file mode 100644 index 00000000..7e7dd0aa --- /dev/null +++ b/.learn/resets/10-Calling-Your-First-Function/app.py @@ -0,0 +1,6 @@ +def is_odd(my_number): + return (my_number % 2 != 0) + + +def my_main_code(): + # ✅ ↓ Your code here ↓ ✅ \ No newline at end of file diff --git a/.learn/resets/10.1-Creating-Your-First-Function/app.py b/.learn/resets/10.1-Creating-Your-First-Function/app.py new file mode 100644 index 00000000..4db5352c --- /dev/null +++ b/.learn/resets/10.1-Creating-Your-First-Function/app.py @@ -0,0 +1,6 @@ +def add_numbers(a,b): + # This is the function's body ✅↓ Write your code here ↓✅ + + +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ +print(add_numbers(3,4)) diff --git a/.learn/resets/11-Create-A-New-Function/app.py b/.learn/resets/11-Create-A-New-Function/app.py new file mode 100644 index 00000000..46b20099 --- /dev/null +++ b/.learn/resets/11-Create-A-New-Function/app.py @@ -0,0 +1,3 @@ +import random + +# ✅↓ Write your code here ↓✅ diff --git a/.learn/resets/12-Rand-From-One-to-Twelve/app.py b/.learn/resets/12-Rand-From-One-to-Twelve/app.py new file mode 100644 index 00000000..d7304410 --- /dev/null +++ b/.learn/resets/12-Rand-From-One-to-Twelve/app.py @@ -0,0 +1,8 @@ +import random + +def get_randomInt(): + # ✅↓ Write your code here ↓✅ + return None + +# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ +print(get_randomInt()) diff --git a/.learn/resets/13-Your-First-Loop/app.py b/.learn/resets/13-Your-First-Loop/app.py new file mode 100644 index 00000000..542b4980 --- /dev/null +++ b/.learn/resets/13-Your-First-Loop/app.py @@ -0,0 +1,6 @@ +def start_counting(): + for i in range(10): + print(i) + return i + +start_counting() \ No newline at end of file diff --git a/.learn/resets/14-Create-A-For-Loop/app.py b/.learn/resets/14-Create-A-For-Loop/app.py new file mode 100644 index 00000000..19631c70 --- /dev/null +++ b/.learn/resets/14-Create-A-For-Loop/app.py @@ -0,0 +1,5 @@ +def standards_maker(): + # ✅↓ Write your code here ↓✅ + + +# ✅↓ remember to call the function outside (here) ↓✅ diff --git a/.learn/resets/15-Looping-With-FizzBuzz/app.py b/.learn/resets/15-Looping-With-FizzBuzz/app.py new file mode 100644 index 00000000..fff86955 --- /dev/null +++ b/.learn/resets/15-Looping-With-FizzBuzz/app.py @@ -0,0 +1,5 @@ +def fizz_buzz(): + # ✅↓ Write your code here ↓✅ + +# ❌↓ DON'T CHANGE THE CODE BELOW ↓❌ +fizz_buzz() diff --git a/.learn/resets/16-Random-Colors-Loop/app.py b/.learn/resets/16-Random-Colors-Loop/app.py new file mode 100644 index 00000000..0e29ead7 --- /dev/null +++ b/.learn/resets/16-Random-Colors-Loop/app.py @@ -0,0 +1,25 @@ +import random + +def get_color(color_number=4): + # Making sure is a number and not a string + color_number = int(color_number) + + switcher = { + 0:'red', + 1:'yellow', + 2:'blue', + 3:'green', + 4:'black' + } + + return switcher.get(color_number,"Invalid Color Number") + +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ + +def get_allStudentColors(): + example_color = get_color(1) + students_array = [] + # ✅ ↓ your loop here ↓ ✅ + + +print(get_allStudentColors()) diff --git a/.learn/resets/17-Russian-Roulette/app.py b/.learn/resets/17-Russian-Roulette/app.py new file mode 100644 index 00000000..e8704639 --- /dev/null +++ b/.learn/resets/17-Russian-Roulette/app.py @@ -0,0 +1,15 @@ +import random + +bullet_position = 3 + +def spin_chamber(): + chamber_position = random.randint(1,6) + return chamber_position + +# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ +def fire_gun(): + # ✅ ↓ your code here ↓ ✅ + return None + + +print(fire_gun()) diff --git a/.learn/resets/18-The-Beatles/app.py b/.learn/resets/18-The-Beatles/app.py new file mode 100644 index 00000000..d87e6fa1 --- /dev/null +++ b/.learn/resets/18-The-Beatles/app.py @@ -0,0 +1,2 @@ +# ✅↓ Write your code here ↓✅ + diff --git a/.learn/resets/19-Bottles-Of-Milk/app.py b/.learn/resets/19-Bottles-Of-Milk/app.py new file mode 100644 index 00000000..9733b0fc --- /dev/null +++ b/.learn/resets/19-Bottles-Of-Milk/app.py @@ -0,0 +1 @@ +# ✅↓ Write your code here ↓✅ diff --git a/.vscode/settings.json b/.vscode/settings.json index 2f5ad94d..0e3da4bb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,8 @@ "editor.minimap.enabled": false, "workbench.editorAssociations": { "*.md": "vscode.markdown.preview.editor" - } + }, + "githubPullRequests.ignoredPullRequestBranches": [ + "master" + ] } \ No newline at end of file diff --git a/exercises/01-Console/app.py b/exercises/01-Console/app.py index ff00ab34..6cac611d 100644 --- a/exercises/01-Console/app.py +++ b/exercises/01-Console/app.py @@ -1 +1,2 @@ -# print "Hello World!" on the console \ No newline at end of file +# print "Hello World!" on the console +print ("Hello World!") \ No newline at end of file diff --git a/exercises/02-Declare-Variables/app.py b/exercises/02-Declare-Variables/app.py index 83e80593..b50b50e6 100644 --- a/exercises/02-Declare-Variables/app.py +++ b/exercises/02-Declare-Variables/app.py @@ -1 +1,3 @@ # ✅ ↓ your code here ↓ ✅ +color = "Yellow" +print(color) \ No newline at end of file diff --git a/exercises/03-Print-Variables-In-The-Console/app.py b/exercises/03-Print-Variables-In-The-Console/app.py index f62f6922..7e819b76 100644 --- a/exercises/03-Print-Variables-In-The-Console/app.py +++ b/exercises/03-Print-Variables-In-The-Console/app.py @@ -1 +1,5 @@ -# ✅ ↓ your code here ↓ ✅ \ No newline at end of file +# ✅ ↓ your code here ↓ ✅ +color = "red" +item = "marker" + +print(color, item) diff --git a/exercises/04-Multiply-Two-Values/app.py b/exercises/04-Multiply-Two-Values/app.py index 83e80593..46ee9e45 100644 --- a/exercises/04-Multiply-Two-Values/app.py +++ b/exercises/04-Multiply-Two-Values/app.py @@ -1 +1,3 @@ # ✅ ↓ your code here ↓ ✅ +variables_are_cool = 2345 * 7323 +print(variables_are_cool) \ No newline at end of file diff --git a/exercises/05-User-Inputed-Values/app.py b/exercises/05-User-Inputed-Values/app.py index b569ee62..4ff652a9 100644 --- a/exercises/05-User-Inputed-Values/app.py +++ b/exercises/05-User-Inputed-Values/app.py @@ -1,4 +1,4 @@ age = int(input('What is your age?\n')) # ✅ ↓ CHANGE THE CODE BELOW TO ADD 10 TO AGE ↓ ✅ - +age +=10 print("Your age is: "+str(age)) \ No newline at end of file diff --git a/exercises/06-String-Concatenation/app.py b/exercises/06-String-Concatenation/app.py index 97521fb2..059ac142 100644 --- a/exercises/06-String-Concatenation/app.py +++ b/exercises/06-String-Concatenation/app.py @@ -1,5 +1,6 @@ # ✅ ↓ Set the values for my_var1 and my_var2 here ↓ ✅ - +my_var1 = "Hello" +my_var2 = "World" ## Don't change anything below this line the_new_string = my_var1 + ' ' + my_var2 diff --git a/exercises/07-Create-a-Basic-HTML/app.py b/exercises/07-Create-a-Basic-HTML/app.py index ab15ceb0..b8a51f61 100644 --- a/exercises/07-Create-a-Basic-HTML/app.py +++ b/exercises/07-Create-a-Basic-HTML/app.py @@ -11,3 +11,5 @@ # ✅ ↓ start coding below here ↓ ✅ +html_document = e + c +g +a +f+h+d+b +print(html_document) \ No newline at end of file diff --git a/exercises/08.1-Your-First-If/app.py b/exercises/08.1-Your-First-If/app.py index 6928dd3f..6b18ca4a 100644 --- a/exercises/08.1-Your-First-If/app.py +++ b/exercises/08.1-Your-First-If/app.py @@ -1,3 +1,9 @@ total = int(input('How much money do you have in your pocket\n')) # ✅ ↓ YOUR CODE HERE ↓ ✅ +if total >100: + print("Give me your money!") +elif total >50: + print("Buy me some coffee, you cheap!") +else: + print("You are a poor guy, go away!") \ No newline at end of file diff --git a/exercises/08.2-How-Much-The-Wedding-Costs/app.py b/exercises/08.2-How-Much-The-Wedding-Costs/app.py index ad0a1008..46f500f8 100644 --- a/exercises/08.2-How-Much-The-Wedding-Costs/app.py +++ b/exercises/08.2-How-Much-The-Wedding-Costs/app.py @@ -6,7 +6,12 @@ if user_input <= 50: price = 4000 # ✅ ↓ Your code here ↓ ✅ - +elif user_input <=100: + price = 10000 +elif user_input <=200: + price = 15000 +elif user_input >200: + price = 20000 # ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ print('Your wedding will cost '+str(price)+' dollars') \ No newline at end of file diff --git a/exercises/09-Random-Numbers/app.py b/exercises/09-Random-Numbers/app.py index 9e4d5316..2fbfdd0d 100644 --- a/exercises/09-Random-Numbers/app.py +++ b/exercises/09-Random-Numbers/app.py @@ -2,7 +2,7 @@ def get_randomInt(): # ✅ ↓ CHANGE ONLY THIS ONE LINE BELOW ↓ ✅ - random_number = random.random() + random_number = random.randint(1,10) return random_number print(get_randomInt()) \ No newline at end of file diff --git a/exercises/10-Calling-Your-First-Function/app.py b/exercises/10-Calling-Your-First-Function/app.py index 7e7dd0aa..a2f2aadd 100644 --- a/exercises/10-Calling-Your-First-Function/app.py +++ b/exercises/10-Calling-Your-First-Function/app.py @@ -3,4 +3,5 @@ def is_odd(my_number): def my_main_code(): - # ✅ ↓ Your code here ↓ ✅ \ No newline at end of file + # ✅ ↓ Your code here ↓ ✅ + print (is_odd(45345)) \ No newline at end of file diff --git a/exercises/10.1-Creating-Your-First-Function/app.py b/exercises/10.1-Creating-Your-First-Function/app.py index 4db5352c..b82a05d0 100644 --- a/exercises/10.1-Creating-Your-First-Function/app.py +++ b/exercises/10.1-Creating-Your-First-Function/app.py @@ -1,5 +1,6 @@ def add_numbers(a,b): # This is the function's body ✅↓ Write your code here ↓✅ + return a + b # ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ diff --git a/exercises/11-Create-A-New-Function/app.py b/exercises/11-Create-A-New-Function/app.py index 46b20099..137c342b 100644 --- a/exercises/11-Create-A-New-Function/app.py +++ b/exercises/11-Create-A-New-Function/app.py @@ -1,3 +1,7 @@ import random # ✅↓ Write your code here ↓✅ +def generate_random (): + return random.randint(0,9) + +print (generate_random) \ No newline at end of file diff --git a/exercises/12-Rand-From-One-to-Twelve/app.py b/exercises/12-Rand-From-One-to-Twelve/app.py index d7304410..f1329ca0 100644 --- a/exercises/12-Rand-From-One-to-Twelve/app.py +++ b/exercises/12-Rand-From-One-to-Twelve/app.py @@ -2,7 +2,8 @@ def get_randomInt(): # ✅↓ Write your code here ↓✅ - return None + random_number = random.randrange(1,13) + return random_number # ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌ print(get_randomInt()) diff --git a/exercises/13-Your-First-Loop/app.py b/exercises/13-Your-First-Loop/app.py index 542b4980..2cc62064 100644 --- a/exercises/13-Your-First-Loop/app.py +++ b/exercises/13-Your-First-Loop/app.py @@ -1,5 +1,5 @@ def start_counting(): - for i in range(10): + for i in range(12): print(i) return i diff --git a/exercises/14-Create-A-For-Loop/app.py b/exercises/14-Create-A-For-Loop/app.py index 19631c70..9e6aeac5 100644 --- a/exercises/14-Create-A-For-Loop/app.py +++ b/exercises/14-Create-A-For-Loop/app.py @@ -1,5 +1,8 @@ def standards_maker(): # ✅↓ Write your code here ↓✅ - + for i in range (300): + print('I will ask questions if I am stuck') + # ✅↓ remember to call the function outside (here) ↓✅ +standards_maker() \ No newline at end of file diff --git a/exercises/15-Looping-With-FizzBuzz/app.py b/exercises/15-Looping-With-FizzBuzz/app.py index fff86955..c69f6bb6 100644 --- a/exercises/15-Looping-With-FizzBuzz/app.py +++ b/exercises/15-Looping-With-FizzBuzz/app.py @@ -1,5 +1,13 @@ def fizz_buzz(): # ✅↓ Write your code here ↓✅ - + for i in range (1,101): + if i%3==0 and i%5 == 0: + print("FizzBuzz") + elif i%3==0: + print("Fizz") + elif i%5==0: + print("Buzz") + else: + print(i) # ❌↓ DON'T CHANGE THE CODE BELOW ↓❌ fizz_buzz() diff --git a/exercises/16-Random-Colors-Loop/app.py b/exercises/16-Random-Colors-Loop/app.py index 0e29ead7..4b351560 100644 --- a/exercises/16-Random-Colors-Loop/app.py +++ b/exercises/16-Random-Colors-Loop/app.py @@ -20,6 +20,9 @@ def get_allStudentColors(): example_color = get_color(1) students_array = [] # ✅ ↓ your loop here ↓ ✅ - + color_number= random.randint(0,3) + for i in range (10): + students_array.append(get_color(color_number)) + return students_array print(get_allStudentColors()) diff --git a/exercises/17-Russian-Roulette/app.py b/exercises/17-Russian-Roulette/app.py index e8704639..ad774cd5 100644 --- a/exercises/17-Russian-Roulette/app.py +++ b/exercises/17-Russian-Roulette/app.py @@ -9,7 +9,10 @@ def spin_chamber(): # ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌ def fire_gun(): # ✅ ↓ your code here ↓ ✅ - return None + if spin_chamber() == bullet_position: + return 'You are dead!' + else: + return 'Keep playing!' print(fire_gun()) diff --git a/exercises/18-The-Beatles/app.py b/exercises/18-The-Beatles/app.py index d87e6fa1..c619dcf2 100644 --- a/exercises/18-The-Beatles/app.py +++ b/exercises/18-The-Beatles/app.py @@ -1,2 +1,14 @@ # ✅↓ Write your code here ↓✅ +def sing (): + song = "" + for i in range (11): + if i == 4: + song += "there will be an answer,\n" + elif i == 10: + song += "whisper words of wisdom, let it be" + else: + song += "let it be,\n" + return song + +sing() \ No newline at end of file diff --git a/exercises/19-Bottles-Of-Milk/app.py b/exercises/19-Bottles-Of-Milk/app.py index 9733b0fc..cd2cfb15 100644 --- a/exercises/19-Bottles-Of-Milk/app.py +++ b/exercises/19-Bottles-Of-Milk/app.py @@ -1 +1,9 @@ # ✅↓ Write your code here ↓✅ +def number_of_bottles(): + for i in range (99,2,-1): + print(str(i)+" bottles of milk on the wall, " +str(i)+ " bottles of milk. Take one down and pass it around, "+str(i-1)+ " bottles of milk on the wall.") + print("2 bottles of milk on the wall, 2 bottles of milk. Take one down and pass it around, 1 bottle of milk on the wall.") + print("1 bottle of milk on the wall, 1 bottle of milk. Take one down and pass it around, no more bottles of milk on the wall.") + print("No more bottles of milk on the wall, no more bottles of milk. Go to the store and buy some more, 99 bottles of milk on the wall.") + +number_of_bottles() \ No newline at end of file