0
Can you only pass only one float value in a string?
I've been trying to pass this code float(input("40 ")) + float(input("2 ")) but the only number that appears is 40 i'm curious if im only able to pass one float value in a program?
4 Respostas
+ 4
To get 2 input as float you can use:
a,b = map(float, input('inp').split())
or you can use more inputs by using a list to store this:
lst = list(map(float, input('inp').split()))
In both cases the values has to be entered by using a space to separate them.
+ 3
EzireBlueFlame, i have put some samples and explanations together for you:
https://code.sololearn.com/cdK3OAohCMN9/?ref=app
0
You can pass as many as you want depending on how program will handle it.