Re: Python help needed

2019-08-08 Thread Dan Sommers
On 8/8/19 12:26 PM, Paolo G. Cantore wrote: > I think the special case treatment could be avoided. > > First: Join all items with ' and ' > Second: Replace all ' and ' with ', ' except the last That works great, until one of the elements of the original list is "spam and eggs": >>> spam =

Re: Python help needed

2019-08-08 Thread Paolo G. Cantore
Am 08.08.19 um 01:18 schrieb MRAB: On 2019-08-07 21:36, Kuyateh Yankz wrote: #trying to write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, passing the previous

Re: Python help needed

2019-08-07 Thread MRAB
On 2019-08-07 21:36, Kuyateh Yankz wrote: #trying to write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, passing the previous spam list to the function would

Python help needed

2019-08-07 Thread Kuyateh Yankz
#trying to write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, passing the previous spam list to the function would return 'apples, bananas, tofu, and cats'. But

Newby Python help needed with functions

2011-06-03 Thread Cathy James
I need a jolt here with my python excercise, please somebody!! How can I make my functions work correctly? I tried below but I get the following error: if f_dict[capitalize]: KeyError: function capitalize at 0x00AE12B8 Code below: def capitalize (s): capitalize accepts a string parameter

Re: Newby Python help needed with functions

2011-06-03 Thread Andrew Berg
On 2011.06.03 09:42 AM, Cathy James wrote: I need a jolt here with my python excercise, please somebody!! How can I make my functions work correctly? I tried below but I get the following error: if f_dict[capitalize]: KeyError: function capitalize at 0x00AE12B8 ... def capitalize (s):

Re: Newby Python help needed with functions

2011-06-03 Thread Tim Chase
On 06/03/2011 09:42 AM, Cathy James wrote: I need a jolt here with my python excercise, please somebody!! How can I make my functions work correctly? I tried below but I get the following error: if f_dict[capitalize]: KeyError:function capitalize at 0x00AE12B8 def capitalize (s): Here you

Re: Newby Python help needed with functions

2011-06-03 Thread Jonathan Gardner
On Fri, Jun 3, 2011 at 7:42 AM, Cathy James nambo...@gmail.com wrote: I need a jolt here with my python excercise, please somebody!! How can I make my functions work correctly? I tried below but I get the following error: if f_dict[capitalize]: KeyError: function capitalize at 0x00AE12B8

Re: Newby Python help needed with functions

2011-06-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Cathy James wrote: I need a jolt here with my python excercise, please somebody!! How can I make my functions work correctly? I tried below but I get the following error: if f_dict[capitalize]: KeyError:function capitalize at 0x00AE12B8 Code below: def capitalize