Programming-Challenges/02 Variables and Assignment/exercise-03.py

16 lines
537 B
Python

name = input("Please enter your name: ").split(" ")
forename = name[0]
surname = name[-1] # handle the case where a middle name is supplied
age = int(input("How old are you? "))
height = int(input("How tall are you (cm)? "))
def display_info(forename, surname, age, height):
print(f"Hello {forename.capitalize()} {surname.capitalize()}! You are {age} years old and {height}cm tall.")
# uthman fatih to ufatih
print(f"Your username is {forename.lower()[0]}{surname.lower()}")
display_info(forename, surname, age, height)