Reputation: 1
Per the image below, I got an error while displaying the number in the second program i.e. nbrs=list(range(1,11))
at the start of the second program... so I want to know the reason of the error in the second program, which I didn't get in the first program.
Upvotes: 0
Views: 66
Reputation: 1891
You have a simple type error, because you want to append a str
with an int
. +
is an operand to attach two str
or to add two int
. Please take a look at this. It is better to use something like format
to output different types:
print("{} <--is multiples of".format(n))
format
keep care of different types, convert them to a str
and append them at the desired position. See here for more information.
Upvotes: 1