Skip to content

Commit c6b45b5

Browse files
committed
practiced functions with arguments and looping lists
1 parent 6d7d8f2 commit c6b45b5

File tree

19 files changed

+77
-15
lines changed

19 files changed

+77
-15
lines changed

exercises/01.3-Print-the-last-one/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ def generate_random_list():
1313
my_stupid_list = generate_random_list()
1414

1515
# Write your code below this comment, good luck!
16-
16+
the_last_one = my_stupid_list[-1]
17+
print(the_last_one)

exercises/01.4-loop-seventeen/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
# Your code here, have fun:
2+
for i in range(1,18):
3+
print(i)
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Remember to import random function here
2-
2+
import random
33
my_list = [4, 5, 734, 43, 45]
44

55
# The magic goes below
6+
for i in range(10):
7+
my_list.append(random.randint(1,100))

exercises/02-Loop-list/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
my_list = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,35,5365743,52,34,3,55]
22

33
# Your code here
4-
print(my_list[0])
4+
# print(my_list[0])
5+
for i in my_list:
6+
print(i)

exercises/02.1-Loop-from-the-top/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Modify the loop below to print from end to start
44

55
for i in range(0, len(my_sample_list)):
6-
print(my_sample_list[i])
6+
print(my_sample_list[len(my_sample_list)-1-i])

exercises/02.2-Loop-adding-two/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
# Your code below, don't change anything above
44

5-
for i in range(0, len(my_sample_list), 1):
5+
for i in range(0, len(my_sample_list), 2):
66
print(my_sample_list[i])
77

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
my_list = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]
22

33
# Your code here
4-
inicial_value = 0
5-
stop_value = 0
6-
increase_value = 0
4+
inicial_value = int(len(my_list)/2)
5+
stop_value = len(my_list)
6+
increase_value = 1
77

88
for i in range(inicial_value, stop_value, increase_value):
99
print(my_list[i])

exercises/02.5-Finding_wally/app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
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']
22

33
# Your code here
4+
5+
for i in range(len(people)):
6+
if people[i]=="Wally":
7+
print(i)

exercises/03-flip_list/app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
sample_list = [45, 67, 87, 23, 5, 32, 60]
22

33
# Your code below
4+
new_list = []
5+
for i in range(len(sample_list)):
6+
new_list.append(sample_list[-1-i])
7+
8+
print (new_list)

exercises/04-mixed_list/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
mix = [42, True, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]
22

33
# Your code below
4+
for i in mix:
5+
print(type(i))

0 commit comments

Comments
 (0)