CMPT-101 Lecture 7: Decision Making

73 views1 pages

Document Summary

Computers can make decisions based off of conditions. Note: copy/paste the following directly into wingide for a functioning program. #the first step is to prompt user to get needed information. high_school=input("\ndid you complete high school (yes/no)? ") gpa=float(input("what is your gpa? ")) scholar=input("do you have a scholarship (yes/no)? ") #the second step is to set boolean variables. #note: if entered any differently than shown below, it will be considered false. #this is why the second boolean variable with the capital letter is entered. grade12=false if high_school=="yes" or high_school=="yes": grade12=true scholarship=false if scholar=="yes" or scholar=="yes": scholarship=true. #but set it to true upon conditions. if grade12 and (scholarship or gpa>=3. 0): admit=true. #then rewrite if-else. if admit: if not admit: print("\ncongratulations!

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents