# unit 2.21 biggest quiz.. the submission mechanism is crap

 0 def biggest(a,b,c): if a>b: grtr=a else: grtr=b if grtr > c: print grtr else: print c biggest(1,2,3)  It works fine when u run it but gives an error when submitted.. works fine in Drpython too..:@@ asked 09 Mar '12, 02:20 Vipul Jhamna... 2●6 accept rate: 0% Rob Barnes-3 ♦ 19.1k●10●68●205

 1 You're printing the values instead of returning them answered 09 Mar '12, 02:22 Rob Barnes-3 ♦ 19.1k●10●68●205 so wats the big deal.. i should get it correct no matter how i submit the code.. this is BUG in their logic (09 Mar '12, 02:26) Vipul Jhamna... 2 A BUG in their logic? Hmm.. not really. If you were to write a real program, you would soon find out that print and return would make a big difference in expected behavior. And unlike what you seem to expect your teachers to do, I'm afraid a program will simply not read your mind and assume you meant return when you wrote print or meant print when you wrote return or whatever else for that matter. (09 Mar '12, 03:13) Akuna It is not a bug in their logic. It's a bug in yours. If you have a function that is supposed to return something, and it doesn't, the program doesn't work. Quick example: def square(number): return number * number x = 5 answer = 5 + square(x) print answer  would exectute and the result of the program would be: 30  Change the return to a print: def square(number): print number * number x = 5 answer = 5 + square(x) print answer  and you now have a program that doesn't work :p So the moral of the story is, use return when you're supposed to return something, and print when you're supposed to print it. 'print' versus 'return': To print or Not to print May provide you with some guidance. (09 Mar '12, 03:18) Rob Barnes-3 ♦
Question text:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

×15,276
×236
×18