+ 1
Python assign float to text from input
Hi I am a complete novice need to understand this, what am I doing wrong. I want to assign a value to text from user input (multiple values to multiple texts) https://code.sololearn.com/cIc6nade89yC/?ref=app
4 Respostas
+ 5
Hi.
You will have to split the user's input. Assuming the values are whitespace separated use the following
a = input ().split(" ")
Assigning the result of the print() command to a variable does not help much in your case. Remove the print() in the lines where you assign the variables and do the conversion to float there, like
x = float(a[1])
This should do the trick.
Cheers.C
+ 9
a = list(map(float, input().split()))
p, r, n = a
+ 3
In too late as your question is already answered but, here is how I fixed it.
https://code.sololearn.com/cK9Fsz6RK90F/?ref=app
+ 1
Thanks for the help, will give it another go