Python Forum
New to the language. What am I doing incorrectly here?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to the language. What am I doing incorrectly here?
#1
1) I ask the user to input a number as a string.
2) I convert the string to an integer.
3) I perform a comparison to see if the user's number is a multiple of 10.

number = input("Provide a number: ")
user_input = int(number)
if user_input % 10 == 0:
	print("Your number is a multiple of 10.")
else:
	print("Your number is not a multiple of 10.")
I receive the following error:
Error:
Traceback (most recent call last): File "main.py", line 2, in <module> user_input = int(number) ValueError: invalid literal for int() with base 10: 'Provide a number: '
Reply


Messages In This Thread
New to the language. What am I doing incorrectly here? - by christopher3786 - Jun-19-2020, 10:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Writing to file ends incorrectly project_science 4 2,733 Jan-06-2021, 06:39 PM
Last Post: bowlofred
  my openpyxl use is too slow, am I reading rows incorrectly? Clunk_Head 2 8,371 Apr-30-2020, 10:29 PM
Last Post: deac33
  list is printing incorrectly.. anna 1 2,121 May-18-2019, 12:12 PM
Last Post: ichabod801
  Code is Outputting Incorrectly mikerosz94 0 2,106 Sep-01-2017, 01:28 PM
Last Post: mikerosz94

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020