RESOURCES:

Class slides: https://docs.google.com/presentation/d/10LqX5iltZ8boe6rpdhn7wuwLZcNjsQDA9jvhS_fNAGs/edit?usp=sharing

Example code: https://replit.com/@ShravyaS/IntroToPython-21

HOMEWORK:

Write a program that that takes in several numbers. Store them in a list and use slicing to print out every odd indexed number (indexes 1, 3, 5, …), every index that is a multiple of 3 (indexes 0, 3, 6, …) and every index that is a multiple of 5 (indexes 0, 5, 10, …)

Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!

numbers = []

multiples_of_3 = []

multiples_of_5 = []

x = '___'

while x != 'stop':

x = input()

if x != 'stop':

numbers.append(int(x))

print("Printing values at odd indicies:")

print(numbers[1:len(numbers) + 1: 2])

print("Printing values at indicies multiples of 3:")

print(numbers[0:len(numbers) + 1: 3])

print("Printing values at indicies multiples of 5:")

print(numbers[0:len(numbers) + 1: 5])