fraction = list(input("Enter: "))
print(fraction)
When Inputting "99/100" I wanted it to print ["99", "/", "100"] not [‘9’, ‘9’, ‘/’, ‘1’, ‘0’, ‘0’]
>Solution :
You can use ".split" for this, for example:
thing1 = "abcdef"
thing1.split("c")
Gives the output:
['ab', 'def']
If you’re bored and fancy fighting some spaghetti code for your own interest, it can be a fun challenge to code something equivalent to ".split()" yourself. Doing so gets you thinking about how Python works and trying to do it in the smallest big-O can introduce you to some interesting stuff about strings, arrays, and algorithm efficiency.