Questions
Python I want to name my hero and my alien in my code how do I...

Python

I want to name my hero and my alien in my code how do I do that: Keep in mind I don't want to change my code except to give the hero and alien a name

import random

class Hero:

    def __init__(self,ammo,health):

        self.ammo=ammo

        self.health=health

    def blast(self):

        print("The Hero blasts an Alien!")

        if self.ammo>0:

            self.ammo-=1

            return True

        else:

            print("Oh no! Hero is out of ammo.")

            return False

    def damage(self):

        self.health-=1

        if self.health==0:

            print("Hero is out of health. Alien wins.")

        else:

            print("Hero took damage")

class Alien:

    def __init__(self,ammo,health):

        self.ammo=ammo

        self.health=health

    def blast(self):

        print("Alien is blasting")

        if self.ammo>0:

            self.ammo-=1

            return True

        else:

            print("Oh no! Alien is out of ammo.")

            return False

    def damage(self):

        self.health-=1

        if self.health==0:

            print("Alien is out of health. Hero wins.")

        else:

            print("Alien took damage")

def main():

    h=Hero(10,10)

    a=Alien(10,10)

    while h.health>0 and a.health>0:

        move=random.randint(0,1)

        if move==0:

            if h.blast():

                a.damage()

            else:

                if a.blast():

                    h.damage()

main()

In: Computer Science

In a national basketball​ association, the top​ free-throw shooters usually have probability of about 0.95 of...

In a national basketball​ association, the top​ free-throw shooters usually have probability of about 0.95 of making any given free throw. Complete parts a through c.
a. During a​ game, one such player shot 11 free throws. Let X =number of free throws made. What must you assume in order for X to have a binomial​ distribution?
b. Specify the values of n and p for the binomial distribution of X in part a.
c. Find the probability that the player made all 11 free​ throws, 10 free​ throws, and more than 8 free throws.

In: Statistics and Probability

13-1. The Hoylake Rescue Squad receives an emergency call every 1,2,3,4,5, or 6 hours, according to...

13-1.

The Hoylake Rescue Squad receives an emergency call every 1,2,3,4,5, or 6 hours, according to the following probability distribution:

The squad is on duty 24 hours per day, 7 days per week. Fill in the following graph.

Probability of Time Between Emergency Calls: Simulation: 72 hours
P(x) Cumulative Time (hrs) RN Time (hrs) Clock Number
0.05 0.05 1
0.10 0.15 2
0.30 0.45 3
0.30 0.75 4
0.20 0.95 5
0.05 1.00 6
         Average Time = #DIV/0!
EV = 0.00

In: Statistics and Probability

In a particular retail clothing store, approximately 30% of potential customers who walk into the store...

In a particular retail clothing store, approximately 30% of potential customers who walk into the store make a purchase.

In a random sample of 25 customers that walked into the store,

a. what is the probability that exactly 10 of the customers make purchases?

Round to 3 significant digits.

b. what is the probability that at least 2 of the customers make purchases?

Round to 3 significant digits.

c. how many of the customers are expected to make purchases?

Round to 3 significant digits.

d. what is the standard deviation of the number of customers who make purchases?

Round to 3 significant digits.

please provide correct answer.

In: Statistics and Probability

The time needed to complete a final examination in a particular college course is normally distributed...

The time needed to complete a final examination in a particular college course is normally distributed with a mean of 83 minutes and a standard deviation of 13 minutes. Answer the following questions.


a. What is the probability of completing the exam in one hour or less (to 4 decimals)?


b. What is the probability that a student will complete the exam in more than 60 minutes but less than 75 minutes (to 4 decimals)?


c. Assume that the class has 60 students and that the examination period is 90 minutes in length. How many students do you expect will be unable to complete the exam in the allotted time (to nearest whole number)?

In: Statistics and Probability

When we roll one die, we have a 1 in 6 probability of getting any particular...

When we roll one die, we have a 1 in 6 probability of getting any particular number on the die.   When we roll a pair of dice, there are 36 different pairs that can be produced, yet only 11 actual distinct values.

Explain how the probability associated with the roll of each individual die in the pair explains the higher variability in the total outcome of the roll of each pair. How do the concepts of permutations and combinations apply to this example? Discuss how the notion of degree of freedom can be used to illustrate the accumulating results of a set of dice rolls.

In: Statistics and Probability

Three hats each contain ten coins. Hat 1 contains two gold coins, five silver coins and...

  1. Three hats each contain ten coins. Hat 1 contains two gold coins, five silver coins and three copper coins. Hat 2 contains four gold coins and six silver coins. Hat 3 contains three gold coins and seven copper coins. We randomly select one coin from each hat.

    1. (a) The outcome of interest is the colour of each of the three selected coins. List the complete sample space of outcomes and calculate the probability of each.

    2. (b) Let X be the number of gold coins selected. Find the probability distribution of X.

In: Statistics and Probability

4 (a) Susan tries to exercise at ”Pure Fit” Gym each day of the week, except...

4 (a) Susan tries to exercise at ”Pure Fit” Gym each day of the week, except on the weekends (Saturdays and Sundays). Susan is able to exercise, on average, on 75% of the weekdays (Monday to Friday).

  1. Find the expected value and the standard deviation of the number of days she exercises in a given week.    [2 marks]
  2. Given that Susan exercises on Monday, find the probability that she will exercise at least 3 days in the rest of the week. [3 marks]
  3. Find the probability that in a period of four weeks, Susan exercises 3 or less days in only two of the four weeks.      [3 marks]

PLZ ANS THE 4a!

In: Statistics and Probability

2. Using diaries for many weeks, a study on the lifestyles of visually impaired students was...

2. Using diaries for many weeks, a study on the lifestyles of visually impaired students was conducted. The students kept track of many lifestyle variables including how many hours of sleep were obtained on a typical day. Researchers found that visually impaired students averaged 9.87 hours of sleep, with a standard deviation of 1.1 hours. Assume that the number of hours of sleep for these visually impaired students is normally distributed. a. What is the probability that a visually impaired student gets less than 6.1 hours of sleep? b. What is the probability that a visually impaired student gets between 6.5 and 7.89 hours of sleep?

In: Statistics and Probability

Internal auditors sometimes check random samples of transactions within a database. Suppose that in a particular...

Internal auditors sometimes check random samples of transactions within a database. Suppose that in a particular set of transactions, 2% contain an error of some kind. The auditor takes a random sample of 20 transactions for checking. Let X denote the number of transactions found to be in error in the sample.

(a) State the probability distribution of X (including the values of all parameters) and find the probability that 2 transactions are found to be in error.

(b) If three or more transactions are found to be in error then a larger sample is taken for checking. How often will this happen? (Use the appropriate template).

(c) What assumption is required for the validity of the above answers?

In: Statistics and Probability