Python Code to Help Memorizing New Foreign Words

        Nowadays, I am trying to improve my German. I set myself a goal to learn new German words which is 160 words a week. Usually I work by myself first and when I feel ready, I ask help from my sister for asking me the words but sometimes it is ineffective. So, I decided to write a Python code to create a tireless study partner. I wrote it with PyCharm.
        You can find the comments and instructions in code. I will update the code in the future. I know that my comment lines are not solid. I will update them in the future. If you have any suggestion, you can comment down below.
    
        Edit: I changed the code a little bit. According to word's row, it will ask you the meaning's of the words and you will write the word itself. Also, the correct answers won't be asked until all the answers are correct. I put it under the old one. Enjoy!

    
from random import randint # to get function for generating random integer values


# empty lists for words and their meanings
words = list()
meanings = list()

# to get word number from the user
i = int(input("Please enter the number of words: "))
a = 0

# to get words and their meanings from the user
while a < i:
words.insert(a, input("Please enter the {}. word: ".format(a+1)))
meanings.insert(a, input("Please enter the first {}. word's meaning: ".format(a+1)))
a += 1

# to create a gap between inputs and questions to prevent cheating
j = 0
b = 12
while j < b:
print("")
j += 1

print("Type 'end' to close program")
print("")

# to ask words one by one to user
a = 0
while a < i:

value = randint(0,i-1) # to reach random row

answer = str(input("Please enter the {}'s meaning: ".format(words[value])))

if answer == meanings[value]: # if the answer is true
print("That is correct")
print("")
a += 1
if a == i: # this "if" keeps active the program for you to practice over and over
a = 0
elif answer == 'end': # to finish program
break
else: # if the answer is false
print("WRONG")
print("The right answer is {}. ".format(meanings[value]))
print("")



"""
To do list
-Deleting the correct answers to prevent repetition of words DONE!
-Returning back to the top when all the answers are correct DONE!
-Changing the words or meanings before the practice start in case of miswrites
"""

# 01100010 01100101 01110010 01101011 01100001 01111001


Edit1
# generate random integer values
from random import randint

# empty lists for words and their meanings
words = list()
meanings = list()
correct = list()

# to get word number from the user
i = int(input("Please enter the number of words: "))
a = 0

# to get words and their meanings from the user
while a < i:
words.insert(a, input("Please enter the {}. word: ".format(a+1)))
meanings.insert(a, input("Please enter the first {}. word's meaning: ".format(a+1)))
a += 1

# creating a space to prevent cheating
j = 0
b = 12
while j < b:
print("")
j += 1

print("Type 'end program' to close program")
print("")

# to ask words one by one to user
a = 0
while a < i:

value = randint(0,i-1) # to reach random row

if len(correct) == i: # to start again when all the answers are correct
print("All done! Let's start again.\n")
print("--------------------------------\n")
correct.clear() # this will clear the correct answer list to start from the beginning

if value in correct: # if the new word's number is in the correct answer list,
continue # code will continue from the randint func.

# if the word's row is even number, program will ask you the word's meaning
# if the word's row is odd number, program will give you the meaning and ask you word's itself
elif value % 2 == 0:

answer = str(input("Please enter the {}'s meaning: ".format(words[value])))
if answer == meanings[value]: # if the answer is true
print("That is correct")
print("")
a += 1
correct.append(value) # if the answer is correct,
# this line will add it to correct word list to prevent repetition.
if a == i: # this if keeps active the program for you to practice over and over
a = 0
elif answer == 'end program': # to finish program
break
else: # if the answer is false
print("WRONG")
print("The right answer is {}. ".format(meanings[value]))
print("")

elif value % 2 == 1:

answer = str(input("Please enter the {}'s meaning: ".format(meanings[value])))
if answer == words[value]: # if the answer is true
print("That is correct")
print("")
a += 1
correct.append(value)
if a == i: # this if keeps active the program for you to practice over and over
a = 0
elif answer == 'end program': # to finish program
break
else: # if the answer is false
print("WRONG")
print("The right answer is {}. ".format(words[value]))
print("")


"""
To do list
-Deleting the correct answers to prevent repetition of words DONE!
-Returning back to the top when all the answers are correct DONE!
-Changing the words or meanings before the practice start in case of miswrites
"""

# 01100010 01100101 01110010 01101011 01100001 01111001

Comments