20.7k views
0 votes
"TypeError: ord() expected string of length 1, but int found.

A) Data Type Mismatch
B) Syntax Error
C) Logic Error
D) Runtime Error

1 Answer

5 votes

A 'TypeError: ord() expected string of length 1, but int found' is a Data Type Mismatch and Runtime Error caused by passing an integer to the ord() function instead of a single character string.

The error message 'TypeError: ord() expected string of length 1, but int found' indicates that there is a problem with the type of data being passed to the ord() function in python. The ord() function is intended to take a single character (a string of length 1) and return an integer representing the Unicode code point of that character. However, in this case, an integer was passed to the ord() function instead of a single character.

This is a Data Type Mismatch error, as the function was expecting a different type of input. It is also a Runtime Error because it occurs when the program is running and encounters an issue with the function's argument that was not expected by the function's definition.

User Josh Unger
by
7.8k points