answer.
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
Murljashka [212]
2 years ago
13

Delete Prussia from country_capital. Sample output with input: 'Spain:Madrid,Togo:Lome,Prussia: Konigsberg' Prussia deleted? Yes

. Spain deleted? No. Togo deleted? No.
Computers and Technology
1 answer:
7nadin3 [17]2 years ago
3 0

Answer:

Explanation:

When deleting anything from dictionary always mention the key value in quotes .

Ex: del country_capital['Prussia']

if we don't mention it in quotes it will consider that Prussia as variable and gives the error Prussia is not defined.

Code:

user_input=input("") #taking input from user

entries=user_input.split(',')    

country_capital=dict(pair.split(':') for pair in entries) #making the input as dictionary

del country_capital['Prussia'] #deleting Prussia here if we don't mention the value in quotes it will give error

print('Prussia deleted?', end=' ')

if 'Prussia' in country_capital: #checking Prussia is in country_capital or not

print('No.')

else:

print('Yes.')

print ('Spain deleted?', end=' ')    

if 'Spain' in country_capital: #check Spain is in Country_capital or not

print('No.')

else:

print('Yes.')

print ('Togo deleted?', end=' ') #checking Togo is in country_capital or not

if 'Togo' in country_capital:

print('No.')

else:

print('Yes.')

Explanation:

You might be interested in
Show how to define a view tot_credits (year, num_credits), giving the total number of credits taken by students in each year
andreev551 [17]

Hi! I'm a Digital Marketer Intern at hotels.ng and I have a moderate knowledge on programming.

First, your  question is not very explanatory. The term "view" is often used in back-end web development. A view is simply a Python function that takes a Web request and returns a Web response.

But I'm not sure this is what you want, so I'll just go ahead and write a python function involving class to return the total number of credits taken by a student.

I'll answer this question using Python.

class student(object):  

    credits = None

    year = None

    def num_credits(self):


       #get credit value

       self.credits = input("Enter the total number of credits: "  )


       pass

    def getYear(self):

        self.year = input("Enter current year: ")

        pass

    def tot_credits(self):

          TotalCredits = tempTotalCredits + self.num_credits

           print "Your  total credits are :"+" "+str(TotalCredits)




3 0
2 years ago
Write a function that implements another stack function, peek. Peek returns the value of the first element on the stack without
devlian [24]

Answer:

See explaination

Explanation:

StackExample.java

public class StackExample<T> {

private final static int DEFAULT_CAPACITY = 100;

private int top;

private T[] stack = (T[])(new Object[DEFAULT_CAPACITY]);

/**

* Returns a reference to the element at the top of this stack.

* The element is not removed from the stack.

* atreturn element on top of stack

* atthrows EmptyCollectionException if stack is empty

*/

public T peek() throws EmptyCollectionException

{

if (isEmpty())

throw new EmptyCollectionException("stack");

return stack[top-1];

}

/**

* Returns true if this stack is empty and false otherwise.

* atreturn true if this stack is empty

*/

public boolean isEmpty()

{

return top < 0;

}

}

//please replace "at" with the at symbol

Note:

peek() method will always pick the first element from stack. While calling peek() method when stack is empty then it will throw stack underflow error. Since peek() method will always look for first element ffrom stack there is no chance for overflow of stack. So overflow error checking is not required. In above program we handled underflow error in peek() method by checking whether stack is an empty or not.

3 0
2 years ago
Megan has written the following rough draft for her assignment. Choose the correct way to complete each sentence. Sarah is creat
atroni [7]

Answer:

I. hatching

II. filter

Explanation:

Sarah is creating an image. She wants to achieve tonal effects with parallel lines by varying their densities and distribution patterns. She will use <u>hatching</u> to do this. She also wants to add special effects on the image. Therefore, she will use <u>filters</u>.

Hatching refers to an art technique in which parallel lines are used to shade by drawing them closely together.

Stippling is an art technique used in the making of patterns by using small dots.

Filters is a technique of changing image characteristics. It is used to change the picture characteristics & to add special effects to an image such as the shade, contrast, tone, brightness etc.

We therefore see that, <u>hatching</u> and <u>filter</u> are the correct answers respectively

3 0
2 years ago
HackerCards is a trendy new card game. Each type of HackerCard has a distinct ID number greater than or equal to 1, and the cost
joja [24]

Answer:

I don't know if this is right output is {1,3}

Explanation:

5 0
1 year ago
The OSI security architecture provides a systematic framework for defining security attacks, mechanisms, and services. True or F
Alex Ar [27]

Answer:

True is the correct answer for the above question

Explanation:

  • The OSI security architecture is a security framework that is used to secure the data packets when it is going to transfer on the internet for communication.
  • It is used to define the security rules and mechanism which need to secure the data packets.
  • It mainly focuses on Security services, Security attacks, Security mechanisms.
  • The above question-statement states about the framework which defines the security mechanism to secure from the attacks are known as OSI Security architecture which is the correct statement which is described above. Hence True is the correct answer.
3 0
2 years ago
Other questions:
  • bill and melinda have two young children ages 2 and 4 and they are not covered under any life insurance policy. Melinda is full
    8·1 answer
  • Which act was used to penalize Sara? Sara was found to be in possession of a controlled substance for which she had no justifica
    5·1 answer
  • RFID tags are used in secure environments primarily due to the fact they are impossible to counterfeit.
    5·1 answer
  • 4.2.3: Basic while loop expression. Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Fol
    6·2 answers
  • Lin is booting up his computer, and during the boot process, the computer powers down. After several unsuccessful attempts to bo
    13·1 answer
  • Question 1 :Which type of unshielded twisted pair (UTP) cable is commonly used for 1000BASE-T Ethernet networks and is often mad
    8·1 answer
  • Mile markers appear as _____ green signs.
    6·2 answers
  • Create a generic class Box with a type parameter that simulates drawing an item at random out of a box. This class could be used
    7·1 answer
  • For his class project, Matt has to create an image in a color scheme that has shade or tint variations of the same hue. Which co
    7·1 answer
  • While Angela is making modifications to Katie’s Word document, she would like to inform Katie of the reasoning for the change. W
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!