156k views
5 votes
This is a python program my teacher assigned:

Create a list of days of the week. (yes, this uses strings)
A) Print each day using a for loop.
B) for non-school days, print “freedom” next to the day of the week.

How would I execute this?

User Ryan D
by
4.2k points

1 Answer

2 votes

Answer:

#Create an array for week

week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sunday"]

#Create a varable index and use index to loop through week(array)

for index in week:

#if the index is on Saturady or Sunday then, print freedom

if index == "Saturday" or index == "Sunday":

print(index + " Freedom")

#else just pint out the other days

else:

print(index)

User Jestro
by
3.9k points