GITLAB

Miguel Barão / perguntations

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Issues 1
  • Merge Requests 0
  • Wiki
  • perguntations
  • demo
  • correct-question.py
  • 1da435f2   Documentation updates and changed the python3.4 to python3 so that other versions can be used Browse Code »
    Miguel Barao
    2016-02-02 14:55:02 +0000  
correct-question.py 299 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/env python3

import re
import sys

s = sys.stdin.read()

# set of words converted to lowercase lowercase
answer = set(re.findall(r'[\w]+', s.lower()))

# correct set of colors
rgb_colors = set(['red', 'green', 'blue'])

if answer == rgb_colors:
    print(1.0)
else:
    print(0.0)
exit(0)