Python assignment

profilemadara10
  1. py (30 points)

Write a program that will except a range of 20 numbers from the user and then populate the list with entered numbers. It will also calculate the min. max, total, and average (math functions) of those numbers.

Hints:

Define main () program

Create number_list (This list will contain how many number you want your program to loop through) 

Declare variables

Use a For loop to populate the number_list.

Print out the min. max, total, and average formatted with 2 decimal precisions.

  1. py (40 points):

Write a program that will read a data file calculates which contains sentences (text file).  Then count the total number of words in the file. Calculate the average and print it out.

Hints:

Define main() program

Declare variables

Save the given data file under the same folder as your program file is

Open file

User infile.readlines() to read data into a list of sentences (Each item in the list is one sentence)

Use len(sentence_list) to get length of the sentence list. (num of sentence is equal to the length of sentence list

Use a For loop to number of items (word) in the sentence. For loop will collect the Total words.

Calculate the average and print

  1. py (30 point)

Write a program to read a text file. Determine if the character is uppercase, lowercase, a digit, or space, and keep a running total of each.

Hints

Define main() program

Declare variables

Save the given data file under the same folder as your program file is.

Open file

Use a For loop to read data and verify with if statement or if/elif statement

Print out the total of is uppercase, lowercase, a digit, and space characters in the file

  • Posted: 5 days ago
  • Due: 
  • Budget: $20
Answers 1

Purchase the answer to view it

blurred-text