Hacker rank Challenge/python

30 Days Challenge 1일차

반응형

 

i = 4
d = 4.0
s = 'HackerRank '
# Declare second integer, double, and String variables.

# Read and save an integer, double, and String to your variables.

# Print the sum of both integer variables on a new line.

# Print the sum of the double variables on a new line.

# Concatenate and print the String variables on a new line
# The 's' variable above should be printed first.

 

이렇게만 주어진 상태에서 

12

4.0

is the best place to learn and practice coding!

을 입력받아.

 

 

16

8.0

HackerRank is the best place to learn and practice coding!

가 출력되도록 만들어야한다.

 

 

방법은 다음과 같다.

 

i = 4
d = 4.0
s = 'HackerRank '
# Declare second integer, double, and String variables.
int = int(input())
dou = float(input())
str = str(input())
# Read and save an integer, double, and String to your variables.

# Print the sum of both integer variables on a new line.
print(i+int)
# Print the sum of the double variables on a new line.
print(d+dou)
# Concatenate and print the String variables on a new line
# The 's' variable above should be printed first.
print(s+str)

input을 정수로받아 int에 저장하고, input을 float로 받아 dou에 저장하고

input을 string으로 받아 str에 저장한다.

 

그리고 print(i+int)

print(d+dou)

print(s+str)을 해주면

 

문제 해결이다.

 

 

'Hacker rank Challenge > python' 카테고리의 다른 글

30 Days Challenge 3일차  (0) 2021.01.19
30 Days Challenge 2일차  (0) 2021.01.18
30 Days Challenge 0일차  (0) 2021.01.16
HackerRank Challenge 3일차  (0) 2021.01.15
python HackerRank Challenge 2일차  (0) 2021.01.14