Dec-04-2020, 02:22 PM
(This post was last modified: Dec-04-2020, 02:22 PM by deanhystad.)
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'