MatteB_01

sottostringhe

Nov 21st, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. stringa = input("inserisci una parola")
  2. def sottostringhe(stringa):
  3. numero =1
  4. inizio = 0
  5. lista = []
  6.  
  7. while inizio != len(stringa)-1:
  8. while numero < len(stringa):
  9. sottostringa = stringa[inizio:numero]
  10. lista.append(sottostringa)
  11. numero += 1
  12. inizio +=1
  13. return lista
  14.  
  15. print(sottostringhe(stringa))
Advertisement
Add Comment
Please, Sign In to add comment