* adam urbas (Sun, 27 May 2007 23:42:01 -0500)
> You don't know what a Ti 83 is.  Calculator.  The most basic programming 
> available.  It already has so many functions built into it that it is much 
> easier to tell it to do things.  You don't have to do all this integer 
> conversion and such whatnot.  Wow... I'm really unsure of how this thing is 
> supposed to work.  It seems the more I learn about Python, the more 
confused I become.  It's enough to bring tears to your eyes.  Not really but 
ya.Someone else helped me with the problem of accepting numbers and words.  I 
used:if shape in["1","circle"]:something like that.  It works wonderfully.  I'm 
not sure why, but I know that it does and that is enough.  Someone else also 
said that I had to convert to int, and I did.  That was 
another problem, which is now fixed.But, as usual, it is just one problem after 
another.  Now I have run into this error message: Traceback (most recent call 
last):  File "C:\Documents and Settings\HP_Owner\Python0\area.py", line 23, in 
<module>    area = 3.14*(radius**2)TypeError: unsupported operand type(s) for 
** or pow(): 'str' and 'int'>>> and others like 
this:Traceback (most recent call last):  File "C:\Documents and 
Settings\HP_Owner\Python0\area.py", line 19, in <module>    area = 
height*widthTypeError: can't multiply sequence by non-int of type 'str'>>> Very 
frustrating.  What is a non-int and what is 'str'?  Why can't it multiply the 
sequence?  I guess I should include the program I'm using for these things.I'm 
having this problem with both of these attached.  The messages above are from 
area.py.  area.py is sort of a prototype of radiacir.py, a test version.  You 
know, I should probably try that int trick, which I seem to have forgotten.  
And guess what that did it.  It's amazing when you apply the things that you 
learn.  Apparently  I am quite absent minded.  Well It seems 
I don't need any of this help anymore.  Oh well.  Thanks anyway.Au > To: 
tutor@python.org> From: [EMAIL PROTECTED]> Date: Thu, 24 May 2007 23:34:05 
+0100> Subject: Re: [Tutor] trouble with "if"> > "adam urbas" <[EMAIL 
PROTECTED]> wrote > > >  It won't even accept words.  > > I can only get it to 
accept numbers.  > > try this(untested code!):> > number = 
None> data = raw_input('Type something: ')> try: number = int(data)> except: 
data = data.split()    # assume a string> > if number:    # user entered a 
number>     if number == 1:  print 'circle'>     elif number == 2: print 
'another'> else:         # user entered words>     if data[0].lower() == 
'circle': print 'circle'>     else: print 'user entered ', data[0]> > 
Notice that to use ithe input as a number you have to > convert the raw input 
characters to a number (using int)> To get the individual words we can use 
split() which by > default splits a string into the individual words.> > Is 
that the kind of thing you mean?> > I've no idea what a Ti83 is BTW. :-)> > 
Alan G.> > _______________________________________________> Tutor 
maillist  -  Tutor@python.org> http://mail.python.org/mailman/listinfo/tutor

Do you really think someone can or will read what you wrote? I've 
never seen something so horribly formatted like you emails - and I've 
seen lots of awful formatted emails...

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to