A10 b4 c2 d3 ifabd c ifbc a bc printx else printy

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ement> 20 Handling mulGple cases with elif Start Check Forecast • If it is too cold (< ­20) we wear a Parka Max < -20? TRUE • If it is >=  ­20 but <  ­10 we wear a Jacket FALSE Wear Parka Max < -10? TRUE • If it is >=  ­10, we wear a shirt FALSE Wear Jacket Wear Shirt Display result Stop 21 7 13 ­09 ­16 Handling mulGple cases with elif Max < -20? TRUE FALSE Wear Parka Max < -10? TRUE FALSE Wear Jacket Wear Shirt 22 Which way is beKer? this one seems a LOT more readable 23 Control Flow Summary • We have seen 3 ways to control flow in our programs so far:   1. if/else   2. if without else   3. elif (must have an if; else is op=onal) • There are more! … but we’ll see them later 24 8 13 ­09 ­16 What’s the output? a=10 b=4 c=2 d=3 if((a+b)>=(d...
View Full Document

Ask a homework question - tutors are online