I am trying to take the user input and use the if else function to base the outcome on it.
This input is a name and if it's a string, the output should be the text 'What a beautiful name you have'
and if it is a int or a float, the output should be 'Sorry , please enter a name'
. But if I enter either an int or a str both outputs are 'What a beautiful name you have'
. What should I do? Here is my code:
name = input("What is your name?")
if type(input) is str:
print("What a beautiful name you have!")
elif type(input) is int or float:
print("Sorry, enter a proper name")