Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Python: I need help writing a code that reads a text file then answers the following questions:

1. How many girl babies have been born since 1910?

2. How many boy babies have been born since 1910?

3. How many girl babies were born 1910? In 2012?

4. How many boy babies were born in 1910? In 2012?

5. What are the total number of babies born in Texas in 2012?

6. What are the total number of babies born in Texas with your name since 1910?

7. What are the total number of babies born in Texas with your name between 1910 and 1960? If you have a very uncommon name, feel free to pick any name that you might be curious about.

8. What name was the most popular (had the highest count in one year): * For males * For females

9. What name was that? * For males * For females

10. What year was that? * For males * For females

11. In what year was your name the most popular (had the highest count)?

THIS IS MY CODE:

text_file = open("TXBabyNames.txt", "r")
lines = text_file.readlines()
print lines
print len(lines)
text_file.close()

def check():
datafile = file('TXBabyNames.txt')
found = False
for line in datafile:
if 1910 in line:
found = True
break

return found

found = count()
if found:
print lines
else:

The Text File is a list of years with names.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93100284

Have any Question?


Related Questions in Computer Engineering

Espn pays the nfl 11 billion per year for 8 yrs for the

ESPN pays the NFL $1.1 Billion per year for 8 yrs for the right to exclusively televise football. What is the NPV of the investment if the parent Disney CO has an opportunity interest rate that is equal to the cost of ca ...

Recursive greatest common divisor the greatest common

(Recursive Greatest Common Divisor) The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. what is a recursive function gcd that returns the greatest common divisor of x ...

Let sigmaab give the transition diagram for a

Let Σ={a,b}. Give the transition diagram for a nondeterministic ?nite state machine that accepts the set of strings in {a,b}∗ that contain a substring of length four that begins and ends with the same symbol. For example ...

Search the internet for information regarding the

Search the Internet for information regarding the interaction between web browser and web server using HTTPS from initial handshake to close of the session. Create a detailed drawing of the steps and also annotate each s ...

Can someone help me identify how intrustion detection

Can someone help me identify how Intrustion detection system and intrusion prevent system can help protect confidentiality, integrity and availability

Question having a strong statistical picture of data is

Question : Having a strong statistical picture of data is important to being able to properly identify trends in statistical analysis. In R, how can an analyst identify appropriate sample distributions and test for norma ...

Imagine you are employed by a large city police department

Imagine you are employed by a large city police department as the leader of the digital forensics division. A large corporation in the city has contacted the police for assistance in investigating its concerns that the c ...

Question creating an interface please respond to the

Question: "Creating an Interface" Please respond to the following: • Imagine you are managing a design project that will create an interface for automobile mechanics. The interface would be used by the mechanics to look ...

Assessment - managing services and securitytask - in this

Assessment - Managing Services and Security Task - In This Assignment your job is to create two Virtual machines each running a different but the latest distribution of Linux e.g. Ubuntu Server and CentOS. Each of these ...

Storing the integer 5 value in a binary file 00000000

Storing the integer 5 value in a binary file: 00000000 00000000 00000000 00000101, How do you write value5 to this formation 0000101? Storing the integer 5 value in a text file: 00110101, How do you write value5 to 00110 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As