Hướng dẫn print numbers in python

We were given an exercise where a user must input two numbers and the output must be the numbers between the two given numbers, with the condition that the only input are numbers, and if the user types anything besides that will print "INVALID INPUT!"

Nội dung chính

  • Not the answer you're looking for? Browse other questions tagged python statements or ask your own question.
  • Python Conditional: Exercise - 16 with Solution
  • Visualize Python code execution:
  • Python: Tips of the Day
  • How do you get the number between two numbers in Python?
  • How do you print a range of numbers in Python?
  • How do I print numbers from 1 to 10 in Python?
  • How do you print between in Python?

Nội dung chính

  • Not the answer you're looking for? Browse other questions tagged python statements or ask your own question.
  • Python Conditional: Exercise - 16 with Solution
  • Visualize Python code execution:
  • Python: Tips of the Day
  • How do you get the number between two numbers in Python?
  • How do you print a range of numbers in Python?
  • How do I print numbers from 1 to 10 in Python?
  • How do you print between in Python?

Here is what I have tried:

num1 = int[input['Give me a #:']]

num2 = int[input['Give me another#:']]


if num1>num2

print["First number should be lesser than second number"]


elif num1 = 1 ]:.

print [i, end = ' ' ] i = i - 1..

How do you print between in Python?

append[i] print[f'First number: {num1}n\Second number: {num2}'] print[f'The numbers between {num1} and {num2} are:\n{num_list}'] break except: print["Input must be a number. Try again. "]

Chủ Đề