[Tutor] Getting error on my code

Alan Gauld alan.gauld at yahoo.co.uk
Fri Jan 31 07:10:53 EST 2025


On 31/01/2025 10:46, Leam Hall via Tutor wrote:

>> def_init_(self , name , age):
>> self.name = name
>> self.age = age
>> print(self.name.title() + self.age)

> 2. Made the age a string in the __init__ print method.

As a matter of interest, why?
print() converts its arguments to strings internally
so why the explicit conversion?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos





More information about the Tutor mailing list