D
D
Daniel2020-05-18 22:30:30
Python
Daniel, 2020-05-18 22:30:30

How to simplify the solution code?

my_weight = 73
my_moon_weight = my_weight * 0.165
for year in range(1, 16):
    print(year, my_moon_weight)
    my_weight += 1
    my_moon_weight = my_weight * 0.165

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-05-18
@dansonswa

my_weight = 73
for i, year in enumerate(range(1, 16)):
   print(year, (my_weight + i) * 0.165)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question