day 1-4 python (변수)

2023. 2. 20. 14:44개인적인 공부/Python

Instructions

Write a program that switches the values stored in the variables a and b.

Warning. Do not change the code on lines 1-4 and 12-18. Your program should work for different inputs. e.g. any value of a and b.

Example Input

a: 3
b: 5

Example Output

a: 5
b: 3

e.g. When you hit run, this is what should happen:

 

처음과 끝을 바꾸지 말고 결과를 내야 한다.

# 🚨 Don't change the code below 👇
a = input("a: ")
b = input("b: ")
# 🚨 Don't change the code above 👆

####################################
#Write your code below this line 👇

c = a
a = b
b = c


#Write your code above this line 👆
####################################

# 🚨 Don't change the code below 👇
print("a: " + a)
print("b: " + b)

음... 변수 하나를 더 생성해서 옮겨 줘야한다.

'개인적인 공부 > Python' 카테고리의 다른 글

day 2-1 python (데이터 타입)  (0) 2023.02.20
day 1-5 python (복합)  (0) 2023.02.20
day 1-3 python (문자열 개수 출력 , input Function)  (0) 2023.02.20
day 1-2. python  (0) 2023.02.20
day 1-1. python  (0) 2023.02.20