Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python Q3a. . Write a class that fulfils the following specifications. Class name Vaccine Parameter(s) argument(s) for the constructor _init_ In this order, 1.

use python

image text in transcribed

Q3a. . Write a class that fulfils the following specifications. Class name Vaccine Parameter(s) argument(s) for the constructor _init_ In this order, 1. name -a str 2. origin - a str 3. efficacy - a float Detailed description 1. Assign the parameters to instance attributes of the same names, i.e. name, origin and efficacy Example usage vaccinel - Vaccine("Pfizer", "Germany",0.95) print(vaccine1.name) print(vaccinel.efficacy) Example usage output Pfizer 0.95 Q3b. Write a class method for the Vaccine class that fulfils the following specification Method name from_dict Parameter(s) argument(s) A dictionary with the following key value pairs 1. Key - "name", value - a str 2. Key - "origin", value - a str 3. Key - "efficacy", value - a float An instance of the Vaccine class Return value Detailed description Return an instance of the Product class using the values of the keys "name", "origin" and "efficacy" in the dictionary. Example usage new_vaccine - Vaccine.from_dict({"name": "Sputnik", "origin": "Russia", "efficacy":0.916}) print(new_vaccine.name) print(new_vaccine.efficacy) Example usage output Sputnik 0.916

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

5. A review of the key behaviors is included.

Answered: 1 week ago