Example #1
0
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')
Example #2
0
# 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")
Example #3
0
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")
Example #4
0
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")
Example #5
0
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")