본문 바로가기
AI(artificial Intelligence)

python- 반복, 조건 연습

by 데이터 퍼즐 2022. 6. 6.
반응형

1. list, dic

name = 'Jane'#('Enter name : ')
names.append(name)
print(names)

['judy', 'Tom', 'Jane', 'Jane']

names[3]='jin'

['judy', 'Tom', 'Jane', 'jin']

names.index('jin')
3

scores = [100, 90, 70 ,60]
highscores =[names, scores]
print(highscores)
[['judy', 'Tom', 'Jane', 'jin'], [100, 90, 70, 60]]

dic = {}
station = '\uC131\uBD81'
 

2. if, for, While

name = input('What is your name : ')

  cat

if name == 'bird':
  print("I could fly to you")
elif name == 'pig':
  print("I could walk to you ")
else:
  print("I could stay to you")
  
  I could stay to you

 

반응형

'AI(artificial Intelligence)' 카테고리의 다른 글

python  (0) 2022.06.07
323 웹 스크래핑  (0) 2021.07.19
224 Model Selection  (0) 2021.06.18
Sprint2-3 Ridge Regression  (0) 2021.06.10
Sprint2-2 multiple-regression  (0) 2021.06.09

댓글