G
G
Grigory Shurygin2021-11-02 11:39:26
Python
Grigory Shurygin, 2021-11-02 11:39:26

How to create a list using a user-entered word?

There is a need to create a new list in a loop, and besides, the name of the list must correspond to the word entered by the user.

x = input()
while x != "0":
    hellp = input("write any thing") 
    x = [hellp] #вот здесь нужно задать название списку
    print(x)
    x = input("write agan")
print("programm false")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SHADRIN, 2021-11-02
@avrio

I think you should use a dictionary

hellp  = input(...)
dict = {}
dict[hellp] = []
print(dict[hellp]) # Выведет содержание списка в данном случае пустой

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question