python function

Practice for function

  • Question: Enter your name and print name with the greeting using function.
1
2
3
4
5
6
7
8
def greeting(n):
if n.isalpha():
return "Dear " + name + ", Hello!"
elif n.isdigit() or n.isalnum():
print('Is it your name?')

name = str(input("Please input your name: "))
greeting(name)