File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ words  =  {
2+ }
3+ 
4+ newWord  =  "" 
5+ newDefintion  =  "" 
6+ print ("Welcome to a quizzing app! Let's start by adding words to our vocabulary, to start quizzing enter a new word with the name \" stop!\" " )
7+ while (newWord  !=  "stop!" ):
8+     newWord  =  input ("What is the word?: " ) 
9+     if  newWord  ==  "stop!" : break 
10+     newDefintion  =  input (f"What is the definition of { newWord }  )
11+     words [newWord ] =   newDefintion 
12+ 
13+ 
14+ redo  =  []
15+ score  =  0 
16+ 
17+ 
18+ def  checkWord (word , uInput ):
19+     if (uInput .lower () ==  words .get (word ).lower ()): return  1 
20+     elif (uInput  ==  "skip"  or  uInput  ==  None  or  uInput  ==  "" ): return  0 
21+     else : return  - 1 
22+ 
23+ print ("welcome" )
24+ 
25+ 
26+ 
27+ for  word  in  words :
28+     userInput  =  input (f"What is the definition of { word }  ).lower ()
29+     result  =  checkWord (word , userInput )
30+     match  result :
31+         case  - 1 :
32+             print (f"Wrong answer. The answer was: { words .get (word )}  )
33+         case  0 :
34+             print (f"Skipped! The answer was: { words .get (word )}  )
35+             redo .append (word )
36+         case  1 :
37+             score  +=  1 
38+             print ("correct +1" )
39+ 
40+ if  redo : 
41+     for  skip  in  redo :
42+         userInput  =  input (f"What is the definition of { skip }  ).lower ()
43+         result  =  checkWord (skip , userInput )
44+         match  result :
45+             case  - 1 :
46+                print (f"Wrong answer. The answer was: { words .get (skip )}  )
47+             case  0 :
48+                 print (f"Wrong answer. The answer was: { words .get (skip )}  )
49+             case  1 :
50+                 score  +=  1 
51+                 print ("correct +1" )
52+ 
53+ print (f"Your score is: { score } { len (words )}  )
54+ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments