Algorithm/python
-
python2. 변수입력과 연산자Algorithm/python 2021. 2. 21. 19:13
a, b = input("숫자를 입력하세요: ").split() print(a + b) # 23 (string concat) c = a + b print(c) print(type(c)) # a = int(a) b = int(b) print(a + b) # 5 a, b = map(int, input("숫자를 입력하세요: ").split()) print(a + b) # 5 print(a / b) print(a // b) # 몫 print(a % b) # 나머지 print(a ** b) # a^b a = 4.3 b = 5 c = a + b print(type(c)) #
-
python.1 변수와 출력 함수Algorithm/python 2021. 2. 21. 19:06
# 값 교환 a, b = 10, 20 print(a, b) # 10, 20 a, b = b, a print(a, b) # 20, 10 # 변수 타입 a = 12345 print(a) # 12345 print(type(a)) # a = 12.123456789123456789 print(a) # 12.123456789123457 print(type(a)) # # 출력방식 print("number") a, b, c = 1, 2, 3 print(a, b, c) # 1 2 3 print("number : ", a, b, c) # number : 1 2 3 print(a, b, c, sep=', ') # 1, 2, 3 print(a, end=' ') print(b, end=' ') print(c, end=' ')