1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
netineya [11]
3 years ago
5

Write a function named is_sub_dict that accepts two dictionaries from strings to strings as its parameters and returns True if e

very key in the first dictionary is also contained in the second dictionary and maps to the same value in the second dictionary. For example, given the dictionaries below, map1 is a sub-dict of map2, so the call of is_sub_dict(map1, map2) would return True. The order of the parameters does matter, so the call of is_sub_dict(map2, map1) would return False.
Computers and Technology
1 answer:
denis23 [38]3 years ago
6 0

def is_sub_dict(dict1, dict2):

   one = dict1.keys()

   two = dict2.keys()

   for x in one:

       if x in two:

           if dict1[x] == dict2[x]:

               pass

           else:

               return False

       else:

           return False

   return True

I wrote the code in python 3.8. I hope this helps.

You might be interested in
Why is sequencing important?
S_A_V [24]

Answer:

C

Explanation:

If it wasn't in order then the code would fail

4 0
3 years ago
Read 2 more answers
In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends deci
pickupchik [31]

Answer:

The java program for the given scenario is as follows.

import java.util.*;

import java.lang.*;

public class Main

{

   //variables for bill and tip declared and initialized

   static double bill=47.28, tip=0.15;

   //variables for total bill and share declared

   static double total, share1;

public static void main(String[] args) {

    double total_tip= (bill*tip);

    //total bill computed

    total = bill + total_tip;

    //share of each friend computed

    share1 = total/2;

    System.out.printf("Each person needs to pay: $%.2f", share1);  

}

}

Explanation:

1. The variables to hold the bill and tip percent are declared as double and initialized with the given values.

static double bill=47.28, tip=0.15;

2. The variables to hold the values of total bill amount and total tip are declared as double.

3. All the variables are declared outside main() and at class level, hence declared as static.

4. Inside main(), the values of total tip, total bill and share of each person are computed as shown.

double total_tip= (bill*tip);

total = bill + total_tip;

share1 = total/2;

5. The share of each person is displayed to the user. The value is displayed with only two decimal places which is assured by %.2f format modifier. The number of decimal places required can be changed by changing the number, i.e. 2. This format is used with printf() and not with println() method.

System.out.printf("Each person needs to pay: $%.2f", share1);  

6. The program is not designed to take any user input.

7. The program can be tested for any value of bill and tip percent.

8. The whole code is put inside a class since java is a purely object-oriented language.

9. Only variables can be declared outside method, the logic is put inside a method in a purely object-oriented language.

10. As shown, the logic is put inside the main() method and only variables are declared outside the method.

11. Due to simplicity, the program consists of only one class.

12. The output is attached.

5 0
4 years ago
Read 2 more answers
A. True <br><br> b. False: most modern computers can understand and execute pseudocode.
Veronika [31]
False






---------------------------------------------
7 0
3 years ago
When a hostname is configured through the cisco cli, which three naming conventions are part of the guidelines? (choose three.)?
Advocard [28]
When a hostname is configured through the Cisco cli,  there are some naming <span>conventions are part of the guidelines that should be followed.

From these conventions:
1- the name of the host shouldn't contain any spaces.
2- the name of the host should always begin with a letter
3- the name of the host should be less than 64 characters in length.</span>
3 0
4 years ago
Explain word count <br>in ms word Processing​
olasank [31]

Answer:

Is the counting how much words you have written in the ms word

3 0
3 years ago
Other questions:
  • If you wanna buy a Monitor, please explain why you wanna buy it! PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!
    9·1 answer
  • The blank one is a close up of what logo?
    15·1 answer
  • Taylor has spent a lot of time developing and setting up his presentation. He wants to make sure his delivery is as good as poss
    8·2 answers
  • Median of a sample If the distribution is given, as above, the median can be determined easily. In this problem we will learn ho
    15·1 answer
  • Which of the following are examples of the concept of layered access in physical security? Select one: a. Firewall, IDS, CCTV b.
    11·2 answers
  • A DBMS makes the: a. relational database available for different analytical views. b. physical database available for different
    12·1 answer
  • 1. Which of the following is not a question that should be asked when planning a Windows Server 2019 installation?
    13·1 answer
  • *please be serious and also answer everything * <br> I will also mark you brainliest :)
    6·1 answer
  • Can someone compress this ipv6 address? 558c:0000:0000:d367:7c8e:1216:0000:66be
    9·1 answer
  • 8. Software ____ are individual programs that can be purchased, installed, and run separately, but extract data from the common
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!