[Tutor] Adding numbers within a string

Bob Gailer bgailer at gmail.com
Wed Oct 12 10:26:12 EDT 2016


On Oct 12, 2016 4:09 AM, "LQ Soh" <sohlq710 at gmail.com> 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]:
        print(23)

Your instructor will probably be displeased with that answer, but it meets
the requirements.

It would be nice if our teachers could models writing good requirements.

What do you think a good requirement statement would be?
_______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list