Jump to content

Very new to this... trying to assign variables

- - - - -

  • Please log in to reply
1 reply to this topic

#1
TimothyG

TimothyG

    Newbie

  • Members
  • Pip
  • 1 posts
Hello,
I'm very new to programming and am only doing this to expand my mind.
Currently (for educational purposes only) I'm trying to make a simple script for finding the standard deviation using an unlimited number of data points.
in the beginning of the script
n=0
each time a user enters data
n=n+1

what I'm having trouble with is i need the data entered by the user to be stored respectively in a1, a2, a3 etc...
Example

the first time data is entered, n=1 data entered by user = a1
the second time, n=2 data entered by user =a2

if i type
print "a%s" % (n)

the result if n=1 is
a1
if n=2 is
a2
etc..


i need this to work


["a%s" % (n)]= input()


hopefully I'm not a complete tard and some one will understand this enough to tell me whats going wrong.
Any help appreciated but please remember that I'm a noob,...... and dumb.
thank you.

#2
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 890 posts
  • Location:::1
If I understand you right, I think list is what you're after. Everything is well explained on their site, but should you have some questions we're here to help out.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users