Skip to content

Práctica de list & loops in python #132

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
wants to merge 8 commits into from
Closed
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-hello-world/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
7 changes: 7 additions & 0 deletions .learn/resets/01.1-Access-and-Retrieve/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
my_list = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']

# 1. Print the 3rd item here

# 2. Change the value of 'thursday' to None

# 3. Print that position now here
5 changes: 5 additions & 0 deletions .learn/resets/01.2-Retrieve-items/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
my_list = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]

# Print in the console the 1st element on the list

# Print in the console the 4th element on the list
16 changes: 16 additions & 0 deletions .learn/resets/01.3-Print-the-last-one/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# import the random package here "import random"
import random

def generate_random_list():
aux_list = []
randonlength = random.randint(1, 100)

for i in range(randonlength):
aux_list.append(randonlength)
i += i
return aux_list

my_stupid_list = generate_random_list()

# Write your code below this comment, good luck!

1 change: 1 addition & 0 deletions .learn/resets/01.4-loop-seventeen/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here, have fun:
5 changes: 5 additions & 0 deletions .learn/resets/01.5-Add-item-to-list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Remember to import random function here

my_list = [4, 5, 734, 43, 45]

# The magic goes below
4 changes: 4 additions & 0 deletions .learn/resets/02-Loop-list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_list = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,35,5365743,52,34,3,55]

# Your code here
print(my_list[0])
6 changes: 6 additions & 0 deletions .learn/resets/02.1-Loop-from-the-top/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
my_sample_list = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]

# Modify the loop below to print from end to start

for i in range(0, len(my_sample_list)):
print(my_sample_list[i])
7 changes: 7 additions & 0 deletions .learn/resets/02.2-Loop-adding-two/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
my_sample_list = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]

# Your code below, don't change anything above

for i in range(0, len(my_sample_list), 1):
print(my_sample_list[i])

9 changes: 9 additions & 0 deletions .learn/resets/02.3-loop-from-the-half-to-the-end/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
my_list = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]

# Your code here
inicial_value = 0
stop_value = 0
increase_value = 0

for i in range(inicial_value, stop_value, increase_value):
print(my_list[i])
3 changes: 3 additions & 0 deletions .learn/resets/02.4-One_last_looping/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
names = ['Esmeralda','Kiko','Ruth','Lebron','Pedro','Maria','Lou','Fernando','Cesco','Bart','Annie']

# Your code here
3 changes: 3 additions & 0 deletions .learn/resets/02.5-Finding_wally/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
people = ['Lebron','Aaliyah','Diamond','Dominique','Aliyah','Jazmin','Darnell','Hatfield','Hawkins','Hayden','Hayes','Haynes','Hays','Head','Heath','Hebert','Henderson','Hendricks','Hendrix','Henry','Hensley','Henson','Herman','Hernandez','Herrera','Herring','Hess','Hester','Hewitt','Hickman','Hicks','Higgins','Hill','Hines','Hinton','Hobbs','Hodge','Hodges','Hoffman','Hogan','Holcomb','Holden','Holder','Holland','Holloway','Holman','Holmes','Holt','Hood','Hooper','Hoover','Hopkins','Hopper','Horn','Horne','Horton','House','Houston','Howard','Howe','Howell','Hubbard','Huber','Hudson','Huff','Wally','Hughes','Hull','Humphrey','Hunt','Hunter','Hurley','Hurst','Hutchinson','Hyde','Ingram','Irwin','Jackson','Jacobs','Jacobson','James','Jarvis','Jefferson','Jenkins','Jennings','Jensen','Jimenez','Johns','Johnson','Johnston','Jones','Jordan','Joseph','Joyce','Joyner','Juarez','Justice','Kane','Kaufman','Keith','Keller','Kelley','Kelly','Kemp','Kennedy','Kent','Kerr','Key','Kidd','Kim','King','Kinney','Kirby','Kirk','Kirkland','Klein','Kline','Knapp','Knight','Knowles','Knox','Koch','Kramer','Lamb','Lambert','Lancaster','Landry','Lane','Lang','Langley','Lara','Larsen','Larson','Lawrence','Lawson','Le','Leach','Leblanc','Lee','Leon','Leonard','Lester','Levine','Levy','Lewis','Lindsay','Lindsey','Little','Livingston','Lloyd','Logan','Long','Lopez','Lott','Love','Lowe','Lowery','Lucas','Luna','Lynch','Lynn','Lyons','Macdonald','Macias','Mack','Madden','Maddox','Maldonado','Malone','Mann','Manning','Marks','Marquez','Marsh','Marshall','Martin','Martinez','Mason','Massey','Mathews','Mathis','Matthews','Maxwell','May','Mayer','Maynard','Mayo','Mays','Mcbride','Mccall','Mccarthy','Mccarty','Mcclain','Mcclure','Mcconnell','Mccormick','Mccoy','Mccray','Wally','Mcdaniel','Mcdonald','Mcdowell','Mcfadden','Mcfarland','Mcgee','Mcgowan','Mcguire','Mcintosh','Mcintyre','Mckay','Mckee','Mckenzie','Mckinney','Mcknight','Mclaughlin','Mclean','Mcleod','Mcmahon','Mcmillan','Mcneil','Mcpherson','Meadows','Medina','Mejia','Melendez','Melton','Mendez','Mendoza','Mercado','Mercer','Merrill','Merritt','Meyer','Meyers','Michael','Middleton','Miles','Miller','Mills','Miranda','Mitchell','Molina','Monroe','Lucas','Jake','Scott','Amy','Molly','Hannah','Lucas']

