{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

conditionals-4

# conditionals-4 - CMSC 143 Keith OHara Making Decisions...

This preview shows pages 1–7. Sign up to view the full content.

Sep 13 2010 CMSC143 - O'Hara 1 CMSC 143 Making  Decisions Keith O’Hara [email protected]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sep 13 2010 CMSC143 - O'Hara 2 Announcements Lab 2 – Scribbler Music due Tonight Assignment 2 – Team Performance due (by class) Monday Sep 27th
Sep 13 2010 CMSC143 - O'Hara 3 Conditionals 1) Gather Ingredients 2) Combine sugar (N tbs), salt (N tbs), olive oil (N tbs), flour (N c) in mixing bowl 3) Turn on mixer 4) Add N/4 cup of flour 5) 6) Knead 15 minutes 7) Let rest for at least 45 minutes in warm area Conditional N dough balls Execute statements when boolean expression is true

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sep 13 2010 CMSC143 - O'Hara 4 Conditionals if getBattery() < 6: print “Battery Low” x = 23 if x != 0: print “Nonzero Number” password = “robots” v = raw_input(“Enter password”) if (v == password): print “permission granted Inde nt Execute statements when expression is true Boolean expressions
Sep 13 2010 CMSC143 - O'Hara 5 Boolean Expressions Evaluate to True or False Comparison and Equality Operations == Equals != Not equal < Less than > Greater than <= Less than or equal to >= Greater than or equal to 1 + 1 == 2 “CMSC143” == “CMSC143” 4 < 6 “A” < “L” “A” <= “L” 5.0 != 6.0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sep 13 2010 CMSC143 - O'Hara 6 Otherwise … if getBattery() < 6: print “Battery Low” else: print “Battery OK”
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 20

conditionals-4 - CMSC 143 Keith OHara Making Decisions...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online