Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Review the following
import urllib.request, urllib.parse, urllib.error
fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt')
counts = dict()
for line in fhand:
words = line.decode().split()
for word in words:
counts[word] = counts.get(word, 0) + 1
print(counts)
3.1 Provide an explanation for EACH line of the following program.
3.2 Run the above program and include a full window screenshot with system time and date in the answer.
3.3 Run the above program with https://www.py4e.com/code3/romeo-full.txt and include a full window screenshot
with system time and date in the answer.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Here is the iterative implementation of binary search: For each call to binary_search below, indicate how many times the code inside the while loop will execute. animals = ["aardvark", "cat", "dog", "elephant", "panda"] 1. binary_search("elephant", animals) 2. binary_search("dog", animals) 3. binary_search("anteater", animals)arrow_forwardIn the following program skeleton, replace the < insert code here> line with theappropriate code. The resulting program should display the initial list of songs,prompt the user for a string of text to be replaced and then prompt for new text toreplace it. After making the replacement, it should display the updated list of songs.import java.util.Scanner;public class UpdateSongs{public static void main ( String [] args){Scanner stdIn = new Scanner(System.in);String songs =“ 1. Welcome to Your Life – Grouplove\n” +“ 2. Sedona – Houndmouth\n” +“3. Imagine – John Lennon\n” +“4. Bohemian Rhapsody –Queen\n”;String oldText, newText;< insert code here>}}Sample Session:1. Welcome to Your Life – Grouplove”2. Sedona – Houndmouth3. Imagine – John Lennon4. Bohemian Rhapsody –QueenEnter text to replace: LennonEnter new text: Dean1. Welcome to Your Life – Grouplove”2. Sedona – Houndmouth3. Imagine – John Dean4. Bohemian Rhapsody –Queenarrow_forwardJAVA: Use the "natural split" algorithm on the file split.txt and answer the following question: How many elements are in the first list? Split.txt file 200494 774 644 345 521 61 27 28 584 569 66 857 210 2 211 675 548 596 188 647 671 517 408 475 615 113 731 522 850 17 640 940 556 517 602 935 76 578 880 428 168 394 381 497 247 368 137 138 619 973 895 106 838 45 921 800 681 660 490 427 937 917 786 959 152 604 837 749 684 963 926 963 988 492 385 458 788 7 62 46 932 996 787 634 34 616 71 128 686 578 923 532 933 545 100 224 895 595 342 933 934 797 120 565 495 884 237 648 843 599 157 843 192 279 301 649 382 881 667 178 126 746 44 601 22 52 769 708 991 83 447 786 525 168 328 922 153 367 22 689 834 774 93 110 547 597 644 726 237 20 370 573 391 225 750 897 956 839 951 455 8 509 746 338 576 276 277 341 274 891 723 53 966 271 50 990 493 823 833 306 619 461 768 832 736 759 920 451 549 833 911 123 907 225 252 179 177 272 747 859arrow_forward
- Create a Python program using the following: -Create list[ "Parking:ID123", "Speeding:"ID455", "Running:ID346"] -Slice the list by ":" -Create a search such that when the user inputs a name, if the name is on the list, print the name and the corresponding ID number or return that there is no match found. -Use control statements (break/continue)arrow_forwardPythonarrow_forwardUsing Clojure Write a procedure, called count-to-1, that takes a positive integer n, and returns a list of the integers counting down from n to 1. For example, given input 3, it will return (list 3 2 1). Hint: Use the procedures reverse and count-to-n that you wrote in the previous problems. (Shown in attached image)arrow_forward
- Complete the Python program below to list all language names and number of related articles in the order they appear in the URL below from urllib.request import urlopenfrom bs4 import BeautifulSouphtml = urlopen('https://www.wikipedia.org/')bs = BeautifulSoup(html, "html.parser") nameList = #TO DO -- Complete the Codefor name in nameList: print(name.get_text())arrow_forwardwhat is the problem in this code ? def add():id = input("Enter ID:")f = open("data.txt", "r")id_list = []lines = f.readlines()if lines != "":for line in lines:token = line.split(" ")id_list.append(token[0])for i in id_list:if i == id:print("The student record is already in the database!Zero records added")returnf.close()file = open("data.txt", "a")name = input("Enter name: ")course = input("Enter course: ")absences = int(input("Enter absences: "))exam1 = int(input("Enter exam 1 grade: "))exam2 = int(input("Enter exam 2 grade: "))marks = int(input("Enter Total Marks: "))s = id+" "+name+" "+course+" "+str(absences)+" "+str(exam1)+" "+str(exam2)+" "+str(marks)+"\n"file.write(s)file.close()while True:print("1.Add a student")print("Any other numeric to terminate")choice = int(input())if choice == 1:add()else:breakarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education