I need to do an email generator on python. once again im asking for assistance. I've attatched my code/what i've done so far. The assignment asks me to do the following: You will write a function email_generator() that creates email IDs for new members joining Cal Poly. This function must accept the member’s name as its only argument. An email ID for a member should contain five letters that are randomly picked from the member’s name, followed by the string “@calpoly.edu”. For generating random numbers, include the statement “import random” in your program. Once you do this, you can use the random.randint(0,N) statement to generate a random number between 0 and N (you will have to replace N with an appropriate integer value). Note that email IDs do not contain whitespaces. To ensure that the email IDs created for the new members do not contain whitespaces, you will need to remove whitespaces from the names. This can be done using the in-built replace(" ", "") function. For e.g., the replace function can be invoked on a string name as name.replace(" ", ""), and it will return a new string whose elements are the same as the original string name, but with all whitespaces removed from it. Similarly, since the member names can contain upper case letters (upper case letters are not typically used in email IDs), you will have to convert the input to all lower case letters (hint: you can use name.lower() function to convert all letters in a string name to lower cases. Note that this function returns a new string). Call the email_generator() function for three new members to Cal Poly: “Ada Lovelace” “Grace Hopper” “Barbara Liskov” Your program must display the three email IDs created for the three new members.
I need to do an email generator on python. once again im asking for assistance. I've attatched my code/what i've done so far.
The assignment asks me to do the following:
You will write a function email_generator() that creates email IDs for new members joining Cal Poly. This function must accept the member’s name as its only argument.
An email ID for a member should contain five letters that are randomly picked from the member’s name, followed by the string “@calpoly.edu”. For generating random numbers, include the statement “import random” in your program. Once you do this, you can use the random.randint(0,N) statement to generate a random number between 0 and N (you will have to replace N with an appropriate integer value).
Note that email IDs do not contain whitespaces. To ensure that the email IDs created for the new members do not contain whitespaces, you will need to remove whitespaces from the names. This can be done using the in-built replace(" ", "") function. For e.g., the replace function can be invoked on a string name as name.replace(" ", ""), and it will return a new string whose elements are the same as the original string name, but with all whitespaces removed from it. Similarly, since the member names can contain upper case letters (upper case letters are not typically used in email IDs), you will have to convert the input to all
lower case letters (hint: you can use name.lower() function to convert all letters in a string name to lower cases. Note that this function returns a new string).
Call the email_generator() function for three new members to Cal Poly:
“Ada Lovelace”
“Grace Hopper”
“Barbara Liskov”
Your program must display the three email IDs created for the three new members.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images