2021年4月25日星期日

How do I store the results of each iteration of a for loop inside a variable

I wrote the following code:

full_name = "John Francis Bean Coppola"  full_name_as_list = full_name.lower().split()    for name in (full_name_as_list):  a = name[0]  print(a)  

When I run print(a) It returns:

j  f  b  c  

I wanna define a variable like joined_results = something such that if I run print(joined_results) it returns:

jfbc  

The purpose of the code I'm trying to write is to extract the initials of a name to create an e-mail address. For example: John Francis Ford Coppola = jffc@gmail.com

https://stackoverflow.com/questions/67259674/how-do-i-store-the-results-of-each-iteration-of-a-for-loop-inside-a-variable April 26, 2021 at 09:06AM

没有评论:

发表评论