# Your code here
3 changes: 3 additions & 0 deletions .learn/resets/03-flip_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sample_list = [45, 67, 87, 23, 5, 32, 60]

# Your code below
3 changes: 3 additions & 0 deletions .learn/resets/04-mixed_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mix = [42, True, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]

# Your code below
3 changes: 3 additions & 0 deletions .learn/resets/04.1-count_on/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
my_list = [42, True, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]

# Your code here
10 changes: 10 additions & 0 deletions .learn/resets/05-Sum_all_items/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
my_sample_list = [3423,5,4,47889,654,8,867543,23,48,5345,234,6,78,54,23,67,3,6,432,55,23,25,12]

def sum_all_values(list):
total = 0
# The magic happens here


return total

print(sum_all_values(my_sample_list))
3 changes: 3 additions & 0 deletions .learn/resets/05.1-sum_odd_items/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
my_list = [4,5,734,43,45,100,4,56,23,67,23,58,45]

# Your code here
6 changes: 6 additions & 0 deletions .learn/resets/06-Print_by_condition/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
my_list = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,4356,345,4545,452,345,434,36,345,4334,5454,345,4352,23,365,345,47,63,425,6578759,768,834,754,35,32,445,453456,56,7536867,3884526,4234,35353245,53244523,566785,7547,743,4324,523472634,26665,63432,54645,32,453625,7568,5669576,754,64356,542644,35,243,371,3251,351223,13231243,734,856,56,53,234342,56,545343]


for i in my_list:
# The magic happens here

11 changes: 11 additions & 0 deletions .learn/resets/06.1-Everything_is_awesome/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
my_list = [1, 0, 0, 0, 1, 0, 0, 0, 1, 1]

def my_function(numbers):
new_list = []
for i in numbers:
# The magic happens here


return new_list

print(my_function(my_list))
1 change: 1 addition & 0 deletions .learn/resets/07-Do_while/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
11 changes: 11 additions & 0 deletions .learn/resets/08-Delete_element/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
people = ['juan','ana','michelle','daniella','stefany','lucy','barak']

def delete_person(person_name):
# Your code here



# Don't delete anything below
print(delete_person("daniella"))
print(delete_person("juan"))
print(delete_person("emilio"))
9 changes: 9 additions & 0 deletions .learn/resets/08.1-Merge_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
chunk_one = ['Lebron', 'Aaliyah', 'Diamond', 'Dominique', 'Aliyah', 'Jazmin', 'Darnell']
chunk_two = ['Lucas', 'Jake', 'Scott', 'Amy', 'Molly', 'Hannah', 'Lucas']


def merge_list(list1, list2):
# Your code here


print(merge_list(chunk_one, chunk_two))
7 changes: 7 additions & 0 deletions .learn/resets/08.2-Divide_and_conquer/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
list_of_numbers = [4, 80, 85, 59, 37, 25, 5, 64, 66, 81, 20, 64, 41, 22, 76, 76, 55, 96, 2, 68]

