Reputation: 17
I am learning how to code. This is my code:
race = 'Daytona 500'
print( race , 'is' + type( race ) )
And the error is:
print( race , 'is' + type( race ) )
TypeError: must be str, not type
Please help, what am I doing wrong
Upvotes: 0
Views: 150
Reputation: 2561
Better to use format
here
race = 'Daytona 500'
print( race + ' is '+'{}'.format(type(race)))
It will print Daytona 500 is <type 'str'>
Upvotes: 3