+ 4
About Python - "Module and Functions"
In the argument lesson, they have put this code def print_sum_twice(x, y): print(x + y) print(x + y) print_sum_twice(5, 8) But shouldn't we have to use print(str(x+y))? I thought the print could not print an integer.
5 Respostas
+ 3
https://code.sololearn.com/c53sb19E5743/?ref=app
here a little example i made
+ 2
print() calls the magic string method from the object given to it. so not onky can you print strings but also ints floats dictionaries and lists
+ 2
https://www.python-course.eu/python3_magic_methods.php
here is more about magic method
+ 2
Thanks, man
0
print() will take any type of variable including integers just fine. No magic method needed!