# Your code here


print(sort_odd_even(list_of_numbers))

3 changes: 3 additions & 0 deletions .learn/resets/09-Max_integer_from_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
my_list = [43,23,6,87,43,1,4,6,3,67,8,3445,3,7,5435,63,346,3,456,734,6,34]

# Your code here
3 changes: 3 additions & 0 deletions .learn/resets/09.1-For_loop_min_value/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
my_list = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,4356,345,4545,452,345,434,36,345,4334,5454,345,4352,23,365,345,47,63,425,6578759,768,834,754,35,32,445,453456,56,7536867,3884526,4234,35353245,53244523,566785,7547,743,4324,523472634,26665,63432,54645,32,453625,7568,5669576,754,64356,542644,35,243,371,3251,351223,13231243,734,856,56,53,234342,56,545343]

# Your code here
3 changes: 3 additions & 0 deletions .learn/resets/10-Find_avg/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
my_list = [2323,4344,2325,324413,21234,24531,2123,42234,544,456,345,42,5445,23,5656,423]

# Your code here
8 changes: 8 additions & 0 deletions .learn/resets/10.1-And_One_and_a_Two_and_a_Three/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contact = {
"fullname": "Jane Doe",
"phone": "321-321-4321",
"email": "[email protected]"
}

# Your code here

3 changes: 3 additions & 0 deletions .learn/resets/11-Nested_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coordinates_list = [[33.747252, -112.633853], [-33.867886, -63.987], [41.303921, -81.901693], [-33.350534, -71.653268]]

# Your code here
9 changes: 9 additions & 0 deletions .learn/resets/12-Map_a_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
celsius_values = [-2, 34, 56, -10]

def celsius_to_fahrenheit(celsius):
# The magic happens here


result = list(map(celsius_to_fahrenheit, celsius_values))

print(result)
5 changes: 5 additions & 0 deletions .learn/resets/12.1-more_mapping/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
my_numbers = [23,234,345,4356234,243,43,56,2]

# Your code here

print(new_list)
6 changes: 6 additions & 0 deletions .learn/resets/12.2-Map_function_inside_variable/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
names = ['Alice', 'Bob', 'Marry', 'Joe', 'Hilary', 'Stevia', 'Dylan']

def prepender(name):
return "My name is: " + name

# Your code here
9 changes: 9 additions & 0 deletions .learn/resets/12.3-Map_data_types/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mixed_list = ['1','5','45','34','343','34',6556,323]

def type_list(items):
# Your code here
return

new_list = list(map(type_list, mixed_list))

print(new_list)
23 changes: 23 additions & 0 deletions .learn/resets/12.4-Map_list_of_objects/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import datetime

people = [
{ "name": 'Joe', "birth_date": datetime.datetime(1986,10,24) },
{ "name": 'Bob', "birth_date": datetime.datetime(1975,5,24) },
{ "name": 'Erika', "birth_date": datetime.datetime(1989,6,12) },
{ "name": 'Dylan', "birth_date": datetime.datetime(1999,12,14) },
{ "name": 'Steve', "birth_date": datetime.datetime(2003,4,24) }
]

def calculate_age(date_of_birth):
today = datetime.date.today()
age = today.year - date_of_birth.year - ((today.month, today.day) < (date_of_birth.month, date_of_birth.day))
return age

def format_greeting(person):
# Your code here
return person["name"]


name_list = list(map(format_greeting, people))

print(name_list)
4 changes: 4 additions & 0 deletions .learn/resets/12.5-Yes_and_no/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
the_bools = [0,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1]

# Your code here

10 changes: 10 additions & 0 deletions .learn/resets/12.6-Transformers/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
incoming_ajax_data = [
{ "name": 'Mario', "last_name": 'Montes' },
{ "name": 'Joe', "last_name": 'Biden' },
{ "name": 'Bill', "last_name": 'Clon' },
{ "name": 'Hilary', "last_name": 'Mccafee' },
{ "name": 'Bobby', "last_name": 'Mc birth' }
]

# Your code here

