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
The establishment called ABC Enterprise requires a Java program to keep a database of the inventory of the products that it sell
Alexandra [31]

Answer:

// GetData.java

import javax.swing.JOptionPane;

public class GetData

{

  public static double getDouble(String s)

  {

      return Double.parseDouble(getWord(s));

  }

  public static int getInt(String s)

  {

      return Integer.parseInt(getWord(s));

  }

  public static String getWord(String s)

  {

      return JOptionPane.showInputDialog(s);

  }

  public static String getString(String s)

  {

      return JOptionPane.showInputDialog(s);

  }

}

// Address.java

public class Address

{

  private String street, city, state, zip;

  public Address(String str, String city, String st, String zip)

  {

      street = str;

      this.city = city;

      state = st;

      this.zip = zip;

  }

  public String getStreet()

  {

      return street;

  }

 

  public String getCity()

  {

      return city;

  }

  public String getState()

  {

      return state;

  }

  public String getZip()

  {

      return zip;

  }

}

// Manufacturer.java

public class Manufacturer

{

  private String companyName;

  private Address companyAddress;

 

  public Manufacturer()

  {

      this.companyName = "";

      this.companyAddress = null;

  }

 

  public Manufacturer(String compName, Address address)

  {

      this.companyName = compName;

      this.companyAddress = address;

  }

 

  public String getCompanyName()

  {

      return companyName;

  }

 

  public void setCompanyName(String companyName)

  {

      this.companyName = companyName;

  }

 

  public Address getCompanyAddress()

  {

      return companyAddress;

  }

 

  public void setCompanyAddress(Address address)

  {

      this.companyAddress = address;

  }

}

// Product.java

import java.text.SimpleDateFormat;

import java.util.Date;

public class Product

{

 

  SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");

 

 

  Manufacturer manufacture;

 

 

  String productName;

 

 

  int quantity;

 

 

  double unitPrice;

 

 

  Date productCreated;

 

 

  public Product()

  {

      this.productName = "";

      this.quantity = 0;

      this.unitPrice = 0.0;

      this.productCreated = null;

      this.manufacture = null;

  }

 

  public Product(String prodName, int quantity, double unitPrice,

                        Date productCreated, Manufacturer manufact)

  {

      this.productName = prodName;

      this.quantity = quantity;

      this.unitPrice = unitPrice;

      this.productCreated = productCreated;

      this.manufacture = manufact;

  }

 

 

  public Date getProductCreated()

  {

      return productCreated;

  }

 

 

  public void setProductCreated(Date productCreated)

  {

      this.productCreated = productCreated;

  }

 

  // to get the Manufacturer object

  public Manufacturer getManufacture()

  {

      return manufacture;

  }

 

  // to set the Manufacturer object

  public void setManufacture(Manufacturer manufacture)

  {

      this.manufacture = manufacture;

  }

 

  // to get the name of the product

  public String getProductName()

  {

      return productName;

  }

 

  // to set the name of the product

  public void setProductName(String prodName)

  {

      this.productName = prodName;

  }

 

  // to get the quantity of the product

  public int getQuantity()

  {

      return quantity;

  }

 

  // to set the quantity of the product

  public void setQuantity(int quantity)

  {

      this.quantity = quantity;

  }

 

  // to get the unit price of the product

  public double getUnitPrice()

  {

      return unitPrice;

  }

 

  // to set the unit price of product

  public void setUnitPrice(double unitPrice)

  {

      this.unitPrice = unitPrice;

  }

 

  // to update the quantity of the product

  public void upDateQuantity(int quantity_upDate)

  {

      quantity += quantity_upDate;

  }

 

  // to update the price of the product

  public void upDatePrice(double price_upDate)

  {

      this.unitPrice = price_upDate;

  }

 

 

  public String getProductInfomation()

  {

      String result = "";

      result += String.format("%-30s", productName);

      String dateForm = sdf.format(productCreated);

      result += String.format("\t %s", dateForm);

      result += String.format("%10d", quantity);

      result += String.format("\t%15.2f", unitPrice);

      result += String.format("\t%15s",

                          manufacture.getCompanyName());

      result += String.format("\t%20s",

                 manufacture.getCompanyAddress().getState());

      return result;

  }  

}

Explanation:

  • Create a manufacturer class to store and get information about company name and company address.
  • Create a product class to hold the manufacturer object, product name and other relevant information.
4 0
1 year ago
1.Which of the following class definitions defines a legal abstract class?a. class A { abstract void unfinished() { } }b. class
xxMikexx [17]

Answer:(c) abstract class A { abstract void unfinished(); }

