Can print be used on more than just strings?

is print() function always used for printing a string, or we can print other data types without converting them to the string form

print() will print anything that you ask it to. You do not need to convert to string; the print() function does that (as well as it can). You may need to do some formatting to make the output useful, attractive, or both.

a = 'abc&xyz'  # string
b = 3.16  #float
c = {2:'a', 3:'b'}  # dictionary
d = 6 < 2  # boolean
e = [1,2,3,4,5] # list
f = sum(e)  # value returned from a function
g = sum # a function

for obj in [a,b,c,d,e,f,g]:


{2: 'a', 3: 'b'}
[1, 2, 3, 4, 5]
<built-in function sum>

what does “< built-in function sum >” mean? I had to add spaces to get that to print. Did the comment box just not print something?

It means that Python found that sum is a function built into the program. If you do the example, replacing sum by any of the functions listed here . You should get the same result