fork(2) download
  1. number = 343703 # Replace ??? with a value of your choice.
  2. sequence_len = 3 # Replace ??? with a value of your choice.
  3. numbstr = str(number)
  4. digitlist = []
  5.  
  6. # Appending all the numbers to a list
  7. for digit in numbstr:
  8. digitlist.append(int(digit))
  9.  
  10. # Looping over all the variables in digitlist, i is the index
  11. for i, _ in enumerate(digitlist):
  12. # If the index, i is 2 less than the length of the list
  13. if i < len(digitlist) - 2:
  14. # Adding the term and the next two terms after that
  15. if digitlist[i] + digitlist[i+1] + digitlist[i+2] == 10:
  16. # Printing the list
  17. print digitlist[i:i+3]
Success #stdin #stdout 0.01s 7896KB
stdin
Standard input is empty
stdout
[3, 4, 3]
[3, 7, 0]
[7, 0, 3]