10 changes: 10 additions & 0 deletions .learn/resets/13-Filter_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all_numbers = [23,12,35,5,3,2,3,54,3,21,534,23,42,1]


def filter_function(item):
# Update here
return item % 2 == 1

greater_than_ten = list(filter(filter_function, all_numbers))

print(greater_than_ten)
9 changes: 9 additions & 0 deletions .learn/resets/13.1-Filter_and_list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
all_names = ["Romario", "Boby", "Roosevelt", "Emiliy", "Michael", "Greta", "Patricia", "Danzalee"]

# Your code here

print(resulting_names)




14 changes: 14 additions & 0 deletions .learn/resets/13.2-filter_done_tasks/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
tasks = [
{ "label": 'Eat my lunch', "done": True },
{ "label": 'Make the bed', "done": False },
{ "label": 'Have some fun', "done": False },
{ "label": 'Finish the replits', "done": False },
{ "label": 'Replit the finishes', "done": True },
{ "label": 'Ask for a raise', "done": False },
{ "label": 'Read a book', "done": True },
{ "label": 'Make a trip', "done": False }
]


# Your code here

3 changes: 3 additions & 0 deletions .learn/resets/13.3-Filter_list_strings/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
names = ['Liam','Emma','Noah','Olivia','William','Ava','James','Isabella','Logan','Sophia','Benjamin','Mia','Mason','Charlotte','Elijah','Amelia','Oliver','Evelyn','Jacob','Abigail','Lucas','Harper','Michael','Emily','Alexander','Elizabeth','Ethan','Avery','Daniel','Sofia','Matthew','Ella','Aiden','Madison','Henry','Scarlett','Joseph','Victoria','Jackson','Aria','Samuel','Grace','Sebastian','Chloe','David','Camila','Carter','Penelope','Wyatt','Riley']

# Your code here
12 changes: 12 additions & 0 deletions .learn/resets/13.4-Making_HTML_with_filter_and_maP/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
all_colors = [
{"label": 'Red', "sexy": True},
{"label": 'Pink', "sexy": False},
{"label": 'Orange', "sexy": True},
{"label": 'Brown', "sexy": False},
{"label": 'Pink', "sexy": True},
{"label": 'Violet', "sexy": True},
{"label": 'Purple', "sexy": False},
]

# Your code here

7 changes: 7 additions & 0 deletions .learn/resets/14-Loop-dictionary/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
spanish_translations = { "dog": "perro", "house": "casa", "cat": "gato" }
# Your code here


# Don't touch the code below
print("Translation:", spanish_translations["dog"])
print(spanish_translations)
8 changes: 8 additions & 0 deletions .learn/resets/14.1-letter_counter/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
par = "Lorem ipsum dolor sit amet consectetur adipiscing elit Curabitur eget bibendum turpis Curabitur scelerisque eros ultricies venenatis mi at tempor nisl Integer tincidunt accumsan cursus"

counts = {}

# Your code here


print(counts)
1 change: 1 addition & 0 deletions .learn/resets/15.1-Matrix_Builder/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
7 changes: 7 additions & 0 deletions .learn/resets/15.2-Parking_lot_check/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parking_state = [
[1,1,1],
[0,0,0],
[1,1,2]
]

# Your code here
8 changes: 8 additions & 0 deletions .learn/resets/16-Techno_beat/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


# Your code above, nothing to change after this line
print(lyrics_generator([0,0,1,1,0,0,0]))
print(lyrics_generator([0,0,1,1,1,0,0,0]))
print(lyrics_generator([0,0,0]))
print(lyrics_generator([1,0,1]))
print(lyrics_generator([1,1,1]))
1 change: 1 addition & 0 deletions exercises/01-hello-world/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Your code here
print("Hello World!")
5 changes: 3 additions & 2 deletions exercises/01.1-Access-and-Retrieve/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
my_list = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']

# 1. Print the 3rd item here

print(my_list[2])
# 2. Change the value of 'thursday' to None

my_list[4] = None
# 3. Print that position now here
print(my_list[4])
3 changes: 2 additions & 1 deletion exercises/01.2-Retrieve-items/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
my_list = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]

# Print in the console the 1st element on the list

