Reputation: 153
I want to ask subjects to type in first a float number ( like 3.666) followed by an integer. what i did is:
x,y = input ( " Please enter two numbers"). split ()
and then converted
x,y =[ float (x), int (y)]
It does not work-are there any suggestions?
Upvotes: 1
Views: 2799
Reputation: 744
You have to scan them as a string, separate it by space as delimiter and then typecast them to their corresponding types.
s = raw_input("Please enter two numbers: ")
x,y = s.split(" ")
x = float(x)
y = int(y)
Hope that helps :)
Upvotes: 1