Question

Problem 2 (3 points): The file movie_data.txt (attached below) contains information about popular movies from 2015. Specifica
0 0
Add a comment Improve this question Transcribed image text
Answer #1

main.py saved data in the file 1 12 june 2015 Jurassic World 1670400637 Colin Trevorrow 2 13 Aug 2015 Test movie 123001340 Te

''' data in the file

12 june 2015 Jurassic World 1670400637 Colin Trevorrow

13 Aug 2015 Test movie 123001340 Test director

13 Sep 2015 Test2 movie 1323001340 Test2 director

'''

def selectBillions(filename):

#open the file to read

readFile = open(filename,'r')

#open a file to write the output

outFile = open('bilions.txt','w')

#read the file line by line

for line in readFile:

#split the line with tab character

#be sure to check how many spaces your tab contains

#and put that many spaces in split function here mine is 2

line = line.split(' ')

#checking the line world wide gross which will be in 2 Index

if int(line[2].strip()) > 1000000000:

#write the title which is in 1 index to the file

outFile.write(line[1]+'\n')

#close the files

outFile.close()

readFile.close()

selectBillions('movie_data.txt')

Add a comment
Know the answer?
Add Answer to:
Problem 2 (3 points): The file movie_data.txt (attached below) contains information about popular movies from 2015....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2.) The data set named "HW 6.2" contains a random sample of 35 movies released in 2008 collected from the Internet Movie Database (IMDb). The goal of this problem is to explore if the informa...

    2.) The data set named "HW 6.2" contains a random sample of 35 movies released in 2008 collected from the Internet Movie Database (IMDb). The goal of this problem is to explore if the information available soon after a movie's theatrical release can successfully predict total revenue. All dollar amounts (i.e., variables "Budget", "Opening", and "USRevenue") are measured in millions of dollars. . Investigate the relationship between the explanatory variable "Budget" and response variable "USRevenue" by doing the following: a....

  • Here is the database file: -------------------------moviedatabase.sql------------------------- INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (1,'Idrissa Akuna ','Elba','4706091972','Ac

    Here is the database file: -------------------------moviedatabase.sql------------------------- INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (1,'Idrissa Akuna ','Elba','4706091972','Actor','1972-09-06 00:00:00','CA'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (2,'Christopher Hemsworth','Hemsworth','3408111983','Actor','1983-08-11 00:00:00','IL'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (3,'Zoe ','Saldana','4106191978','Actor','1978-06-19 00:00:00','AZ'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (4,'Christopher','Townsend','3903251976','Visual Effects','1976-03-25 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (5,'Guy','Williams','3209211985','Reviewer','1985-09-21 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (6,'Jonathan','Fawkner','3011131990','Reviewer','1990-11-13 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (7,'Dan','Sudick','4701201972','Visual Effects','1972-01-20 00:00:00','NJ'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (8,'Tom','Holland','2401061996','Actor','1996-06-01 00:00:00','CA'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth...

  • Please use own words. Thank you. CASE QUESTIONS AND DISCUSSION > Analyze and discuss the questions...

    Please use own words. Thank you. CASE QUESTIONS AND DISCUSSION > Analyze and discuss the questions listed below in specific detail. A minimum of 4 pages is required; ensure that you answer all questions completely Case Questions Who are the main players (name and position)? What business (es) and industry or industries is the company in? What are the issues and problems facing the company? (Sort them by importance and urgency.) What are the characteristics of the environment in which...

  • Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around...

    Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around risk and threat management, fostering an environment in which objectives seem clear: manage risk, manage threat, stop attacks, identify attackers. These objectives aren't wrong, but they are fundamentally misleading.In this session we'll examine the state of the information security industry in order to understand how the current climate fails to address the true needs of the business. We'll use those lessons as a foundation...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT