Unable to submit the code executed during practice

Python - String Concatenation

In Python, we can use several string operations like concatenations. Two strings can be concatenated using the + operator. For example, to concatenate strings “football” and “basketball” and assign it to new variable games, use the below code

games = "football" + "basketball"

INSTRUCTIONS

  • Assign Cloudx to a variable first and Lab to a variable second
  • Concatenate first and second and store the result in the variable final

It says Assign correct value to variable first

My code is :
final= “Cloudx + Lab”

Hi,
The error is self explanatory that you have not assigned the strings to variables.
I request you to read instructions when you gets error!

All the best!

1 Like

Hi Veamsha,

As suggested in the tutorial, we have to assign each variable to a string, and the string has to be surrounded by double quotes for example -

a = “basketball”
b = “football”

And for concatenation which is just a fancy word for attaching together, we have to assign it to some other variable - So our third line of code has to be -

c = a + b

Then we just have to print c

If we dont use proper syntax, it ll throw an error.
Try to use the same logic for the question and see if it works.

Thanks!

2 Likes