파이썬 복습

3/29 연습문제

김고노 2018. 3. 29. 17:13

1. 다음 코드의 결과값은?



a = "Life is too short, you need python"



if "gibeom" in a: print("gibeom is genius")

elif " python" in a and "you" not in a: print("python")

elif "shirt" no in a: print("Marvel")

elif "need" in a: print("need")

else: print("none")













2. while 문을 이용하여 아래와 같이 * 을 표시하는 프로그램을 작성해보자



*

**

***

****

*****



i = 0

while True:

    i =                                       

    if                                

    print(                             )















3. A 학급에 총 10명의 학생이 있다. 이 학생들의 중간고사 점수는 다음과 같다.


[70, 60, 55, 75, 95, 90, 80, 80, 85, 100]



for문을 이용하여 A학급의 평균 점수를 구해 보자.



A = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100]

total =                                          

for                     in                      :

    total =                              

average =                                   

print(                  )



결과값 79.0