Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

01%20python/02.08%20%EC%97%AC%EB%9F%AC%20%EA%B0%9C%EC%9D%98%20%EC%9E%90%EB%A3%8C%EB%A5%BC%20%ED%95%9C%20%EB%B3%80%EC%88%98%EC%97%90%20%EB%8B%B4%EA%B8%B0 #66

Open
utterances-bot opened this issue Aug 5, 2022 · 4 comments

Comments

@utterances-bot
Copy link

2.8 여러 개의 자료를 한 변수에 담기 — 데이터 사이언스 스쿨

https://datascienceschool.net/01%20python/02.08%20%EC%97%AC%EB%9F%AC%20%EA%B0%9C%EC%9D%98%20%EC%9E%90%EB%A3%8C%EB%A5%BC%20%ED%95%9C%20%EB%B3%80%EC%88%98%EC%97%90%20%EB%8B%B4%EA%B8%B0.html

Copy link

hsjjjj commented Aug 5, 2022

list=[10,20,30,40,50]
a=0
for i in range(5):

a=a+list[i]

print(a/5)

Copy link

import random

a = []
score = []

for i in range(1,101): # a에 1부터 100까지 숫자 추가
a.append(i)

for i in range(5): # 5회 반복
b = random.choice(a) # a에서 랜덤으로 숫자 뽑고
score.append(b) # score에 추가하기

print("Score Board =",score) # 스코어
print("Average =",sum(score)/5) # 평균점수

Copy link

연습문제1

import random
score = []
for i in range(5):    
    score.append(random.randint(0, 100))
print('점수', score)
print('평균', sum(score) / len(score))

연습문제2

days = {'01':31, '02':28, '03':31, '04':30, '05':31, '06':30,
        '07':31, '08':31, '09':30, '10':31, '11':30, '12':31}
even = []
for m in days.keys():
    if int(m) % 2 == 0:
        even.append(days[m])
print(sum(even) / len(even))

Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants