Inputs into variables | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Inputs into variables

How can I write a program which transforms the first user input in a name of a variable and the second one in its argument? for example: first_user_input = input("Write something... ") Write something... horse second_user_input = input("Write something... ") Write something... animal with four legs horse = animal with four legs I hope I have been clear enough. thanks a lot to everyone

16th Apr 2020, 4:06 PM
Alessandro
1 Réponse
0
I am not sure if this is possible. But instead you could use a dictonary for collecting key-value pairs: dict = {} input1 = ... input2 = ... dict[input1] = input2
16th Apr 2020, 4:38 PM
Lisa
Lisa - avatar