일시 : 2018.02.04 동주랑 답십리 도서관
내용 : 정올 기초다지기 - 함수1 (python 2)
//
571
def str_print() :
print("~!@#$^&*()_+|")
#main
num = int(raw_input())
for i in range(num):
str_print()
572
def area(radius) :
area = radius * radius * 3.14
print("%.2f" % area)
#main
radius = int(raw_input())
area(radius)
573
def num_output(n) :
count = 1
for i in range(n):
for j in range(n):
print("%d" % count),
count += 1
print("")
#main
n = int(raw_input())
num_output(n)
574
def max_output(numStr) :
max = int(numStr[0])
for i in range(3):
if max < int(numStr[i]):
max = int(numStr[i])
return max
#main
numStr = raw_input().split()
max = max_output(numStr)
print("%d" % max)
575
def square(num1, num2) :
sum = 1
for i in range(num2):
sum *= num1
return sum
#main
num1, num2 = raw_input().split()
num1 = int(num1)
num2 = int(num2)
result = square(num1, num2)
print("%d" % result)
576
def calculation(n1,ch,n2) :
sum = 0
if ch == "+":
sum = n1 + n2
elif ch == "-":
sum = n1 - n2
elif ch == "*":
sum = n1 * n2
elif ch == "/":
sum = n1 / n2
else :
sum = 0
print("%d %s %d = %d" % (n1, ch, n2, sum))
#main
n1, ch, n2 = raw_input().split()
n1 = int(n1)
n2 = int(n2)
calculation(n1, ch, n2)
577
def calculation(n1,n2,list) :
if n1 > n2:
n1 = n1 // 2
n2 = n2 * 2
elif n2 > n1:
n2 = n2 // 2
n1 = n1 * 2
list.append(n1)
list.append(n2)
return list
#main
n1, n2 = raw_input().split()
n1 = int(n1)
n2 = int(n2)
list = []
list = calculation(n1, n2, list)
print("%d %d" % (list[0], list[1]))
578
def calculation(n1,n2) :
for i in range(n1, n2+1):
print("== %ddan ==" % i)
for j in range(1, 10):
print("%d * %d = %2d" % (i, j, i*j))
print("")
#main
n1, n2 = raw_input().split()
n1 = int(n1)
n2 = int(n2)
if n1 < n2:
calculation(n1, n2)
elif n1 > n2:
calculation(n2, n1)
170
def out_print():
str = ""
for i in range(10):
str += "@"
print(str)
# main
print("first")
out_print()
print("second")
out_print()
print("third")
out_print()
171
def out_print(num):
sum = 0
for i in range(1, num+1):
sum += i
print(sum)
# main
num = int(raw_input())
out_print(num)
172
def out_print(num):
for i in range(1, num+1):
tmp = i
for j in range(num):
print("%d" % tmp),
tmp += i
print("")
# main
num = int(raw_input())
out_print(num)
173
def out_print(n1, n2):
if n1 > n2:
return (n1*n1) - (n2*n2)
elif n2 > n1:
return (n2*n2) - (n1*n1)
# main
n1, n2 = raw_input().split()
n1 = int(n1)
n2 = int(n2)
print("%d" % out_print(n1, n2))
174
def out_print(list):
tmp_list = []
for j in range(4):
col_sum = 0
for i in range(3):
col_sum += int(list[i][j])
tmp_list.append(col_sum)
list.append(tmp_list)
for i in range(4):
for j in range(4):
print("%d" % int(list[i][j])),
print("")
# main
list = []
for i in range(3):
score = raw_input().split()
sum = int(score[0]) + int(score[1]) + int(score[2])
score.append(sum)
list.append(score)
out_print(list)
'Computer Science > Jongol (정올)' 카테고리의 다른 글
[Jongol] 기초다지기 : 배열1 (0) | 2018.02.03 |
---|---|
[Jongol] 기초다지기 : 반복제어문3 (0) | 2018.02.03 |
[Jongol] 기초다지기 : 반복제어문2 (0) | 2018.01.14 |
[Jongol] 기초다지기 : 반복제어문1 (0) | 2018.01.04 |
[Jongol] 기초다지기 : 선택제어문 (0) | 2018.01.02 |