Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Design the dictionary so that it could be useful for something meaningful to you. Create at least three different items in it.

def invert_dict(d):

   inverse = dict()

   for key in d:

      val = d[key]

     if val not in inverse:

        inverse[val] = [key]

     else:

        inverse[val].append(key)

   return inverse 

Modify this function so that it can invert your dictionary. In particular, the function will need to turn each of the list items into separate keys in the inverted dictionary. 

Run your modified invert_dict function on your dictionary. Print the original dictionary and the inverted one. 

Include your output 

Describe what is useful about your dictionary. Then describe whether the inverted dictionary is useful or meaningful, and why.


Write a program using string functions that determine if the

input word is a palindrome. A palindrome word is a word

that produces the same word when it is reversed.

Sample Input/Output Dialogue:

Enter a word: CUTE

Reversed: ETUC

“Nice”

Enter a word: MAD

Reversed: DAM

“Nice”


a=0 while (a<5) 2a. b=0 2b. while (b<a) 2bi display "_"; 2bii b=b+1 2c. a=a+1


1.write a program to solve 8! Using recursion technique

2.using RAM diagrams show how parameters are passed in your code



PRINT-OPTIMAL-PARENS(s, i, j){

if (i=j) then

print “A”i else{

print “(”

PRINT-OPTIMAL-PARENS(s,i,s[i, j])

PRINT-OPTIMAL-PARENS(s, s[i, j] + 1, j)

print “)”} }

a- Test your algorithm for the following cases:

1. Find and print an optimal parenthesization of a matrix-chain product whose sequenceof dimensions is<5,10,3, X,12,5,50, Y,6>.

2. Find and print an optimal parenthesization of a matrix-chain product whose sequenceof dimensions is<5,10,50,6, X,15,40,18, Y,30,15, Z,3,12,5>.1

3. Find and print an optimal parenthesization of a matrix-chain product whose sequenceof dimensions is<50,6, X,15,40,18, Y,5,10,3,12,5, Z,40,10,30,5>.

b- Find the complexity of your program

c- Show that the parenthesization algorithm is loop invariant.

X=10, Y=20, Z=30


Recursion

Given int 8;

(1)   Write a program to solve 8! Using recursion technique.

(2)   Using RAM diagrams show how the parameters are passed in your code.



Write a program to add data from two arrays of 2X2 dimension. The arrays must be of double type to process students scores. After addition the program calculates the average of scores from each array. Then the averages are added to get the total of the averages


Describe how tuples can be useful with loops over lists and dictionaries, and give Python code examples. Create your own code examples. Do not copy them from the textbook or any other source. 

Your descriptions and examples should include the following: the zip function, the enumerate function, and the items method


6)Create a class named IceCreamCone with fields for flavor, number of scoops, type of cone, and price. Unless arguments are supplied, flavor defaults to “Vanilla”, number of scoops defaults to 1, and cone type defaults to “Sugar”. The method calculates the price based on Rs.75 per scoop, with an additional Rs.40 for a waffle cone. Write a C++ program to calculate the price.


A hospital has Patient Appointment Management System (PAMS), in which all the details of doctors, patients and appointments are given. In this scenario all the details of appointment and patients are shared with the doctor and all the doctors have access to fix and cancel the appointments. Similarly, patients are also authorized to view the doctors list and appointments. Following are the key points of the functionality of PAMS:

⦁ According to the system, patients get the basic information of the doctor, specialization, charges per hour and work hour.

⦁ The system will allow doctors to add/delete and update the schedule.

⦁ The doctors must be able to maintain per visit charges.

.Q1. Construct an Entity Relationship Diagram (ERD) using the identified entities, attributes and mention the valid relationships and cardinality between them.



LATEST TUTORIALS
APPROVED BY CLIENTS