-2

variables

free_time = (int)input("How much free time do you have? ->").strip()
num_activties = (int)input("How many activities would you like to spend your free time on? ->").strip()

How would I go about asking the user to fill out x amount of variables based on the number they input in num_activies?

Community
  • 1
  • 1
  • Try using a `for` or `while` loop that iterates `num_activities` times and appends to a list. – FCo May 26 '16 at 15:40

1 Answers1

1

Considering the user would always input a number, do like this:

answers = []
num_activities = int(input("How many activities would you like to spend your free time on? ->"))

for time in range(num_activities):
    answer = input("Question: ")
    answers.append(answer)

Then you can access the questions with the answers variable

Like, to print the n-th answer: print(answers[n])

noteness
  • 2,440
  • 1
  • 15
  • 15