반응형

전체 글 154

[Python]Dictionary

: key와 value로 이루어져 있는 자료구조 x = { "name": "워니", # name에 워니를 넣어라 "age": 20, } print(x["name"]) print(x["age"]) //워니 //20 key값에는 불변하는 값들만 들어갈 수 있다ex)문자열, 숫자 리스트는 가변이니까 dictionary의 key로 쓸 수 x x = { 0: "Wonie", 1: "hello", "age": 20, } print(x[0]) print(x[1]) print(x["age"])​ //Wonie //hello //20 x = { 0: "Wonie", 1: "hello", "age": 20, } print("age" in x) # "age"라는 key가 x안에 있는지 확인해보기 //True x = { 0:..

Python 2021.11.15

[Python]Tuple

x = (1,2,3) y = ('a','b','c') z = (1,"hello","there") print(x + y) print('a' in y) print(z.index(1)) //(1,2,3,'a','b','c') //True //0 list에서 썼던 function들을 tuple에서도 그대로 쓸 수 있다 x = (1,2,3) y = ('a','b','c') z = (1,"hello","there") # mutable vs immutable x[0] = 10 #error list와 tuple의 차이점 : list와 달리 tuple에서는 assignment(=튜플 안의 값을 업데이트 하는 것)을 할 수x 튜플 안에 있는 것들은 바꿀 수 없다 가변(mutable) : 값을 바꿀 수 있음 불변(immut..

Python 2021.11.14

[Python]List

x = [1,2,3,4] y = ["hello","world"] z = ["hello", 1,2,3] print(x) print(y) print(z) //[1,2,3,4] //["hello","world"] //["hello", 1,2,3] x = [1,2,3,4] print(x[0]) # x의 0번째 자리 출력 //1 x = [1,2,3,4] x[3] = 10 # x의 3번째 자리에 10넣기 print(x) //[1,2,3,10] # functions of list x = [1,2,3,4] num_elements = len(x) #리스트의 수를 출력하는 function print(num_elements) //4 x = [4,2,3,1] y = sorted(x) # 리스트를 순서대로 정렬 print(y)..

Python 2021.11.14

[Python]조건문

# for, while for i in range(10): print("철수: 안녕 영희야 뭐해?") print("영희: 안녕 철수야, 그냥 있어.") 10번 반복 출력 # for, while for i in range(3): # 반복문이 몇번째인지 i에 넣어라 print(i) print("철수: 안녕 영희야 뭐해?") print("영희: 안녕 철수야, 그냥 있어.") //0 //철수: 안녕 영희야 뭐해? //영희: 안녕 철수야, 그냥 있어. //1 //철수: 안녕 영희야 뭐해? //영희: 안녕 철수야, 그냥 있어. //2 //철수: 안녕 영희야 뭐해? //영희: 안녕 철수야, 그냥 있어. # for, while i = 0 while i < 3 : print(i) # 0 print("철수: 안녕 영희야 ..

Python 2021.11.13

British High Schoolers try Korean School Lunches for the first time!!

How do they get it not hard? 어떻게 안딱딱하게 만들었대요? Does the spice get worse over time? 이거 점점 매워지는 건가요? Nice kick? It's like being kicked in the mouth! 딱 좋은 매콤함이요? 입을 얻어맞는 느낌인데요 My favorite way to eat it is actually in a ssam. 제가 이거 먹을때 제일 좋아하는 방법은 쌈이에요 Which is when you get one of those leaves, 쌈이 뭐냐면, 여기 보이는 이파리에다, We're supposed to eat these leaves? 이 이파리 먹는거라구요? I'd love this to be on the school m..

English expressions 2021.11.11
반응형