Question: Write a program that reads a sequence of numbers from the cmd that are separated by space. For example, 12 30 2 10 3 2

 Write a program that reads a sequence of numbers from the

Write a program that reads a sequence of numbers from the cmd that are separated by space. For example, 12 30 2 10 3 2 5 45 0 23 10 0 3 4 5 1 70 Look at the zeros as a separator. Each group creates a tuple. At the end, you should have a tuple of tuples. For above mentioned sequence, the result will be ((1,2,3), (2,1), (3,2,5,45), (23,10), (3,4,5,1,7)). After creating the tuple of tuples, find the longest tuple length(you can NOT convert it to the list to find the max length). In this example it is (3,4,5,1,7) which has a length of 5 H:>python C:\Users aslsabbaghpourhokma\Documents\IT2431\Exam1\test1-3.py 1 2 3 0 2 1 0 3 2 5 45 @ 23 10 0 3 4 5 1 7 0 ((1, 2, 3), (2, 1), (3, 2, 5, 45), (23, 10), (3, 4, 5, 1, 7)) The longest tuple length: 5 T Zeros are separatoil (1,2,3) (2,1) (3,2,5,45) (23,10) (3,4,5,1,7) H:\>python C:\Users aslsabbaghpourhokma\Documents\IT2431\Exam1\test1-3.py 1 2 3 0 2 1 0 3 2 5 23 10 0 ((1, 2, 3), (2, 1), (3, 2, 5), (23, 10)) The longest tuple length: 3 H:\>python C:\Users aslsabbaghpourhokma\Documents\IT2431\Exam1\test1-3.py 1 2 0 3 2 5 23 10 ((1, 2), (3, 2, 5), (23, 10)) The longest tuple length: 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!