Post

PythonPython

L
Lakshmi sowjanya

Posted on 25th April 2024|1182 views

0
votes

Typeerror: An Integer Is Required

how to solve typeerror an integer is required in python?

Answers
P
naseer mohammad

Posted on 25th April 2024

This error occurs when you want to print the ASCII value of the integer but forgot to typecast the integer type, for example, consider the following program 

q=list(str(45678))

for j in q:

    print(chr(j))  

Here we have to cast the char() function the solution is the following code.

q=list(str(45678))

for j in q:

    print(chr(int(j)))

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos