2.2 Display number of dots from right to left in one line

Python solution

View solution

This is just one of many possible solutions:

number_of_cards = int(input('How many cards would you like to display? '))
number_of_dots = 1
binary_cards = ''
for i in range(0, number_of_cards):
  binary_cards = binary_cards + str(number_of_dots) + ', '
  number_of_dots = number_of_dots * 2
print(binary_cards)

Back to programming challenge

Extra Challenge

Now try removing the last , from the end of your output.