jeudi 5 mai 2022

How to save input in dictionary (but separate the words when there's a space)?

dict = {}
name_surname = input("Enter your name and surname: ").split(" ")
dict["Name and surname"] = name_surname
print(dict)

I need to make it so that when the user inputs their name and surname (example: Michael Jokester Scott), it will separate the name and the username, so I can use each of them later.

The purpose of this is to be able to take a randomized combinations of someones name and surname(s) and append a "@gmail.com" at the end. This way you get "randomized," but personal email address. So in the end, I should be able to make a randomized email such as: "jokester.scott.michael@gmail.com."

What I have so far is pretty bad, I'm new to Python and I don't really understand dict well, lists are easier for me, but I need to learn this as well.




Aucun commentaire:

Enregistrer un commentaire