How to convert string into slice strings then convert it to integer in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to convert string into slice strings then convert it to integer in python?

If input = 1 0 1 I need to assign such that a=1 ,b=0,c=1

20th Apr 2022, 8:27 AM
Mahmoud Khairy
Mahmoud Khairy - avatar
8 Answers
21st Apr 2022, 4:29 AM
mohammed shibli
mohammed shibli - avatar
+ 3
Try split() method
20th Apr 2022, 9:01 AM
Simba
Simba - avatar
+ 1
To convert string to integer use int() function.
20th Apr 2022, 12:23 PM
Ромари
Ромари  - avatar
0
The user who assign ,am not , Example I prepare the program that St=input() And I need from user to assign number such as 1 0 1 In c++ if user assign 1 0 1 I deal with this by cin>>a>>b>>c; I don't know like it in python
20th Apr 2022, 8:35 AM
Mahmoud Khairy
Mahmoud Khairy - avatar
0
https://code.sololearn.com/c2QNJXXug4UJ/?ref=app Sorry am new person joined to community,and am not good deal with tools in program
20th Apr 2022, 8:47 AM
Mahmoud Khairy
Mahmoud Khairy - avatar
0
you can sum up strings. Convert them first
20th Apr 2022, 8:48 AM
Slick
Slick - avatar
0
Yeah ,how
20th Apr 2022, 8:50 AM
Mahmoud Khairy
Mahmoud Khairy - avatar