Python Forum
TypeError: not all arguments converted during string formatting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: not all arguments converted during string formatting
#1
Why is a basic print statement asking for string formatting?:

#!/usr/bin/env python3
#PracticePythonExercise02.py

number = input("Enter a number: ")

if number % 2 == 0:
    print("the number is even.")
else:
    print("the number is odd.")
Error:
>>> ================================ RESTART ================================ >>> Enter a number: 4 Traceback (most recent call last): File "F:/Python/Python36-32/SamsPrograms/PracticePythonExercise02.py", line 6, in <module> if number % 2 == 0: TypeError: not all arguments converted during string formatting >>>
Reply


Messages In This Thread
TypeError: not all arguments converted during string formatting - by RedSkeleton007 - Jul-15-2018, 08:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: string indices must be integers deneme2 2 624 Feb-14-2025, 12:23 AM
Last Post: deneme2
  TypeError: string indices must be integers, not 'str' LEMA 2 2,363 Jun-12-2024, 09:32 PM
Last Post: LEMA
  Formatting DateTime string and and converting it from AM/PM to 24 hours tester_V 2 1,092 Jun-08-2024, 05:16 PM
Last Post: tester_V
  Formatting a date time string read from a csv file DosAtPython 5 4,992 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  boto3 - Error - TypeError: string indices must be integers kpatil 7 3,095 Jun-09-2023, 06:56 PM
Last Post: kpatil
  Converted EXE file size is too large Rajasekaran 0 2,594 Mar-30-2023, 11:50 AM
Last Post: Rajasekaran
  "TypeError: string indices must be integers, not 'str'" while not using any indices bul1t 2 5,810 Feb-11-2023, 07:03 PM
Last Post: deanhystad
  String formatting (strptime) issues Henrio 2 1,806 Jan-06-2023, 06:57 PM
Last Post: deanhystad
  Error TypeError: output_type_handler() takes 2 positional arguments but 6 were given paulo79 1 3,443 Oct-17-2022, 06:29 PM
Last Post: paulo79
  TypeError: string indices must be integers JonWayn 12 5,807 Aug-31-2022, 03:29 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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