fb pixel

Printing several values

The print() function is very flexible and is able to print several values at the same time. For example, to print 98234539 is a big number the program might look like this:
# (1) Print everything as one text
print('98234539 is a big number')

# (2) Print two space-separated parts
print('98234539', 'is a big number')

# (3) Print three space-separated parts
print('98234539', "is a big", 'number')

# (4) Print number instead of text
print(98234539, 'is a big', "number")
All of the programs above produce the same output 98234539 is a big number.
  1. The first version prints the text as a single piece (only a single pair of '' quotes).
  1. The second one treats 98234539 as a separate text, while is a big number as another one.
  1. The third version prints 3 separate text pieces: 98234539, is a big, and number.
  1. The final version treats 98234539 as a number, while is a big and number as texts.
It’s important to note here that the print() command can print different things: it can print text, and it can print numbers. As shown in the final example, it prints 98234539 as a number.
So, when provided with comma-separated-values, the print() function prints all of them in the output by separating them with a single space.


Write a program that would print these powers of 2: 1 2 4 8 16 32 followed by are powers of two.
Note: Use 1, 2,..., 32 as numbers and are powers of two as text.
To check your solution you need to sign in
Sign in to continue