Can you only pass only one float value in a string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

10th Sep 2019, 4:09 AM
EzireBlueFlame
EzireBlueFlame - avatar
3 Answers
+ 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.
10th Sep 2019, 6:00 AM
Lothar
Lothar - avatar
+ 3
EzireBlueFlame, i have put some samples and explanations together for you: https://code.sololearn.com/cdK3OAohCMN9/?ref=app
10th Sep 2019, 12:05 PM
Lothar
Lothar - avatar
0
You can pass as many as you want depending on how program will handle it.
10th Sep 2019, 4:45 AM
Seb TheS
Seb TheS - avatar