Header Ads

Responsive Ads Here

Taking two or more inputs in one line in Python

Taking two or more inputs in one line in Python

 # first_name = input("Enter your first name: ")
# second_name = input("Enter your second name: ")

first_name,second_name = input("Enter your first name and "
            "second name separated with slash: ").split("/")

print(first_name)
print(second_name)

a,b,c = input("Enter values separated with comma").split(",")
print(a)
print(b)
print(c)


'''
You can not use this on integers
as split function does not work on integers.
You have to take input as string and
convert to integers afterwards.
'''
Powered by Blogger.