Python Forum
My script returns no values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My script returns no values
#4
Your code should return a string, not print a string. Replace the print statements in donuts(), both_ends() fix_start() and mix_up() with code that creates and returns a string to be printed by test(). For example, donuts() should look like this:
def donuts(count):
    if count < 10:
        return 'Number of donuts: ' + str(count)
    return 'Number of donuts: many'
And when testing in the interpreter you should call main().
Output:
>>> main() donuts OK got: 'Number of donuts: 4' expected: 'Number of donuts: 4' OK got: 'Number of donuts: 9' expected: 'Number of donuts: 9' OK got: 'Number of donuts: many' expected: 'Number of donuts: many' OK got: 'Number of donuts: many' expected: 'Number of donuts: many' both_ends OK got: 'spng' expected: 'spng' OK got: 'Helo' expected: 'Helo' OK got: '' expected: '' OK got: 'xyyz' expected: 'xyyz' fix_start OK got: 'ba**le' expected: 'ba**le' OK got: 'a*rdv*rk' expected: 'a*rdv*rk' OK got: 'goo*le' expected: 'goo*le' OK got: 'donut' expected: 'donut' mix_up OK got: 'pox mid' expected: 'pox mid' OK got: 'dig donner' expected: 'dig donner' OK got: 'spash gnort' expected: 'spash gnort'
Reply


Messages In This Thread
My script returns no values - by Shay3534 - Dec-04-2020, 01:00 PM
RE: My script returns no values - by Shay3534 - Dec-04-2020, 01:14 PM
RE: My script returns no values - by Shay3534 - Dec-04-2020, 01:17 PM
RE: My script returns no values - by deanhystad - Dec-04-2020, 02:22 PM
RE: My script returns no values - by Shay3534 - Dec-04-2020, 02:46 PM
RE: My script returns no values - by Shay3534 - Dec-04-2020, 02:47 PM
RE: My script returns no values - by perfringo - Dec-04-2020, 02:48 PM
RE: My script returns no values - by Shay3534 - Dec-04-2020, 09:47 PM

Forum Jump:

User Panel Messages

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