Please do not give homework solutions. Thanks.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Then Isaac's function does that(but you have to leave a space after
last number in the string).
def foo(x):
a, b = 0, ""
for i in x:
if i != " ":
b += i
else:
print ("this is b", b)
a += int(b)
print ("this is a",a)
hi, tracey,
are you allowed to use python sets? if so, you should take a look at them and
their methods:
https://docs.python.org/3.5/tutorial/datastructures.html?highlight=data%20structures#sets
best,
james
From: Tutor [tutor-bounces+jderry=mail.utexas...
You can write your own str.split or just use while loop.
12.10.2016, 15:12, "LQ Soh" :
To whom it may concern,
Can someone enlighten me as to how you can create a function such
that sum_numbers('10 5 8'), when run, will give an answer of 23, without
using str.split() and
On 12/10/16 18:40, tracey jones-Francis wrote:
> I want to have a function that will ignore certain words that
> i have specified in a dictionary.
> the dictionary is called skip_words and has about 20 different strings in.
We shouldn't care inside the function what the external
data is called,
On 12/10/16 17:58, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Sorry, I did not read the conditions that split and for should not be used.
It is even more confusing - split() may NOT be used
but 'for' MUST be used...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.a
Im in the middle of designing a game in python, im quite new to using it and am
struggling with a certain bit of code. I want to have a function that will
ignore certain words that i have specified in a dictionary. I have tried so
many different types of code but can't seem to return just the ke
Sorry, I did not read the conditions that split and for should not be used.
regards,
Sarma.
On Wed, Oct 12, 2016 at 10:20 PM, D.V.N.Sarma డి.వి.ఎన్.శర్మ
wrote:
> def string_sum(s):
> total = 0
> items = s.split(" ")
> for item in items:
>total += int(item)
> p
def string_sum(s):
total = 0
items = s.split(" ")
for item in items:
total += int(item)
print(total)
You can call the function as
string_sum("10 4 5 ")
Output will be 19.
regards,
Sarma.
On Wed, Oct 12, 2016 at 3:22 PM, hell gates wrote:
>You can write y
def foo(x):
a,b = (0,"")
for i in x:
if i != " ":
b+=i
else:
print ("this is b",b)
a = a + int(b)
print ("this is a",a)
b = ""
print ("final a ",a)
this should help you solve it. figure a way to add the last number. if any
troubles ask again.
Thanks [😊]
From: Tu
On Oct 12, 2016 4:09 AM, "LQ Soh" wrote:
>
> To whom it may concern,
> Can someone enlighten me as to how you can create a function such
> that sum_numbers('10 5 8'), when run, will give an answer of 23, without
> using str.split() and using a for loop
def sum_numbers(x):
for x in [1]:
On 12/10/16 01:37, LQ Soh wrote:
> To whom it may concern,
> Can someone enlighten me as to how you can create a function such
> that sum_numbers('10 5 8'), when run, will give an answer of 23, without
> using str.split() and using a for loop
I'm assuming this is some kind of classroom exercise?
O
On 12/10/16 09:03, niraj pandey wrote:
> Can you pls guide how to print this screen (Attached here) content in
> printer ?
As we already pointed out this is a text list so attachments
are usually stripped off...
However, printing from Tkinter is not easy. The simplest way is usually
to create an
To whom it may concern,
Can someone enlighten me as to how you can create a function such
that sum_numbers('10 5 8'), when run, will give an answer of 23, without
using str.split() and using a for loop
___
Tutor maillist - Tutor@python.org
To unsubscrib
Hi ,
I need one more help related to printer.
Can you pls guide how to print this screen (Attached here) content in
printer ?
Thanks
Niraj
On Tue, Oct 4, 2016 at 12:21 PM, niraj pandey
wrote:
> Ok I got it from the solution you provided on your previous mail.
>
> Thanks again
>
> Thanks
> Nir
15 matches
Mail list logo