print(my_list[0])
# Print in the console the 4th element on the list
print(my_list[3])
3 changes: 2 additions & 1 deletion exercises/01.3-Print-the-last-one/app.py
Original file line number Diff line number Diff line change
@@ -13,4 +13,5 @@ def generate_random_list():
my_stupid_list = generate_random_list()

# Write your code below this comment, good luck!

the_last_one = my_stupid_list[-1]
print(the_last_one)
2 changes: 2 additions & 0 deletions exercises/01.4-loop-seventeen/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Your code here, have fun:
for i in range(1,18):
print(i)
4 changes: 3 additions & 1 deletion exercises/01.5-Add-item-to-list/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Remember to import random function here

import random
my_list = [4, 5, 734, 43, 45]

# The magic goes below
for i in range(10):
my_list.append(random.randint(1,100))
4 changes: 3 additions & 1 deletion exercises/02-Loop-list/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
my_list = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,35,5365743,52,34,3,55]

# Your code here
print(my_list[0])
# print(my_list[0])
for i in my_list:
print(i)
2 changes: 1 addition & 1 deletion exercises/02.1-Loop-from-the-top/app.py
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@
# Modify the loop below to print from end to start

for i in range(0, len(my_sample_list)):
print(my_sample_list[i])
print(my_sample_list[len(my_sample_list)-1-i])
2 changes: 1 addition & 1 deletion exercises/02.2-Loop-adding-two/app.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@

# Your code below, don't change anything above

for i in range(0, len(my_sample_list), 1):
for i in range(0, len(my_sample_list), 2):
print(my_sample_list[i])

6 changes: 3 additions & 3 deletions exercises/02.3-loop-from-the-half-to-the-end/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
my_list = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]

# Your code here
inicial_value = 0
stop_value = 0
increase_value = 0
inicial_value = int(len(my_list)/2)
stop_value = len(my_list)
increase_value = 1

for i in range(inicial_value, stop_value, increase_value):
print(my_list[i])
5 changes: 5 additions & 0 deletions exercises/02.4-One_last_looping/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
names = ['Esmeralda','Kiko','Ruth','Lebron','Pedro','Maria','Lou','Fernando','Cesco','Bart','Annie']

# Your code here
names[1]= "Steven"
names[-1]= "Pepe"
names[0]=names[2]+names[4]
for i in range(len(names)):
print(names[-1-i])
4 changes: 4 additions & 0 deletions exercises/02.5-Finding_wally/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
people = ['Lebron','Aaliyah','Diamond','Dominique','Aliyah','Jazmin','Darnell','Hatfield','Hawkins','Hayden','Hayes','Haynes','Hays','Head','Heath','Hebert','Henderson','Hendricks','Hendrix','Henry','Hensley','Henson','Herman','Hernandez','Herrera','Herring','Hess','Hester','Hewitt','Hickman','Hicks','Higgins','Hill','Hines','Hinton','Hobbs','Hodge','Hodges','Hoffman','Hogan','Holcomb','Holden','Holder','Holland','Holloway','Holman','Holmes','Holt','Hood','Hooper','Hoover','Hopkins','Hopper','Horn','Horne','Horton','House','Houston','Howard','Howe','Howell','Hubbard','Huber','Hudson','Huff','Wally','Hughes','Hull','Humphrey','Hunt','Hunter','Hurley','Hurst','Hutchinson','Hyde','Ingram','Irwin','Jackson','Jacobs','Jacobson','James','Jarvis','Jefferson','Jenkins','Jennings','Jensen','Jimenez','Johns','Johnson','Johnston','Jones','Jordan','Joseph','Joyce','Joyner','Juarez','Justice','Kane','Kaufman','Keith','Keller','Kelley','Kelly','Kemp','Kennedy','Kent','Kerr','Key','Kidd','Kim','King','Kinney','Kirby','Kirk','Kirkland','Klein','Kline','Knapp','Knight','Knowles','Knox','Koch','Kramer','Lamb','Lambert','Lancaster','Landry','Lane','Lang','Langley','Lara','Larsen','Larson','Lawrence','Lawson','Le','Leach','Leblanc','Lee','Leon','Leonard','Lester','Levine','Levy','Lewis','Lindsay','Lindsey','Little','Livingston','Lloyd','Logan','Long','Lopez','Lott','Love','Lowe','Lowery','Lucas','Luna','Lynch','Lynn','Lyons','Macdonald','Macias','Mack','Madden','Maddox','Maldonado','Malone','Mann','Manning','Marks','Marquez','Marsh','Marshall','Martin','Martinez','Mason','Massey','Mathews','Mathis','Matthews','Maxwell','May','Mayer','Maynard','Mayo','Mays','Mcbride','Mccall','Mccarthy','Mccarty','Mcclain','Mcclure','Mcconnell','Mccormick','Mccoy','Mccray','Wally','Mcdaniel','Mcdonald','Mcdowell','Mcfadden','Mcfarland','Mcgee','Mcgowan','Mcguire','Mcintosh','Mcintyre','Mckay','Mckee','Mckenzie','Mckinney','Mcknight','Mclaughlin','Mclean','Mcleod','Mcmahon','Mcmillan','Mcneil','Mcpherson','Meadows','Medina','Mejia','Melendez','Melton','Mendez','Mendoza','Mercado','Mercer','Merrill','Merritt','Meyer','Meyers','Michael','Middleton','Miles','Miller','Mills','Miranda','Mitchell','Molina','Monroe','Lucas','Jake','Scott','Amy','Molly','Hannah','Lucas']

