Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python only Numbers and counting are an integral part of everyone's daily life. The earliest known number system is the Mesopotamian base 60 system (3400
Python only
Numbers and counting are an integral part of everyone's daily life. The earliest known number system is the Mesopotamian base 60 system (3400 BC), and the Egyptians' system of hieroglyphs is the first known base 10 system (3100 BC). Nowadays, numbers are part of every discipline in science, from quantum mechanics to biology to music. Numbers are one of the simplest yet most impactful inventions of human history. To appreciate the role of numbers, in this part of the assignment, you write a program, called M1C2S3, to work with numbers. M1C2S3 task is finding the contiguous subsequence that has the largest sum in a sequence of numbers. Given k numbers n1,n2,n3,,nk1,nk, M1C2S3 should detect consecutive numbers ni,ni+1,,nj1,nj which their summation is the greatest compared to any other consecutive numbers in the list. For example in the following list of numbers, the red box shows the contiguous subsequence producing the largest sum: [4,3,4,1,7,1,5,3] L1S2C3 works as follows: - M1C2S3 takes a positive integer n as the first input which determines the number of integers that the program is supposed to receive from the user. - Subsequently, M1C2S3 receives the n integers in separate lines. Note that the user-provided numbers can be positive or negative. - M1C2S3 does the processing and prints out the largest sum that can be obtained from the contiguous subsequence of the given list of integers in a new line. Four examples are shown in table 2. As seen in example 1, the user first entered 8 which means M1C2S3 should receive 8 numbers from the users in separate lines. Next, the user entered the integers 2,3,4,1,2,1,5,3 in separate lines. Finally, M1C2S3 identifies the contiguous subsequences with the largest sum and prints it out. For this example, the largest sum is 7 and M1C2S3 prints 7 in a separate line. You are free to use the modules introduced during the semester to solve the problem. Note that your program input and output format should be exactly the same as the format of the examples shown in Table 2: The M1C2S3 Sample Input and OutputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started