On 10/25/2016 4:31 AM, Wolfgang Maier wrote:
On 25.10.2016 10:10, Ben Finney wrote:
Bryon Adams writes:
I'm very new to python so please forgive what may be a beginner
question.
Welcome! You are in the right place for asking beginner Python questions
:-)
I'm thinking there should be a
On 10/25/2016 4:19 AM, Alan Gauld via Tutor wrote:
On 25/10/16 02:38, Bryon Adams wrote:
question. The book I'm working through hasn't covered using flow control
yet so I'm thinking there should be a way to do this without the for
loop I used, but I'm at a loss here.
Thee are ways to do it wi
On 25/10/16 09:31, Wolfgang Maier wrote:
> A possible explanation is that, as you are saying, the book uses
> python2. In python2, input does not return a string, but evaluates the
> input from the user to produce different types of objects. So in Python2:
Good catch Wolfgang, that's probably w
On 25/10/16 09:09, niraj pandey wrote:
> Try this.
>
> my_string = '0,1,2,3'
> my_lst=my_string.split(",")
> leng = len(my_lst)
> b=sum(my_lst)
> avg=float(b/leng)
> print avg
It doesn't work because my_list is a list of strings and you can't sum()
strings. The loop is needed to convert the strin
On 25.10.2016 10:09, niraj pandey wrote:
Try this.
my_string = '0,1,2,3'
my_lst=my_string.split(",")
leng = len(my_lst)
b=sum(my_lst)
avg=float(b/leng)
print avg
better try things yourself before suggesting them to others:
>>> my_string = '0,1,2,3'
>>> my_lst=my_string.split(",")
>>> leng =
Try this.
my_string = '0,1,2,3'
my_lst=my_string.split(",")
leng = len(my_lst)
b=sum(my_lst)
avg=float(b/leng)
print avg
On Tue, Oct 25, 2016 at 7:08 AM, Bryon Adams
wrote:
> Hello,
> I'm very new to python so please forgive what may be a beginner
> question. The book I'm working through
On 25.10.2016 10:10, Ben Finney wrote:
Bryon Adams writes:
I'm very new to python so please forgive what may be a beginner
question.
Welcome! You are in the right place for asking beginner Python questions
:-)
I'm thinking there should be a way to do this without the for loop I
used, b
On 25/10/16 02:38, Bryon Adams wrote:
> question. The book I'm working through hasn't covered using flow control
> yet so I'm thinking there should be a way to do this without the for
> loop I used, but I'm at a loss here.
Thee are ways to do it without using a for loop but they are
all more a
Bryon Adams writes:
> I'm very new to python so please forgive what may be a beginner
> question.
Welcome! You are in the right place for asking beginner Python questions
:-)
> I'm thinking there should be a way to do this without the for loop I
> used, but I'm at a loss here.
Thank you fo