Python Using Lists to create program
Question: I have an assignment in class to write a program using lists in Python

"Create a program that prompts the user for a vocabulary word. Then prompts
user to enter the word's definition. Ask user if they want to enter more words
and definitions. When they are done entering all words and definitions, print
out all the words along with their definition."

I know I need to have a nested list to store the user input. But my question
is how am I going to get the user input and store it into a nested list? I
also know that I need to use a loop to take in all the inputs for words and
definitions, but I'm confused on how to do so.

* * *
    
    
    myvar=str(print(input("Type a Word.")))
    myvar2=str(print(input("Type the word's definition.")))
    myvar3=input(print("If you want to enter another word, enter Y, if not enter N"))
    mylist=[[myvar,myvar2]]
    while myvar3=='Y':
        myvar4=str(print(input("Enter your next word.")))
        myvar5=str(print(input("Enter the word's definition.")))
        mylist.append([myvar4,myvar5])
        myvar3=input(print("If you want to enter another word, enter Y, if not enter N"))
    
    print(mylist)  
    

I think this works, is there anything wrong with this? Do I need to make it to
where if they enter "N" it does something to end the loop? Or does the loop
just end as long as it doesn't equal 'Y'?


Answer: If you're using Python 3.x, getting input from a user is very simple. This is
accomplished using the input() function.

This will prompt input from the user, printing the string passed to input()
before the caret:

    
    
    input("Please enter a word: ")
    

The user types whatever they feel, then hits Enter. When they hit enter,
input() _returns_ the text they've entered. So, you can store the value the
user typed with something like this:

    
    
    user_word = input("Please enter a word: ")
    

And a definition can be entered into a separate variable like this:

    
    
    user_definition = input("Please enter a definition: ")
    

Then, you can use one of Python's built-in data types to store both values,
and, just as importantly, to build a logical association between them, before
you prompt them for their next word.

Here's the documentation on the [input and
output](http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/io.html).

