Function should return a dictionary

Assignment Help Python Programming
Reference no: EM13163655

(4.a) Write a function numOccur(s), where s is a string; the function should return a dictionary whose keys are the 26 ascii letters abcdefghijklmnopqrstuvwxyz . At each key (i.e., for each one of these 26 ascii letter), the value should be the number of times this letter occurs in s. The string s can contain all kinds of ascii characters; only the letters should be counted, the rest should be ignored. Your function should read the string s just once.
(4.b) Find the returned dictionary when you run numOccur(s) on the string consisting of the entire content of the attached le DictFileSetHW. Make sure you save this le as a plain text- le (in the same way as you save your Python programs), in the same directory as your Python program.
Then in interactive python3, use Python le commands to open the le and copy it into one string s. Review the commands open(..,..), <fileVAR>.read(), and <fileVAR>.close() in the handout DictFileSet or DictFileSetHW.
Show (as commnents) the le commands you use and the resulting dictionary

Reference no: EM13163655

Questions Cloud

Multiple choice question on networking : 1-Which of the following extensions point to an executable string of code?
Write a function trans(m) which returns the transpose : Write a function trans(M) which returns the transpose of an n-by-n matrix M. The matrix M is represented by a list of n lists, each of length n. Transposing M means that each M[i][j] is swapped (once!) with M[j][i].
True or false about networking : 2- A print queue must be set up for every printer on the network served by a print server. True False
Permutation ciphers : Permutation Ciphers (a.k.a. Transposition Ciphers) are another class of simple cryptosystems. For this we use the functions apply(.,.) and inv(.) from Homework 4; copy these two functions into your le as auxiliary functions.
Function should return a dictionary : Write a function numOccur(s), where s is a string; the function should return a dictionary whose keys are the 26 ascii letters abcdefghijklmnopqrstuvwxyz
Recursion to write a python function : Use recursion to write a Python function depth(LL), where LL is a nested list of lists of lists etc. of numbers (i.e., oat and int) and strings. We want to return the depth of nesting, i.e., how often, maximally, there is a list in a list etc
Determine the values for m and l for the b+ tree : A B+-tree is to be stored on disk whose block size is 2048 bytes. The data records to be stored are 50 bytes, and their key is 4 bytes. Determine the values for M and L for the B+-tree. Assume pointers are 4 bytes each.
Let ll be a list of integers : Let LL be a list of integers. Use list comprehension to produce teh following lists. Each one should just take onel line. Anser questions as two comments.
Write a select statement that returns these columns : Write a SELECT statement that returns these columns from the Products table: The date_added column A column that uses the CAST function to return the date_added column with its date only (year, month, and day)

Reviews

Write a Review

Python Programming Questions & Answers

  Program to do the enciphering

Write a program to do the enciphering. It should prompt the user for a message, and print out both the entered message and its corresponding ciphertext.

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Design a prgram using python

Design a prgram USING PYTHON that students can use to calculate what score they need on final exam to get a certan final grade for a course.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Console program where you will implement

Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.

  Define a function to calculate the values

Be sure to define a function to calculate the values and print the table displaying the interest rate in the first column, the monthly payment in the second column, and the total payment in the third column. Your program should not allow the user to ..

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Code for the haunted house game

Improve the game by adding more features, for example you can examine more items, more props etc. You may implement this using more lists regarding items and props, remember, you should check if the object is being carried or in the location of th..

  Fill in the python code

Fill in the Python code to play Tic Tac Toe. I won't award points unless it runs succesfully. # Tic-Tac-Toe Game def drawBoard(board): # Draws the board using the list of numbers print(" ") print(" ",board[0]," | ",board[1]," | ", board[2]) print("--..

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Cleint software so that it does not display

Rewrite the cleint software so that it does not display an echo of a message sent by the users. Maybe it means that each time a user tries to send a private message that same message is also sent back to them? summary: stop that from happening?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd