Question: Please solve using python programming. In Exercises 79 and 80, use the file USPres.txt discussed in Example 10 Example 10 True or False The following
Please solve using python programming.
In Exercises 79 and 80, use the file USPres.txt discussed in Example 10
Example 10 True or False
The following program illustrates the truth values of objects.
## Illustrate Boolean values. if 7: print("A nonzero number is true.") else: print("The number zero is false.") if []: print("A nonempty list is true.") else: print("An empty list is false.") if ["spam"]: print("A nonempty list is true.") else: print("The empty list is false.") [Run]
A nonzero number is true. An empty list is false. A nonempty list is true.
79. U.S. PresidentsWrite a program that places the names of the 44 presidents into a list and uses the list to determine the name of the sixteenth president. See Fig. 3.74.
The 16th president was Abraham Lincoln.
FIGURE 3.74 Outcome of Exercise 79.
81. Odometer ReadingsThe numbers appearing on a cars odometer range from 000000 to 999999. Write a program to determine the number of readings that contain the digit 1. See Fig. 3.76.
468,559 numbers on the odometer contain the digit 1.
FIGURE 3.76 Outcome of Exercise 81.
83. Supreme CourtThe following list contains the members of the U.S. Supreme Court at the beginning of 2015. Each name is followed by a letter giving the political party (Republican or Democratic) of the president who appointed them.
justices = ["Scalia R", "Kennedy R", "Thomas R", "Ginsburg D", "Breyer D", "Roberts R", "Alito R", "Sotomayor D", "Kagan D"]
Write a program that creates two lists (one of Democratic appointees and one of Republican appointees) and uses the lists to produce the output shown in Fig. 3. 78.
Democratic appointees: Ginsburg, Breyer, Sotomayor, Kagan Republican appointees: Scalia, Kennedy, Thomas, Roberts, Alito
FIGURE 3.78 Outcome of Exercise 83.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
