Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The primary purpose of this chapter is how to handle list. Always using list(s)

ID: 3764422 • Letter: T

Question

The primary purpose of this chapter is how to handle list. Always using list(s) while you are working with this section by calling newly created function. A triple quoted string after the def, docstring, is required for your function documentation. Your program also expected to have an exception handle invalid input. You need put your function in a loop. Work with Census Data Use urpop0090.txt, that is download from censussdata website to find out the total population with the minimum and maximum. The census file is a text file with data for the 10-year census from 1900 to 1990 (e.g., 1900, 1910, 1920,...). It has population data for each state as well as regional and overall data. Each state is on its own line, but the data are grouped so that only three decades of data are on each line - complication the task of extracting the data. In addition, the data are further broken down into total, urban, rural, and percentages. Wrap function call in a loop so that it can be continuous check for different year.

Explanation / Answer

import sys

def minimum(l):
   mn = sys.maxint
   for ch in l:
       for val in ch:
           mn = min(val,mn)
   return mn

def maximum(l):
   mx = -1
   for ch in l:
       for val in ch:
           mx = min(val,mx)
   return mx  

def main():
   file = open('urpop0090.txt','r')
   l = []
   for line in file:
       l.append(raw_input().split())
   print(minimum(l))
   print(maximum(l))

main()

since file is not privided, consider it of this formar
A1 b1 c1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote