Is it possible to create variables from a counter?

Asked

Viewed 19 times

0

Good afternoon, I wonder if it is possible from the value obtained in a counter, to create variables in the same amount. To illustrate better:

counter_persons = 2

person 1 = float(input('Enter your weight in KG: '))

altura_personal 1 = float(input('Insert your height in CM: '))

person 2 = float(input('Enter your weight in KG: '))

altura_personal 2 = float(input('Insert your height in CM: '))

I wrote manually the personal variables1, personal variable2, personal variables1 and personal variable2. However, if you were dealing with 100 people, for example, it would become impractical. Then my doubt arose, if through some code I can do something similar. I’m a beginner in programming, maybe it’s something simple I don’t know yet.

  • Use lists in the row of peso_people = []; peso_people.append(float('enter your weight...'))

  • Also: https://answall.com/q/346439/101.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.