# Another way to solve Unit 2.21 biggest

 1 1 Here's the way I did it.' def biggest(a,b,c): z=a if b>z: z=b if c>z: z=c return z print biggest(5,23,8)  Here's the way I did it. print z  asked 04 Mar '12, 21:35 Thomas Braniff 109●1●7●13 accept rate: 0% Retagbot ♦ 15●18●171 Would you please format your code by selecting it in the editor and clicking on the button labelled 101010? Thanks! (04 Mar '12, 22:04) pmoriarty

 3 As I was thinking about it I came up with this one: def bigger(a,b): if a > b: return a return b def biggest(a, b, c): return bigger(a, bigger(b, c))  answered 04 Mar '12, 22:20 pmoriarty 5.5k●5●23●77 1 Me like! :-) (04 Mar '12, 22:25) Rafael Esper...
 2 Another solution, though perhaps using stuff not yet covered: def biggest(a,b,c): L = [a,b,c] L.sort() return L[2]  answered 04 Mar '12, 22:14 Rafael Esper... 12.8k●66●128●192
 1 Here's how I did it: def biggest(a, b, c): if a > b: if a > c: return a else: if b > c: return b else: return c return c  answered 04 Mar '12, 22:05 pmoriarty 5.5k●5●23●77
 1 Just to add to the mix...  def biggest(a, b, c): if (a < b) or (a < c): if (b < c): return c else: return b else: return a answered 04 Mar '12, 22:28 dedos 1.4k●13●22●30
 1 What dedos said. :) a = 45 b = 355 c = 2 def biggest(a, b, c): if a > b and a > c: return a if b > a and b > c: return b if c > a and c > b: return c  answered 04 Mar '12, 22:28 James Viebke 1.5k●2●18●31
 0 Same as Mainframe, except reusing a: def biggest(a,b,c): if a < b: a = b if a < c: a = c return a print biggest(1,2,3) print biggest(2,3,1) print biggest(3,1,2)  answered 07 Mar '12, 11:42 tcabeen 11●1
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,284
×70