days_of_week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
print(days_of_week)
# [ ] after days_of_week is run above, print the days in the list at odd indexes 1,3,5
days_of_week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
print(days_of_week)
for day in days_of_week[1::2]:
print(day)
# [ ] create and populate list called phone_letters then print it
phone_letters = [" ","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]
print(phone_letters)
# [ ] create a variable: day, assign day to "Tuesday" using days_of_week[]
# [ ] print day variable
day = days_of_week[1]
print(day)
# PART 2
# [ ] assign day to days_of_week index = 5
# [ ] print day
day = days_of_week[5]
print(day)
# [ ] Make up a new day! - append an 8th day of the week to days_of_week
# [ ] print days_of_week
days_of_week.append("Maroonday")
print(days_of_week)
# [ ] Make up another new day - insert a new day into the middle of days_of_week between Wed - Thurs
# [ ] print days_of_week
days_of_week.insert(3,"Frostday")
print(days_of_week)
# [ ] Extend the weekend - insert a day between Fri & Sat in the days_of_week list
# [ ] print days_of_week
days_of_week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
days_of_week.insert(6,"Landay")
print(days_of_week)
# [ ] print days_of_week
# [ ] modified week is too long - pop() the last index of days_of_week & print .pop() value
# [ ] print days_of_week
days_of_week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
days_of_week.append("Maroonday")
days_of_week.insert(3,"Frostday")
days_of_week.insert(6,"Landay")
print(days_of_week)
days_of_week.pop(-1)
print(days_of_week)
# [ ] print days_of_week
# [ ] delete (del) the new day added to the middle of the week
# [ ] print days_of_week
print(days_of_week)
del days_of_week[4]
print(days_of_week)
# [ ] print days_of_week
# [ ] programmers choice - pop() any day in days_of week & print .pop() value
# [ ] print days_of_week
print(days_of_week)
days_of_week.pop()
print(days_of_week)
# [ ] create let_to_num()
def let_to_num(letter):
key = 0
while key < 10:
if letter in phone_letters[key]:
return key
else:
key = key + 1
return "Not Found"
answer = let_to_num("5")
print("The key is:",answer)
# [ ] Challenge: write the code for "reverse a string"
string = ["dog", "bird", "cat", "mouse"]
rev_str = []
print(string)
while string:
rev = string.pop(0)
rev_str.insert(0,rev)
print(", ".join(rev_str))