Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create one for-loop for each of the goals listed below: prints the numbers 0-19

ID: 3607443 • Letter: C

Question

Create one for-loop for each of the goals listed below:

            prints the numbers 0-19

            prints the numbers 2-6

            prints the numbers 0-25 counting by 5s

            prints the numbers 40-60 counting by 2s

Create one for-loop for each list below that loops through them and prints each item in the list:

students = ["Mary","Jane","Tom","Curt"]

animals = ["bear","goat","pig","bat","hippo"]

ages = [6,2,8,4,10,9]

temperatures = [88.7, 80.0, 82.2, 86.9]

Create a for-loop for each list below that loops through them and prints the first character of each item in the list:

students = ["Mary","Jane","Tom","Curt"]

animals = ["bear","goat","pig","bat","hippo"]

trees = ["sycamore","maple","oak","poplar","walnut"]

            sec290 = ['Friday','Unity','Ninja']

For each condition defined below, you are going to create a while loop that continues until that condition is met:

Continue until a variable called isSunny is True.

Continue until the user types 'q' on the keyboard.

Continue until an incrementing number, which started at 0, reaches 5.

Explanation / Answer

for i in range(20):
print(i, end=" ")
print()
for i in range(2, 7):
print(i, end=" ")
print()
for i in range(0, 26, 5):
print(i, end=" ")
print()
for i in range(40, 61, 2):
print(i, end=" ")
print()

students = ["Mary","Jane","Tom","Curt"]
for i in range(len(students)):
print(students[i], end=" ")
print()
animals = ["bear","goat","pig","bat","hippo"]
for i in range(len(animals)):
print(animals[i], end=" ")
print()
ages = [6,2,8,4,10,9]
for i in range(len(ages)):
print(ages[i], end=" ")
print()
temperatures = [88.7, 80.0, 82.2, 86.9]
for i in range(len(temperatures)):
print(temperatures[i], end=" ")
print()

students = ["Mary","Jane","Tom","Curt"]
for i in range(len(students)):
print(students[i][0], end=" ")
print()
animals = ["bear","goat","pig","bat","hippo"]
for i in range(len(animals)):
print(animals[i][0], end=" ")
print()
trees = ["sycamore","maple","oak","poplar","walnut"]
for i in range(len(trees)):
print(trees[i][0], end=" ")
print()
sec290 = ['Friday','Unity','Ninja']
for i in range(len(sec290)):
print(sec290[i][0], end=" ")
print()

#infinite loop until isSunny is set to True
isSunny = False
while True:
if isSunny == True:
break
else:
continue

#infinite loop until user types 'q'
while True:
ch = input("Enter user choice : ")
if (ch == 'q'):
break

#while loop until it reaches 5
i = 0
while i<6:
print(i, end=" ")
i += 1
print()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote