(May-27-2018, 02:01 PM)baobei Wrote: Use a multiple assignment to add the prefix before the given first name and the suffix after the given last name, then print the full name. The string value in first should include the prefix, and the string value in last should include the suffix.
Remember
Add spaces between the words!
Hi!
You could use something like:
import random
print(f"These are some possible random names:\n")
for x in range (25):
prefix = random.choice(['Sir', 'Mr', 'Dr', 'Lord', 'Captain'])
first = random.choice(['Alexis', 'Ashley', 'Casey', 'Jordan', 'Taylor'])
last = random.choice(['Smith', 'Jones', 'Davies', 'Evans', 'Wilson'])
suffix = random.choice(['Sr', 'Jr', 'II', 'III', 'IV'])
print(f"{prefix} {first} {last} {suffix}.")
and that produces random names outputs like the following one:
Output:
These are some possible random names:
Captain Jordan Wilson Sr.
Dr Taylor Davies III.
Captain Ashley Evans Jr.
Dr Ashley Davies III.
Captain Ashley Wilson Jr.
Dr Jordan Davies IV.
Captain Alexis Evans Jr.
Sir Alexis Jones II.
Dr Casey Jones Jr.
Dr Jordan Jones III.
Dr Ashley Davies Sr.
Dr Ashley Davies II.
Sir Ashley Wilson Jr.
Mr Jordan Wilson Sr.
Captain Jordan Davies Sr.
Captain Taylor Jones Jr.
Captain Casey Smith IV.
Dr Casey Evans Sr.
Lord Ashley Evans II.
Mr Ashley Davies IV.
Sir Alexis Smith Jr.
Captain Taylor Wilson III.
Mr Ashley Davies II.
Captain Taylor Smith Sr.
Dr Taylor Davies IV.
>>>
All the best,