Getting error when try to merge str + integer + str

Hello everyone,
I am beginner and try to learning with simple programs, so here I tried concatenate STR + INT with a simple program and it works good and given output.
But when I am trying to concatenate STR + INT + STR got an error. So I attached the actual source code and the error output here below.


So can please any one help with this.

2 Likes

You are missing a second +.

And, rather than “merge”, the term more widely accepted is “concatenate”.

But I’m pleased you figured out the need to use str() to turn a number into a string.

2 Likes

Hello Martin,
Thanks for your help, I tried adding the second + as you told.
I got my answer and lol…thanks a lot…

2 Likes

By Kaliswaran via Discussions on Python.org at 30Jun2022 07:32:

Hello Martin,
Thanks for your help, I tried adding the second + as you told.
I got my answer and lol…thanks a lot…

BTW, for future posts, please copy/paste code etc inline as text in the
post itself between triple backticks:

```
your code
goes here
```

This lets everyone see it directly. Using screenshots has several
disadvantages:

  • we cannot copy/paste the text from them, making it hard to try things
    with
  • the visually impaired may be unable to see the screenshot at all, or
    have trouble with it depending on colours and sizes
  • those on email do not see the screenshot and must laboriously go to
    the web forum in order to observe it

Otherwise, we’re glad you have a solution for your problem.

Cheers,
Cameron Simpson cs@cskk.id.au

1 Like