bramming
July 13th, 2008, 06:47 PM
Hey. Today i decided to try some real programming after spending a lot of my time in JASS (some language to make triggers for warcraft 3 maps :) )
Well i really like Python and i made a little basic program, which asks you a lot of questions and do calculations based on those. But my problem is, at the start i would like to ask the user how many people are going to be in the "test". i do so the following way:
antal_ppl = float(raw_input("Number of ppl participating in this test: "))
print
antal_ppl_counter = antal_ppl
while antal_ppl_counter != 0
(indent here) personnr(antal_ppl_counter) = raw_input("Name of person number", antal_ppl_counter,":")
(indent here) antal_ppl_counter = antal_ppl_counter - 1
so what i want it to do, is to ask how many people are going to participate, and then ask for the name of each person and store all the names in variables. i wonder how i should store them in variables. i would like to do it so, that every name is stored in "personnr(the number of the person here), so if i say 5 people will participate, i store the 5 names in the variables personnr1, personnr2, personnr3, personnr4, personnr5. Whatever i do it displays an syntax error. Any help will be much appreciated :)
EDIT: I have been searching, but i probably missed it. Isnt there a way to do "for each integer from 1 to X do the following:" in Python? must be :D would make it all so much easier.
Well i really like Python and i made a little basic program, which asks you a lot of questions and do calculations based on those. But my problem is, at the start i would like to ask the user how many people are going to be in the "test". i do so the following way:
antal_ppl = float(raw_input("Number of ppl participating in this test: "))
antal_ppl_counter = antal_ppl
while antal_ppl_counter != 0
(indent here) personnr(antal_ppl_counter) = raw_input("Name of person number", antal_ppl_counter,":")
(indent here) antal_ppl_counter = antal_ppl_counter - 1
so what i want it to do, is to ask how many people are going to participate, and then ask for the name of each person and store all the names in variables. i wonder how i should store them in variables. i would like to do it so, that every name is stored in "personnr(the number of the person here), so if i say 5 people will participate, i store the 5 names in the variables personnr1, personnr2, personnr3, personnr4, personnr5. Whatever i do it displays an syntax error. Any help will be much appreciated :)
EDIT: I have been searching, but i probably missed it. Isnt there a way to do "for each integer from 1 to X do the following:" in Python? must be :D would make it all so much easier.