File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2-
32import json
43import random
54
@@ -16,6 +15,16 @@ def print_choices(choices):
1615def is_correct (ans , user_answer ):
1716 return ans == str (user_answer )
1817
18+ def get_greeting_msg (points , total_qns ):
19+ ans_percentage = int ((points / total_qns ) * 100 )
20+ result_msg = 'You got {} / {} questions!' .format (points , total_qns )
21+ if ans_percentage <= 25 :
22+ return 'Not so impressive.😟 ' + result_msg
23+ elif ans_percentage <= 75 :
24+ return result_msg + ' Almost! Rewatch probably? 🙄'
25+ else :
26+ return result_msg + ' TRUE GOT HEAD 🐺'
27+
1928def start_quiz ():
2029 questions = get_questions ()
2130 points = 0
@@ -28,10 +37,10 @@ def start_quiz():
2837 points += 1
2938 else :
3039 print ('✘' )
31- print ('You got {}/{} questions correct. Hooray' . format (points , len (questions )))
40+ print (get_greeting_msg (points , len (questions )))
3241
3342
34- if __name__ == " __main__" :
43+ if __name__ == ' __main__' :
3544 canPlay = input ('Press y/Y to play the Game of Thrones quiz 🦁\n ' )
3645 canPlay = str (canPlay ) == 'y' or str (canPlay ) == 'Y'
3746 start_quiz () if canPlay else exit (- 1 )
You can’t perform that action at this time.
0 commit comments