Skip to content

Exercises completed #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .learn/resets/01-Console/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# print "Hello World!" on the console
1 change: 1 addition & 0 deletions .learn/resets/02-Declare-Variables/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ✅ ↓ your code here ↓ ✅
1 change: 1 addition & 0 deletions .learn/resets/03-Print-Variables-In-The-Console/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ✅ ↓ your code here ↓ ✅
1 change: 1 addition & 0 deletions .learn/resets/04-Multiply-Two-Values/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ✅ ↓ your code here ↓ ✅
4 changes: 4 additions & 0 deletions .learn/resets/05-User-Inputed-Values/app.py
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 6 additions & 0 deletions .learn/resets/06-String-Concatenation/app.py
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 13 additions & 0 deletions .learn/resets/07-Create-a-Basic-HTML/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
a = '</title>'
b = '</html>'
c = '<head>'
d = '</body>'
e = '<html>'
f = '</head>'
g = '<title>'
h = '<body>'

# ❌ ⬆ DON'T CHANGE THE CODE ABOVE ⬆ ❌

# ✅ ↓ start coding below here ↓ ✅

3 changes: 3 additions & 0 deletions .learn/resets/08.1-Your-First-If/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
total = int(input('How much money do you have in your pocket\n'))

# ✅ ↓ YOUR CODE HERE ↓ ✅
12 changes: 12 additions & 0 deletions .learn/resets/08.2-How-Much-The-Wedding-Costs/app.py
Original file line number Diff line number Diff line change
@@ -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')
8 changes: 8 additions & 0 deletions .learn/resets/09-Random-Numbers/app.py
Original file line number Diff line number Diff line change
@@ -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())
6 changes: 6 additions & 0 deletions .learn/resets/10-Calling-Your-First-Function/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def is_odd(my_number):
return (my_number % 2 != 0)


def my_main_code():
# ✅ ↓ Your code here ↓ ✅
6 changes: 6 additions & 0 deletions .learn/resets/10.1-Creating-Your-First-Function/app.py
Original file line number Diff line number Diff line change
@@ -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))
3 changes: 3 additions & 0 deletions .learn/resets/11-Create-A-New-Function/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import random

# ✅↓ Write your code here ↓✅
8 changes: 8 additions & 0 deletions .learn/resets/12-Rand-From-One-to-Twelve/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import random

def get_randomInt():
# ✅↓ Write your code here ↓✅
return None

# ❌ ↓ DON'T CHANGE THE CODE BELOW ↓ ❌
print(get_randomInt())
6 changes: 6 additions & 0 deletions .learn/resets/13-Your-First-Loop/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def start_counting():
for i in range(10):
print(i)
return i

start_counting()
5 changes: 5 additions & 0 deletions .learn/resets/14-Create-A-For-Loop/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def standards_maker():
# ✅↓ Write your code here ↓✅


# ✅↓ remember to call the function outside (here) ↓✅
5 changes: 5 additions & 0 deletions .learn/resets/15-Looping-With-FizzBuzz/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def fizz_buzz():
# ✅↓ Write your code here ↓✅

# ❌↓ DON'T CHANGE THE CODE BELOW ↓❌
fizz_buzz()
25 changes: 25 additions & 0 deletions .learn/resets/16-Random-Colors-Loop/app.py
Original file line number Diff line number Diff line change
@@ -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())
15 changes: 15 additions & 0 deletions .learn/resets/17-Russian-Roulette/app.py
Original file line number Diff line number Diff line change
@@ -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())
2 changes: 2 additions & 0 deletions .learn/resets/18-The-Beatles/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ✅↓ Write your code here ↓✅

1 change: 1 addition & 0 deletions .learn/resets/19-Bottles-Of-Milk/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ✅↓ Write your code here ↓✅
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"editor.minimap.enabled": false,
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor"
}
},
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}
3 changes: 2 additions & 1 deletion exercises/01-Console/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# print "Hello World!" on the console
# print "Hello World!" on the console
print ("Hello World!")
2 changes: 2 additions & 0 deletions exercises/02-Declare-Variables/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# ✅ ↓ your code here ↓ ✅
color = "Yellow"
print(color)
6 changes: 5 additions & 1 deletion exercises/03-Print-Variables-In-The-Console/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# ✅ ↓ your code here ↓ ✅
# ✅ ↓ your code here ↓ ✅
color = "red"
item = "marker"

print(color, item)
2 changes: 2 additions & 0 deletions exercises/04-Multiply-Two-Values/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# ✅ ↓ your code here ↓ ✅
variables_are_cool = 2345 * 7323
print(variables_are_cool)
2 changes: 1 addition & 1 deletion exercises/05-User-Inputed-Values/app.py
Original file line number Diff line number Diff line change
@@ -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))
3 changes: 2 additions & 1 deletion exercises/06-String-Concatenation/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions exercises/07-Create-a-Basic-HTML/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@

# ✅ ↓ start coding below here ↓ ✅

html_document = e + c +g +a +f+h+d+b
print(html_document)
6 changes: 6 additions & 0 deletions exercises/08.1-Your-First-If/app.py
Original file line number Diff line number Diff line change
@@ -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!")
7 changes: 6 additions & 1 deletion exercises/08.2-How-Much-The-Wedding-Costs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
2 changes: 1 addition & 1 deletion exercises/09-Random-Numbers/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
3 changes: 2 additions & 1 deletion exercises/10-Calling-Your-First-Function/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ def is_odd(my_number):


def my_main_code():
# ✅ ↓ Your code here ↓ ✅
# ✅ ↓ Your code here ↓ ✅
print (is_odd(45345))
1 change: 1 addition & 0 deletions exercises/10.1-Creating-Your-First-Function/app.py
Original file line number Diff line number Diff line change
@@ -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 ↓ ❌
Expand Down
4 changes: 4 additions & 0 deletions exercises/11-Create-A-New-Function/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import random

# ✅↓ Write your code here ↓✅
def generate_random ():
return random.randint(0,9)

print (generate_random)
3 changes: 2 additions & 1 deletion exercises/12-Rand-From-One-to-Twelve/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
2 changes: 1 addition & 1 deletion exercises/13-Your-First-Loop/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def start_counting():
for i in range(10):
for i in range(12):
print(i)
return i

Expand Down
5 changes: 4 additions & 1 deletion exercises/14-Create-A-For-Loop/app.py
Original file line number Diff line number Diff line change
@@ -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()
10 changes: 9 additions & 1 deletion exercises/15-Looping-With-FizzBuzz/app.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 4 additions & 1 deletion exercises/16-Random-Colors-Loop/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
5 changes: 4 additions & 1 deletion exercises/17-Russian-Roulette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
12 changes: 12 additions & 0 deletions exercises/18-The-Beatles/app.py
Original file line number Diff line number Diff line change
@@ -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()
8 changes: 8 additions & 0 deletions exercises/19-Bottles-Of-Milk/app.py
Original file line number Diff line number Diff line change
@@ -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()
Loading