multiple input at once in python | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

multiple input at once in python

Can someone please explain me how to take input of several variables from user in one line.

14th Jul 2018, 6:58 AM
Mohibullah Bukhari
Mohibullah Bukhari - avatar
10 Antworten
14th Jul 2018, 7:19 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 8
Use appropriate type conversion for needed inputs
14th Jul 2018, 7:21 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 7
Wasn't what I did an example. Let me put that into use in an example code sokn.
14th Jul 2018, 7:13 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
For example, input_list=input().split() #gets a list of strings
14th Jul 2018, 7:11 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
You can take in inputs separated by spaces then split
14th Jul 2018, 7:10 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
can you please give an example of this
14th Jul 2018, 7:12 AM
Mohibullah Bukhari
Mohibullah Bukhari - avatar
+ 1
i understood that, thank you
14th Jul 2018, 7:14 AM
Mohibullah Bukhari
Mohibullah Bukhari - avatar
+ 1
i wanted ask about integers and floats
14th Jul 2018, 7:15 AM
Mohibullah Bukhari
Mohibullah Bukhari - avatar
+ 1
thank you so much
14th Jul 2018, 7:20 AM
Mohibullah Bukhari
Mohibullah Bukhari - avatar
0
ok
14th Jul 2018, 7:26 AM
Mohibullah Bukhari
Mohibullah Bukhari - avatar