TDT4109/Exercise 1/11 - James Bond and Operati.../11-c.py

14 lines
369 B
Python

def getName():
while True:
name = input('Jeg heter: ')
if (' ' in name):
return name.split(' ')
print('Putt et mellomrom mellom fornavn og etternavn')
capitalize = lambda name: name.capitalize()
names = list(map(capitalize, getName()))
firstNames = ' '.join(names[:-1])
lastName=names[-1]
print(f'The name is {lastName}, {firstNames} {lastName}')