Hey guys I need help with this assignment. However it contains 7 sub-problems to solve but I figured only 4 of them can be solved in one post so I posted the other on another question so please check them out as well :)

Here is the questions in this assignment:




EXPLANATION IN CODE COMMENTS :
def remove_less_than_2(dic):
all_keys = list(dic.keys())
for key in all_keys:
if dic[key]==1:
del dic[key]
return dic
def print_dic_in_key_order(dic):
#print dictionary content in sorted key order
for key in sorted(dic):
print(key ,":", dic[key])
print()
def draw_rows(dic):
#run two loops and print the value key times
for key in sorted(dic):
print(key ,":",end =" ")
for i in range(key):
print(dic[key],end ="")
print()
print()
def get_text_valuation(dic,text):
sumA=0
#loop over text , if character is alphabet and it exits in
dictionary then add value to sum
#else add 1 to the sum
for i in text.lower():
if i.isalpha()==True:
if i in dic.keys():
sumA+=dic[i]
else:
sumA+=1
return sumA
"""
33333333333333333333333333333333333333333333333333
"""
def get_word_len_dict(text):
l = text.split(" ")
dic = {}
#for each word in the list, get its length
#if len exists as key in dictionary , append the word to it
#else create a new entry in the dictionary
for i in l:
key = len(i)
if key in dic.keys():
if i not in dic[key]:
dic[key].append(i)
else:
dic[key]=[i]
for value in dic.values():
value.sort()
return dic
"""
444444444444444444444444444444444444444444444444444
"""
def get_triples(text):
dic = {}
s=""
#loop over text as lower() , take string as s
#in each iteration add each character if it is alphabet to s
#when length of s reaches 3, if it exists in the dictionary , add
one to it
#else create a new entry
for i in text.lower():
if i.isalpha() == True:
s += i
if len(s)==3:
if s in dic.keys():
dic[s]+=1
else:
dic[s]=1
s = s[1:]
#remove all the entries in the dictionary whose value is == 1
return remove_less_than_2(dic)
dic = {4:'a',7:'c',4:'b'}
draw_rows(dic)
dic = {"r":2,"s":2,"h":4,"t":3,"m":7,"g":4,"v":8}
letters = "BLAH"
print("1. ",letters," - ",get_text_valuation(dic,letters),"\n")
text = "May your coffee be strong and your monday be
short"
dic = get_word_len_dict(text)
print_dic_in_key_order(dic)
text = "super , duper"
print_dic_in_key_order(get_triples(text))




Hey guys I need help with this assignment. However it contains 7 sub-problems to solve but I figured only 4 of them can...
Hey guys I need help with this question:
# 4444444444444444444444444444444444444444444444444 # get-triples-dict() Define the get triples diet) funetion which is passed a string of text as a The function first converts the parameter string to lower case turns a dictionary with keys which are all the unique consecutive tic characters from the text, and the corresponding values are characters appear in parameter. and then re three alphabe the number of times the three consecutive alphabetic text. Use the isalpha() method...
Hey guys I need help with this question with 3 sub-problems.
f test remove short synonyms () Define the remove shorti synonyms function which is passed a dictionary as a parameter- The keys of the parameter dictionary are words and the corresponding values are 1ists of synonyms (synonyms are words which have the same or nearly the same meaning). The function romoves all the eynonyme which have ous than 8 charactors from each corresponding list of synonyms-As well, the funet...
1. Define the draw_histogram() function which is passed a Python dictionary as a parameter. The keys of the dictionary are single letters and the corresponding values are integers, e.g., {'b': 5, 'a': 6, 'c': 3}. For each key:value pair in the dictionary the function prints the key, followed by ": ", followed by a series of stars. The number of stars printed is given by the value corresponding to the key. The keys are printed in alphabetical order. Note that...
# 1111111111111111111111111111111111111111111111111 # draw_histogram() #-------------------------------------------------- #-------------------------------------------------- """ Define the draw_histogram() function which is passed a Python dictionary as a parameter. The keys of the dictionary are single letters and the corresponding values are integers, e.g., {'b': 5, 'a': 6, 'c': 3}. For each key:value pair in the dictionary the function prints the key, followed by ": ", followed by a series of stars. The number of stars printed is given by the value corresponding to the key. The keys are...
The skeleton code (starter file) for the problem is pasted
below:
def phoneNumber(letters):
result = ""
# ADD YOUR CODE HERE
return result
def loadEvents(filename):
events = {}
# ADD YOUR CODE HERE
return events
def timeline(events):
# ADD YOUR CODE HERE
return
# DO NOT modify or remove the code below! We will use it for
testing.
if __name__ == "__main__":
# Problem 1: Decoding Telephone Numbers
ph = input("Enter the text to translate: ")
print("The corresponding phone number...
PYTHON Hello can someone create the following functions? I'm not sure how to start on them. makeDictionary Define a function named makeDictionary with two parameters. The first argument passed the function must be a list of strings to be used as keys, while the second is a list of the same length containing values (of some type). This function must return a dictionary consisting of the keys paired with the corresponding values. For example, makeDictionary(['apno','value'],['REP-12','450']) must return this dictionary: {'apno':...
Hey I have a task which consists of two part. Part A asks for
writing a program of WORD & LINE CONCORDANCE
APPLICATION in python which I have completed it.
Now the second part has given 5 dictionary implementation codes
namely as: (ChainingDict, OpenAddrHashDict with linear probing,
OpenAddrHashDict with quadratic probing, and 2 tree-based
dictionaries from lab 12 (BST-based dictionary implementation) and
asks for my above program WORD & LINE CONCORDANCE
APPLICATION to use these implemented code and
show the time...
I need help for this assignment. Thank you!!
# 5555555555555555555555555555555555555555555555555 # Returns the longest word (which has six or more # characters and contains the letter, e) from # the parameter list - 4 marks Os Define the get_longest_e_word() function which is passed a list of strings as a parameter. The function returns the word in the list which has the most characters (i.e., the longest word) BUT only words which have 6 or more characters and contain the letter...
VERY URGENT*** THANK YOU IN ADVANCE: THIS IS THE CODE I HAVE GOTTEN SO FAR: PYTHON This is a code that is supposed to help someone study/ practice for jeopardy. The two functions described below are required for this assignment. You may add other functions that you think are appropriate: menu() This function, which displays all the user options to the screen, prompt the user for their choice and returns their choice. This function will verify user input and ALWAYS...
C Program In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenère cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters Your program must compile and run from the command line. The program executable must be named “vigenere” (all lower...