November 20th, 2012, 09:30 AM
Join Date: May 2012
Location: 39N 104.28W
Time spent in forums: 2 Days 17 m 54 sec
Reputation Power: 2
Originally Posted by so.very.tired
im new to python and i can really use some help with it.
my first question:
is there a simple way to obtain as input three integers from user with one command?
im talking about something equivalent to the c command where you can obtain as many inputs as you want with just one line:
scanf("%d %d %d %d...", &a, &b, &c, &d...)
my second question:
where can i find a list of functions that can manipulate strings?
for example, lets say im getting from the user an integer number (with raw_input) - and i want to access one of the memory cells (i assume python saves each digit on 4 bits memory cell) and change its value as i please.
or - another example - i want to count how many digits are there.
or - i want to evaluate if the string doesn't hold any signs(char), in other words - to make sure it holds only digits.
are these operations possible?
thanks in advanced, and have a nice day!
First, it's not very pretty but:
>>> a,b,c=map(int,raw_input("enter three numbers separated by commas: ").split(','))
enter three numbers separated by commas: 12,24,42
see:5.6.1 String Methods