Explanation:

A legal abstract class must have the keyword abstract before the class and an abstract class has abstract functions with the keyword abstract written and a void as the return type.

8 0
2 years ago
A user complains that her computer is performing slowly. She tells you the problem started about a week ago when new database so
k0ka [10]

Answer:

Option (B) is the correct of this question.

Explanation:

The performance of a monitor and process counters to observe the performance is the tool or method which determines the new software is hogging the computer resources. So this way the user don't have any problem with computer.

  • You can view log files in Windows Performance Monitor to see a visual representation of the performance counter data.
  • Performance counters are bits of code that log, count, and measure software events that allow a high-level view of user trends.
  • To customize the tracking of AD FS output using the Quality Monitor.
  • Type Output Monitor on Start screen, then click ENTER.
  • Expand Data Collector Sets in the console tree, right-click on User Specified, point to New, then select Data Collector Collection.

Other options are incorrect according to the given scenario.

4 0
2 years ago
Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A
harina [27]

Answer:

se explaination

Explanation:

//Design a class named Person

public class Person

{

//A person has a name, address, phone number, and email address.

String name;

String address;

String phone;

String email;

//Constructor with arguments

public Person(String pname,String paddress,String phNum,String pemail)

{

name=pname;

address=paddress;

phone=phNum;

email=pemail;

}

// toString() method to return the name

public String toString()

{

return getClass().getName()+" "+name;

}

}

---------------------------------------------------------

//Student.java

public class Student extends Person

{

//A student has a class status

//(freshman,sophomore, junior, or senior).

//Define the status as a constant.

final int freshman =1;

final int sophomore =2;

final int junior=3;

final int senior=4;

String status="freshman";

//Constructor with arguments

public Student(String name, String address,String phonenumber, String email, int Status)

{

super(name,address,phonenumber,email);

if(Status == 1)

{

status = "freshman";

}

if(Status == 2)

{

status = "sophomore";

}

if(Status == 3)

{

status = "junior";

}

if(Status == 4)

{

status = "Senior";

}

status = "Student";

}

public String toString()

{

return super.toString() + " " + status;

}

}

------------------------------------------------------

//Employee.java

public class Employee extends Person

{

//An employee has an office, salary, and date hired.

String office;

double salary;

java.util.Date dateHired;

//Constructor with arguments

public Employee(String name,String address,String phonenumber,String email,String off,double sal)

{

super(name,address,phonenumber,email);

office=off;

salary=sal;

}

public String toString()

{

return (super.toString() + " " + office +" " + salary);

}

}

--------------------------------------------------------

//Faculty.java

public class Faculty extends Employee

{

//A faculty member has office hours and a rank.

String officeHours;

String rank;

//Constructor with arguments

public Faculty(String name,String address,String phonenumber,String email,String off,int salary,String offHours,String ranks)

{

super(name,address,phonenumber,email,off,salary);

officeHours=offHours;

rank=ranks;

}

public String toString()

{

return (super.toString() + " " + officeHours +" " + rank);

}

}

-----------------------------------------------------------------------------

//Staff.java

public class Staff extends Employee

{

//A staff member has a title

String title;

//Constructor with arguments

public Staff(String name,String address,String phonenumber,String email,String off,int salary,String ti t)

{

super(name,address,phonenumber,email,off,salary);

title=ti t;

}

public String toString()

{

return (super.toString() + " " + title);

}

}

3 0
2 years ago
The vast amount of data collected from Internet searches, social media posts, customer transactions, military
Brums [2.3K]

Answer:

A. Big Data

Explanation:

It is big data. The internet searches, customer transactions, social media posts, medical tests, weather sensors, military surveillance, and all the data source you are seeing around yourself forms together with the big data. And a big social media company gathers around so many petabytes of data each day. And there are so many such companies, plus all sorts like eLearning sites, etc. And all these together form the big data.

3 0
2 years ago
Other questions:
  • The tuna marketers' task in the "tunathewonderfish.com" website and related campaign was to ________.
    15·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
  • c++ Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is c
    14·2 answers
  • As you are planning your informative speech on the prevalence of Internet memes in pop culture and you wonder if your audience w
    14·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • In this problem, we want to compare the computational performance of symmetric and asymmetric algorithms. Assume a fast public-k
    11·1 answer
  • On a webpage, a _____ provides supplemental material such as social networking feeds and ads. Group of answer choices footer sid
    9·1 answer
  • Write a program to read-in a sequence of integers from the keyboard using scanf(). Your program will determine (a) the largest i
    8·1 answer
  • Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the n
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!