Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Fri Feb 21 15:04:42 2020
- @author Abdallah Wahidi : 202003090
- """
- listt = input("Enter the integers separated by a space.")
- L = listt.split()
- for i in range(0, len(L)):
- L[i] = int(L[i])
- maxx = L[0]
- a = 0
- b = 0
- for i in range(len(L)):
- for j in range(i, len(L)):
- summation = 0
- for k in range(i, j + 1):
- summation = summation + L[k]
- if summation > maxx:
- maxx = summation
- a = i
- b = j
- print(maxx)
- for i in range(a, b+1):
- print(L[i], end=' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement