import math
import random
class Bacteria:
def __init__(self, resistance):
if(resistance > 10 or resistance < 1):
raise Exception("Invalid resistance")
self.resistance = random.choice(range(resistance-1,resistance+2))
self.health = 10
self.life_span = 15
self.birth_counter = 3
def __str__(self):
return "H({1})\tR({2})\tLS({3})\tBC{4}".format(self.health,self.resistance,self.life_span,self,birth_counter)
def is_alive(self):
return self.health > 0
def tick(self):
self.birth_counter = self.birth_counter - 1
self.life_span = self.life_span - 1
def dose(self,dosage):
self.health = self.health - (dosage * (1/self.resistance))
def reproduce(self):
if self.is_alive() and self.birth_counter <= 0:
self.birth_counter = 0
return Bacteria()
class Host:
def __init__(self,no_of_bacteria):
self.batcteria = list()
for i in range(no_of_bacteria):
self.batcteria.append(Bacteria(3))
def __str__(self):
total_health = 0
total_resistance = 0
for i in self.batcteria:
total_health = total_health + i.health
total_resistance = total_resistance + i.resistance
count = len(self.batcteria)
return "Count : {0}\nAverage health : {1}\nAverage resistance : {2}".format(count,total_health/count,total_resistance/count)
def tick(self,with_dosage=False):
if with_dosage:
for i in self.batcteria:
i.dose(25)
for i in range(len(self.batcteria)):
if self.batcteria[i].is_alive():
self.batcteria.append(self.batcteria[i].reproduce())
else:
del self.batcteria[i]
if __name__ == "__main__":
a = Host(1)
b = Host(2)
c = Host(3)
for i in range(30):
a.tick()
for i in range(15):
a.tick()
b.tick(True)
if(i%2 == 0):
c.tick(True)
else:
c.tick()
print(a)
print(b)
print(c)
OUTPUT :

CODE SCREENSHOTS :


**Please do let me know if you need any futhur assistance. Thank you **
Python 3 please Bacteria and Drug Resistance If you don't take all your antibiotics when you...
LAB Genetic Engineering of Bacteria Problem Is it possible to transfer the allele for resistance to the antibiotic ampicillin into a bacterial cell? Objectives After completing this lab, the student will be able to: 1. Demonstrate micropipetting and sterile pipetting techniques for handling and transferring bacteria and plasmid DNA. 2. Maintain sterile conditions for culturing bacterial cells. 3. Inoculate bacteria into flasks, culture tubes, or agar plates. 4. Culture isolated individual colonies from an agar plate to form genetically identical...
Hi could you please provide how to do problem 2?
Amsterdam University of Applied Sciences Problem 2(15 points) A Wheatstone bridge is used to determine the resistance of a strain gauge. The 3 resistances R of the Wheatstone bridge are equal: R 200 12. When the strain gauge is fully relaxed (nd strain present), its resistance Rs is equal to the other 3 resistances: Rs-R. The strain is given bywith AR, the change in resistance in the strain gauge. The...
please write these as you would into python. . i will give an thumbs ups 1. Evaluate the following expressions using Python 1. Product of first 10 even integers. 2. Midterm scores of 4 students are 89, 78, 90, 98. Find the average of these scores. 3. Evaluate 3 to the power 7 4. Find the number of foot in 345 inches. 5. find the remainder when 34567 divides by 17. 2. animals = ['cat', 'dog', 'lion', 'tiger', 'monkey', 'hyena']...
You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...
1. Bacteria such as E.coll and staph belong to which Domain? A. Animalia B. Eukarya C. Archaea D. Bacteria 2. In general terms, prokaryotic cells are cells that? A. Have a nucleus B. Do not have a nucleus. 3. Think about the name E. coli 4X56. In that name which refers to the serotype? A E B. coli C4X56 4. Which of the following best describes the type of bacteria that are important to ecology, and once were thought to...
с н А Р Т Е R 2 Microbiology VOCABULARY REVIEW Assignment 27-1: Matching Match the term with its definition and place the corresponding letter in the blank. 1 Culture A Liquid or solid material in which bacteria are grown 2. Agar B. Class of bacteria that do not require axygen to grow 3. Aerobic C. A group of microbes growing on nutrient-rich media 4. Inoculation D. Infection that develops in compromised patients and those taking certain medications such as...
I
need your help ASAP! please show all work for this activity sheet
f True/False Write T for true, F for false a) Prostaglandins are used to make steroid hormones b) Prostaglandins are synthesized only in the liver c) Prostaglandins can be used to induce labor d) Prostaglandins are synthesized in the cell only when it is needed e) Prostaglandins prevent the inflammation response Prostaglandins can cause fever and pain sensitivity g) Phospholipids are the only lipids found in a...
JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...
kindly assist with questions 8,10, 12, 14
and questions 18 and 26
thank you
8) noted thatc Mars, Inc., the c 8 Checolate An article in Aunat of Nutrition (Vol. 130 No. K nacwsds. The article noees egular consumption of foosds rich in h rist of ovonars hoart drsease" The stuty received Funding from M and the Chovolate Manufacturers Association Sampling Methed. In Kxwrvises 9-12, determine whether the sa 17. Gontsxt of the t ngfal way in which e 8...
This assignment is comprised of 3 parts: All files needed are located at the end of the directions. Part 1: Implementation of Dynamic Array, Stack, and Bag First, complete the Worksheets 14 (Dynamic Array), 15 (Dynamic Array Amortized Execution Time Analysis), 16 (Dynamic Array Stack), and 21 (Dynamic Array Bag). These worksheets will get you started on the implementations, but you will NOT turn them in. Do Not Worry about these, they are completed. Next, complete the dynamic array and...