0
# Create two variables items & days. # Each variable is initialized with a single line of console input - input() # The input is then cast to a integer int() items = int(input()) days = int(input()) # Creates a loop, conidition is 'days greater than 0' # While days is greater than zero, the loop will continue to run. while days>0: # Modifying the variables inside the loop, these happen on each run (iteration) # items is multiplied by 2. The *= operator expands to (items = items * 2) items*=2 # days is reduced by 1. The -= expands to (days = days - 1) days-=1 # Printing out the result to the console, value of items. print(items)
21st Jan 2023, 12:45 PM
DavX
DavX - avatar