Hi so I’m currently finishing up with the lists topic under python 3 and under the assignment called lens slice, there is an instance where I need to print the following sentence - “We sell 7 different kinds of pizzas!” where the 7 is an output of the len() function and the rest are strings to be printed. I am not sure on how to create the space between the number and the words. I tried adding “” between them but it doesn’t seem to work…
Here is the link to my assignment for better viewing :
Hello and welcome to the forums!
You can either add a space to the end of the first string and start of the end string (which is probably the easier option), or you can convert to using ,
instead of +
, as if you’re using ,
, then Python with automatically inset a character (by default a space) between the strings/variables passed.
Happy coding!
1 Like
Ahh okok thanks a lot for the feedback
The first suggestion doesn’t seem to work but the second one does!
1 Like
Glad I could help! Not sure why the first one didn’t work, it should look like this:
print("We sell " + str(num_pizzas) + " different kinds of pizza!")
With an extra space on the end of string 1, and at the start of the second string.
Happy coding!