Fatos Morina

Software engineering and personal development

Page 11 of 55

How to do Multiple Prints in a Single Line in Python

printing machine
Photo by Bank Phrom on Unsplash

If you want to print multiple things in the same line, you do not need to clutter everything with the plus operator, or do some type of conversion and then do the concatenation.

For that, we are going to use the help of the “end” parameter inside the print() method indicating the type of separator that you want to use between the items that you want to print.

Continue reading

How to Quickly Repeat String without Looping in Python

green clothes hanger
Photo by Keagan Henman on Unsplash

You have been doing math calculations since a very young age, from adding two numbers, to multiplying, dividing, and finding the square root of a number by hand.

In Python, you can also multiply a string with a number.

Yes, you read that right. You do not have to do something big, or fancy: You can just take a string and multiply it with any natural number.

You may be wondering, “What’s the result? I know what is 3 * 3, but I don’t know what’s going to be the result of 3 * ‘abc’?

Continue reading
« Older posts Newer posts »

© 2024 Fatos Morina

Theme by Anders NorenUp ↑