Homework:
Let’s say you have three shirts and four pants. Print every possible combination using a list for the shirts and a list for the pants. (Hint: list comprehension.)
“Brian, the officer in charge; Mark, the chef; Dexter, my dog; and Petunia, my cat”.
Split this string only by the first two semicolons.
Find the index of the first t, the first x, and the first z.
Resources:
Class slides: https://docs.google.com/presentation/d/1ZTJES07Y4f7P5JrHNQz-2pIJH0nmTCpvm5kHVGd-PXQ/edit?usp=sharing
Class code: https://replit.com/join/xfdqkiwkwr-shravyas
Completed game: https://replit.com/join/akmhvbfxsh-shravyas
Contact Info:
shravyassathish@gmail.com (mentor)
kingericwu@gmail.com (TA)
felixguo41@gmail.com (TA)
shirts = ["checkered", "striped", "t"]
pants = ["pyjama", "long", "short", "sweat"]
combinations = [i+ " shirt and " + j + " pants" for i in shirts for j in pants]
print(f"Part 1: for reference, shirts are: {shirts} and pants are: {pants}\n\nPossible combinations are:{combinations}\n\n")
sentence = "Brian, the officer in charge; Mark, the chef; Dexter, my dog; and Petunia, my cat"
print("Part 2: a. the split string is " + str(sentence.split(";", 2)) + ". b. The first t is located at index " + str(sentence.index("t")) + ", the first x at index " + str(sentence.index("x")) + ", and there is no z in the sentence.")