In most ways these three do similar thing with some subtle differences
print("EXAMPLES FOR: repr(object), ascii(), and eval(object)") Str_testEval = "1+2+3" #in quotes, it is just a string - no numeric value" print("Testing eval to see how it treates the string " + Str_testEval) print(eval(Str_testEval)) print("Print text with a diacritic mark; print it as a string, then with ascii, then with repr") text1 = "Meet me at the Café" print(text1) print(ascii(text1)) print(repr(text1)) test2 = "Naïve" print("\nTest 2: the word is: " + test2) it2 = iter(test2) letter = "" word = [] while letter != "\n": letter = next(it2, "\n") print("unicode value for " + letter + " is " + str(ord(letter))) word.append(ord(letter)) print("the word list now holds: ") print(word) print("Printing these unicode values: ") print("using repr we have: ") for i in range(len(word)): print(repr(chr(word[i])), end='') print() print("using ascii we get: ") for i in range(len(word)): print(ascii(chr(word[i])), end='')