Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program should use a main function and two other functions named playlist and savelist as follows: The main function: The main function should create

This program should use a main function and two other functions named playlist and savelist as follows: The main function: The main function should create an empty list named nums and then use a loop to add ten integers to nums, each integer in the range from 10-90. NOTE: In Python, a list is a data type. See Chapter 7. The main function should then call the playlist function and savelist function, in that order. Both of these functions take the nums list as a sole argument. The playlist function: playlist should use a loop to display the elements of the list, all on one line separated by a single space. playlist should also determine and print the total of the even numbers and the total of the odd numbers. The savelist function: save list should sort the list and write each element to a text file named angles.txt, each element on its own line.

SAMPLE OUTPUT

Here are the integers in nums:

23 85 31 55 42 85 72 33 39 20

Even integers total to 134

Odd integers total to 351

List of integers was written to file.

End of program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions