import cs50 c = cs50.get_char() if c == 'y' or c == 'Y': print('Yes') elif c == 'n' or c == 'N': print('No') else: print('Error')
# Logical Operators from cs50 import get_char # Prompt user for answer c = get_char("answer: ") # Check answer if c == "Y" or c == "y": print("yes") if c == "N" or c == "n": print("no")
from cs50 import get_char # If you write more than one character it prompts you forever c = get_char("Yes or no?: ") if c == 'Y' or c == 'y': print("Yes") elif c == 'N' or c == 'n': print("No") else: print("Invalid response. You must write one of these characters: YyNn")
from cs50 import get_char char = get_char("Answer: ") if char == "Y" or char == "y": print("Yes") elif char == "N" or char == "n": print("No") else: print("Invalid input")
import cs50 c = cs50.get_char() if c == "Y" or c == "y": print("yes") elif c == "N" or c == "n": print("no") else: print("error")