# Your code here

for i in range(len(people)):
if people[i]=="Wally":
print(i)
5 changes: 5 additions & 0 deletions exercises/03-flip_list/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
sample_list = [45, 67, 87, 23, 5, 32, 60]

# Your code below
new_list = []
for i in range(len(sample_list)):
new_list.append(sample_list[-1-i])

print (new_list)
2 changes: 2 additions & 0 deletions exercises/04-mixed_list/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mix = [42, True, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]

# Your code below
for i in mix:
print(type(i))
5 changes: 5 additions & 0 deletions exercises/04.1-count_on/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
my_list = [42, True, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]

# Your code here
new_list=[]
for i in range(len(my_list)):
if type(my_list[i]) == list or type(my_list[i]) == dict:
new_list.append(my_list[i])
print(new_list)
3 changes: 2 additions & 1 deletion exercises/05-Sum_all_items/app.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@
def sum_all_values(list):
total = 0
# The magic happens here

for num in my_sample_list:
total+=num

return total

9 changes: 9 additions & 0 deletions exercises/05.1-sum_odd_items/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
my_list = [4,5,734,43,45,100,4,56,23,67,23,58,45]

# Your code here
def sum_odds(list):
odd_numbers = 0
for num in list:
if num%2 != 0:
odd_numbers += num
return odd_numbers

print(sum_odds(my_list))

3 changes: 2 additions & 1 deletion exercises/06-Print_by_condition/app.py
Original file line number Diff line number Diff line change
@@ -3,4 +3,5 @@

for i in my_list:
# The magic happens here

if i % 14 == 0:
print(i)
5 changes: 4 additions & 1 deletion exercises/06.1-Everything_is_awesome/app.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,10 @@ def my_function(numbers):
new_list = []
for i in numbers:
# The magic happens here

if i == 0:
new_list.append("Yahoo")
else:
new_list.append(i)

return new_list

9 changes: 9 additions & 0 deletions exercises/07-Do_while/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# Your code here
number = 20
while number >=0:
if number == 0:
print("LIFTOFF")
elif number % 5 == 0:
print(str(number)+"!")
else:
print(number)
number-=1
7 changes: 5 additions & 2 deletions exercises/08-Delete_element/app.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,11 @@

def delete_person(person_name):
# Your code here


new_list = []
for name in people:
if name != person_name:
new_list.append(name)
return new_list

# Don't delete anything below
print(delete_person("daniella"))
8 changes: 6 additions & 2 deletions exercises/08.1-Merge_list/app.py
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@

def merge_list(list1, list2):
# Your code here


new_list = []
for i in list1:
new_list.append(i)
for i in list2:
new_list.append(i)
return new_list
print(merge_list(chunk_one, chunk_two))
9 changes: 9 additions & 0 deletions exercises/08.2-Divide_and_conquer/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
list_of_numbers = [4, 80, 85, 59, 37, 25, 5, 64, 66, 81, 20, 64, 41, 22, 76, 76, 55, 96, 2, 68]

