# File: moveOn3.py # Author: Dr. Gibson # Date: 2/13/2017 # Section: N/A # E-mail: k.gibson@umbc.edu # Description: # This file contains python code that asks the user for # their major and grade, and prints out whether they are # eligible to move on to CMSC 202 in the next semester. # This version uses logical operators rather than # nested decision structures. def main(): # get major and grade from the user major = input("Please enter your major: ") grade = input("Please enter your grade: ") # for everyone, an A or B counts as passing the class if grade =="A" or grade == "B": print("Take 202") # use PARENTHESES to ensure that the parts of the # conditional are evaluated in the correct order elif grade == "C" and (major == "CMSC" or major == "CMPE"): # for CMSC and CMPE majors, a C is not enough to pass print("Take 201 again") # note that the OR above switched to an AND instead # they cannot be CMSC *AND* they cannot be CMPE majors elif grade == "C" and major != "CMSC" and major != "CMPE": # for all other majors, a C is enough print("Take 202") # any other grade does not count as passing, regardless of major else: print("Take 202") main()