CMPT-101 Lecture 7: Decision Making
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!