n = 5
while n >0:
print(n)
n=n-1
print("blast off")
print(n)
for x in [5,4,3,2,1]:
print(x)
print('blast off!')
friends = ['joseph', 'glenn', 'sally']
for friend in friends :
print('happy newyear, ', friend)
a = input("type hours")
b = input("type rates")
fa =float(a)
fb = float(b)
largest_so_far = -1
print("before: ", largest_so_far)
for the_num in [9,41,12,3,74,15]:
if the_num > largest_so_far:
largest_so_far = the_num
print(largest_so_far, the_num)
print('after: ', largest_so_far)
zork = 0
print('before', zork)
for thing in [1,9,46,15,72,56]:
zork = zork +1
print(zork, thing)
print('after', zork)
zork = 0
print('before', zork)
for thing in [1,3,4,5,9]:
zork = zork + thing
print(zork, thing)
print(zork)
count = 0
sum = 0
print('print', count, sum)
for value in [1,9,41,25,36,88]:
count = count+1
sum = sum+value
print(count, sum,value)
print('after', count, sum, sum/count)
#boolean
found = False
print('before', found)
for value in [1,5,8,3,15,13]:
if value == 3:
found = True
print(found, value)
print('after', found)
smallest= None
print('before')
for value in [8,2,3,1,80,9,12,-50]:
if smallest is None:
smallest = value
elif value < smallest:
smallest = value
print(smallest, value)
print("after", smallest)
# Is은 남용하지 말것.
# -> None 또는 boolean(T/F)을 쓸때만 사용하라.
# is와 is not 연산자는 '자료형'과 '값'이 동일할 때에만 True를 반환한다.
댓글