Python Forum
Help with function and sep( , ) value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with function and sep( , ) value
#2
How are you calling your function(s) when you receive the error? As is, your code appears to work correctly when given a list of strings as input:
Output:
>>> mystringlist = ['a','b','c','d'] >>> to_string(mystringlist) 'a, b, c, d'
It throws type errors for a list of anything other than strings, but that could be fixed by using the str() function when building your result in to_string(). (That appears to be within the rules the way I am reading them, as it only mentions not using built-in functions for the length() part of the assignment.)
Reply


Messages In This Thread
Help with function and sep( , ) value - by drewbty - May-31-2020, 09:20 AM
RE: Help with function and sep( , ) value - by GOTO10 - May-31-2020, 03:31 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020