name = input().strip() print("\n".join(name[i: i + j] for i in range(len(name)) for j in range(1, len(name) + 1 - i)))
Python Program For Finding Sub String Of Given String
Python Program For Finding Sub String Of Given String
|
May-08-2020, 09:15 AM
(This post was last modified: May-08-2020, 09:16 AM by pyzyx3qwerty.)
Strange, It isn't working for me.
![]()
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela Need help on the forum? Visit help @ python forum For learning more and more about python, visit Python docs
May-08-2020, 03:11 PM
works when I try it (from interactive python)
Python 3.8.1 (default, Dec 19 2019, 16:08:07) [GCC 7.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> name = input().strip() harry >>> print("\n".join(name[i: i + j] for i in range(len(name)) for j in range(1, len(name) + 1 - i))) h ha har harr harry a ar arr arry r rr rry r ry y >>>and from script: (venv) src$ python pjscript.py harry h ha har harr harry a ar arr arry r rr rry r ry y
May-08-2020, 03:26 PM
Wait, its supposed to do that? Then it works for me. I didn't know what it was supposed to do. My bad :)
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela Need help on the forum? Visit help @ python forum For learning more and more about python, visit Python docs |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
recursion used to convert string into sum | fred1232 | 0 | 2,211 |
Nov-08-2021, 10:33 PM Last Post: fred1232 |
Users browsing this thread: 1 Guest(s)