conditionals-4

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

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

View Full Document Right Arrow Icon
Sep 13 2010 CMSC143 - O'Hara 1 CMSC 143 Making  Decisions Keith O’Hara kohara@bard.edu
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sep 13 2010 CMSC143 - O'Hara 2 Announcements Lab 2 – Scribbler Music due Tonight Assignment 2 – Team Performance due (by class) Monday Sep 27th
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

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

This note was uploaded on 10/14/2010 for the course CMSC 143 taught by Professor Keitho'hara during the Spring '10 term at Bard College.

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 Right Arrow Icon
Ask a homework question - tutors are online