# Your code here
def sort_odd_even(list):
sorted_list = []
even = []
for num in list:
if num % 2 != 0:
sorted_list.append(num)
else:
even.append(num)
return sorted_list+even


print(sort_odd_even(list_of_numbers))
8 changes: 8 additions & 0 deletions exercises/09-Max_integer_from_list/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
my_list = [43,23,6,87,43,1,4,6,3,67,8,3445,3,7,5435,63,346,3,456,734,6,34]

# Your code here
def max_integer(list):
max_num = 0
for num in list:
if num > max_num:
max_num = num
return max_num

print(max_integer(my_list))
6 changes: 6 additions & 0 deletions exercises/09.1-For_loop_min_value/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
my_list = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,4356,345,4545,452,345,434,36,345,4334,5454,345,4352,23,365,345,47,63,425,6578759,768,834,754,35,32,445,453456,56,7536867,3884526,4234,35353245,53244523,566785,7547,743,4324,523472634,26665,63432,54645,32,453625,7568,5669576,754,64356,542644,35,243,371,3251,351223,13231243,734,856,56,53,234342,56,545343]

# Your code here
min_num = my_list[0]
for num in my_list:
if num < min_num:
min_num = num

print (min_num)
5 changes: 5 additions & 0 deletions exercises/10-Find_avg/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
my_list = [2323,4344,2325,324413,21234,24531,2123,42234,544,456,345,42,5445,23,5656,423]

# Your code here
sum = 0
for num in my_list:
sum += num
avg = sum/len(my_list)
print(avg)
2 changes: 2 additions & 0 deletions exercises/10.1-And_One_and_a_Two_and_a_Three/app.py
Original file line number Diff line number Diff line change
@@ -6,3 +6,5 @@

# Your code here

for key in contact.keys():
print(f"{key}: {contact[key]}")
5 changes: 5 additions & 0 deletions exercises/11-Nested_list/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
coordinates_list = [[33.747252, -112.633853], [-33.867886, -63.987], [41.303921, -81.901693], [-33.350534, -71.653268]]

# Your code here
latititud = []
longitude = []

for coor in coordinates_list:
print(coor[1])
3 changes: 1 addition & 2 deletions exercises/12-Map_a_list/app.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,7 @@

def celsius_to_fahrenheit(celsius):
# The magic happens here

return (celsius * 9/5)+32

result = list(map(celsius_to_fahrenheit, celsius_values))

print(result)
4 changes: 4 additions & 0 deletions exercises/12.1-more_mapping/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
my_numbers = [23,234,345,4356234,243,43,56,2]

# Your code here
# new_list = []
def multiply_by_three(num):
return num*3

new_list = list(map(multiply_by_three, my_numbers))
print(new_list)
1 change: 1 addition & 0 deletions exercises/12.2-Map_function_inside_variable/app.py
Original file line number Diff line number Diff line change
@@ -4,3 +4,4 @@ def prepender(name):
return "My name is: " + name

# Your code here
print(list(map(prepender,names)))
2 changes: 1 addition & 1 deletion exercises/12.3-Map_data_types/app.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

def type_list(items):
# Your code here
return
return type(items)

new_list = list(map(type_list, mixed_list))

3 changes: 1 addition & 2 deletions exercises/12.4-Map_list_of_objects/app.py
Original file line number Diff line number Diff line change
@@ -15,8 +15,7 @@ def calculate_age(date_of_birth):

def format_greeting(person):
# Your code here
return person["name"]

return f'Hello, my name is {person["name"]} and I am {calculate_age(person["birth_date"])} years old'

name_list = list(map(format_greeting, people))

6 changes: 6 additions & 0 deletions exercises/12.5-Yes_and_no/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
the_bools = [0,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1]

# Your code here
def wiki_woko(number):
if number == 1:
return "wiki"
elif number == 0:
return "woko"

print(list(map(wiki_woko, the_bools)))
3 changes: 3 additions & 0 deletions exercises/12.6-Transformers/app.py
Original file line number Diff line number Diff line change
@@ -7,4 +7,7 @@
]

# Your code here
def data_transformer(users):
return list(map(lambda user: f'{user["name"]} {user["last_name"]}', users))

