Kay wants to collect all of his friends’ body heights. He needs a statement for his code that prints ‘Insert your body height in cm:’ followed by 256 underscore ‘_’ symbols. How can he do that in an easy way?
1 2 | Output: Insert your body height in cm:________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ |
Kay has been very curious and measured all of his new friends’ body heights as decimal numbers. For instance, Jay is 158.6cm tall, May is 161cm tall and so on. He needs to print these numbers on newlines otherwise nobody will understand! How can he do that?
1 2 3 4 5 | Output: 161 158.6 160.7 164 |
Kay also collected his friends’ answers and realized that they were confusing : with their names missing and he now needs to write a statement in python that prints their names and heights separated by a tab character and one person per line. How shall he do it?
1 2 3 4 5 | Output: May: 161 Jay: 158.6 Kay: 160.7 Aay: 164 |
Kay wants to print his phone number with python. However, he wants to cheat and let only the very sharp-eyed ones read see his number. Write a statement that prints 100 blank spaces first and then Kay’s phone number.
1 2 | Output: 124816 |
There are more ways that Python allows you to format your output. You will learn more advanced ways of formatting output as we progress through more chapters. Go from complete beginner to master.