Day4_중첩 리스트 2022/01/04 20:57 by The 2nd

#dirty_dozen = ["Strawberries", "Spinach", "Kale", "Nectarines", "Apples", "Grapes", "Peaches", "Cherries", "Pears", "Tomatoes", "Celery", "Potatoes"]

fruits = ["Strawberries", "Nectarines", "Apples", "Grapes", "Peaches", "Cherries", "Pears"]
vegitables = ["Spinach", "Kale", "Tomatoes", "Celery", "Potatoes"]

dirty_dozen = [fruits, vegitables]

print(dirty_dozen)

print(dirty_dozen[1][1])

----
[['Strawberries', 'Nectarines', 'Apples', 'Grapes', 'Peaches', 'Cherries', 'Pears'], ['Spinach', 'Kale', 'Tomatoes', 'Celery', 'Potatoes']]
Kale

Day4_split(), 입력하는 이름들 중 한명 선택하기 2022/01/04 20:45 by The 2nd

# Split string method
names_string = input("Give me everybody's names, separated by a comma. ")
names = names_string.split(", ")
# 🚨 Don't change the code above 👆

#Write your code below this line 👇
import random

choice = random.randint(0,len(names)-1)
print(f"{names[choice]} is going to buy the meal today!")


----
loee me everybody's names, separated by a comma. Angela, Ben, Jenny, Michael, Chl
Jenny is going to buy the meal today!

1 2 3 4 5 6 7 8 9 10 다음