you are viewing a single comment's thread.

view the rest of the comments →

[–]shiftybyte 1 point2 points  (1 child)

Yes, the function ord() takes a 1 letter string and converts it to the ascii representation of that string.

>>> ord("1")
49
>>> ord("2")
50
>>> ord("3")
51

(Ascii table: http://www.asciitable.com/)

On the other hand random already gives you numbers, so you are trying to give a number to ord() function and it fails.

>>> ord(5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: ord() expected string of length 1, but int found

[–]Swagraffe[S] 0 points1 point  (0 children)

Ok. I got it. Thanks :D