print(data_transformer(incoming_ajax_data))
2 changes: 1 addition & 1 deletion exercises/13-Filter_list/app.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

def filter_function(item):
# Update here
return item % 2 == 1
return item > 10

greater_than_ten = list(filter(filter_function, all_numbers))

4 changes: 4 additions & 0 deletions exercises/13.1-Filter_and_list/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
all_names = ["Romario", "Boby", "Roosevelt", "Emiliy", "Michael", "Greta", "Patricia", "Danzalee"]

# Your code here
def starts_with_r(name):
if name[0]=="R":
return name

resulting_names = list(filter(starts_with_r,all_names))
print(resulting_names)


2 changes: 1 addition & 1 deletion exercises/13.2-filter_done_tasks/app.py
Original file line number Diff line number Diff line change
@@ -11,4 +11,4 @@


# Your code here

print(list(filter(lambda task : task["done"], tasks)))
4 changes: 4 additions & 0 deletions exercises/13.3-Filter_list_strings/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
names = ['Liam','Emma','Noah','Olivia','William','Ava','James','Isabella','Logan','Sophia','Benjamin','Mia','Mason','Charlotte','Elijah','Amelia','Oliver','Evelyn','Jacob','Abigail','Lucas','Harper','Michael','Emily','Alexander','Elizabeth','Ethan','Avery','Daniel','Sofia','Matthew','Ella','Aiden','Madison','Henry','Scarlett','Joseph','Victoria','Jackson','Aria','Samuel','Grace','Sebastian','Chloe','David','Camila','Carter','Penelope','Wyatt','Riley']

# Your code here
def am_in_name(name):
if "am" in name or "Am" in name:
return name
print(list(filter(am_in_name,names)))
8 changes: 8 additions & 0 deletions exercises/13.4-Making_HTML_with_filter_and_maP/app.py
Original file line number Diff line number Diff line change
@@ -10,3 +10,11 @@

# Your code here

def generate_li(color):
return f'<li>{color["label"]}</li>'

def filter_colors(item):
return item['sexy']


print(list(map(generate_li, list(filter(filter_colors, all_colors)))))
4 changes: 3 additions & 1 deletion exercises/14-Loop-dictionary/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
spanish_translations = { "dog": "perro", "house": "casa", "cat": "gato" }
# Your code here

spanish_translations["love"] = "amor"
spanish_translations["code"] = "codigo"
spanish_translations["smart"] = "inteligente"

# Don't touch the code below
print("Translation:", spanish_translations["dog"])
9 changes: 8 additions & 1 deletion exercises/14.1-letter_counter/app.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@
counts = {}

# Your code here

par = par.lower()
for letter in par:
if letter == " ":
continue
elif letter in counts:
counts[letter] += 1
else:
counts[letter] = 1

print(counts)
11 changes: 11 additions & 0 deletions exercises/15.1-Matrix_Builder/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Your code here
def matrix_builder(num):
matrix = []
matrix_sub = []
for i in range(num):
for j in range(num):
matrix_sub.append(1)
matrix.append(matrix_sub)
matrix_sub = []
return matrix

print(matrix_builder(5))
16 changes: 16 additions & 0 deletions exercises/15.2-Parking_lot_check/app.py
Original file line number Diff line number Diff line change
@@ -5,3 +5,19 @@
]

# Your code here
def get_parking_lot(parking):
state = {
"total_slots": 0,
"available_slots": 0,
"occupied_slots": 0
}
for spaces in parking:
for space in spaces:
if space == 1:
state["total_slots"] += 1
state["occupied_slots"] += 1
elif space == 2:
state["total_slots"] += 1
state["available_slots"] += 1
return state
print(get_parking_lot(parking_state))
14 changes: 14 additions & 0 deletions exercises/16-Techno_beat/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
def lyrics_generator(list):
beats = ["Boom", "Drop the bass", "!!!Break the bass!!!"]
final_beat = []
break_the_bass = 0
for i in list:
if i == 1:
final_beat.append(beats[1])
break_the_bass += 1
if break_the_bass == 3:
final_beat.append(beats[2])
elif i == 0:
final_beat.append(beats[0])
break_the_bass = 0
return " ".join(final_beat)+" "


# Your code above, nothing to change after this line