very newbie questions
Alex
the_brain at mit.edu
Sat Sep 30 16:33:20 EDT 2000
> How do you write an exponent sign in python (ie how do u write 16 x 16
> in exponential form?)
16 ** 2
> WHat does the '%' operation do?
That depends. For integers, a % b is the remainder when a is divided by
b. For strings, it tells python to perform some substitutions. See
http://www.python.org/doc/current/lib/typesseq-strings.html
for more info.
> One more thing... How do you turn a string into numerical data to do
> math on (I have to use the raw_input() command, b/c they enter a # in
> hexadecimal) then turn the numerical data back into a string?
If you want an integer, use e.g. int('16'). For a float, use
e.g. float('16.5')
Alex.
--
Speak softly but carry a big carrot.
More information about the Python-list
mailing list