Enter the second number associated with the first number

Asked 2 years ago, Updated 2 years ago, 15 views

Hello.

I have a question because there is a blockage while programming with Python. I'd like to write a code that specifies the range of the first number, and then receives the number of the first number and the number of the second number that has a given range, but it doesn't

 Enter the first number (1~1000): 15
       Enter the second number (15-1000): 22

What should I do with this coding?

python

2022-09-20 17:11

1 Answers

print("Enter the first number (1~1000):", end=') #Output a phrase without a line break at the end
num_1 = input() #Enter characters and store them in the [num_1] variable
num_1 = int(num_1) #num_1 is replaced by an integer
print("2nd number input(" + str(num_1) +"~1000) :", end='') #Output a phrase while putting num_1 in the middle
num_2 = input() #Enter characters and store them in the [num_2] variable
num_2 = int(num_2) #num_2 is replaced by an integer
print("First number:" + str(num_1) +"Second number:" + str(num_2))

https://dojang.io/mod/page/view.php?id=1219


2022-09-20 17:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.