1answer.
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
Artemon [7]
4 years ago
11

Create a class called Animal that accepts two numbers as inputs and assigns them respectively to two instance variables: arms an

d legs. Create an instance method called limbs that, when called, returns the total number of limbs the animal has. To the variable name spider, assign an instance of Animal that has 4 arms and 4 legs. Call the limbs method on the spider instance and save the result to the variable name spidlimbs.
Computers and Technology
1 answer:
vichka [17]4 years ago
6 0

Answer:

A class is basically a scope inside which various code (especially function definitions) is executed, and the locals to this scope become attributes of the class, and of any objects constructed by this class.

Python is an object-oriented programming language, which means it manipulates programming constructs called objects. You can think of an object as a single data structure that contains data as well as functions; functions of objects are called methods. For example, any time you call len("Eric"). Python is checking to see whether the string object you passed it has a length, and if it does, it returns the value associated with that attribute. When you call my_dict.items(). Python checks to see if my_dict has an items() method (which all dictionaries have) and executes that method if it finds it.

But what makes "Eric" a string and my_dict a dictionary? The fact that they're instances of the str and dict classes, respectively. In other words,a class is just a way of organizing and producing objects with similar attributes and methods.

You might be interested in
Write a method named quarterstodollars. the method should accept an int argument that is a number of quarters, and return the eq
enyata [817]
 public static void quarterstodollars(String[] args) {    Scanner input = new Scanner(System.in);    System.out.println("Enter number of Quarters:");
    System.out.print("Quarters:");    int Q1 = input.nextInt();
DecimalFormat fmt = new DecimalFormat("$#,###.##");    System.out.println("Total:"+fmt.format(calctotal(Q1)));}public static double calctotal(int Q1) {    double total;    total=(0.25 * Q1);    return (total);}

Hope this helps!
7 0
4 years ago
Read 2 more answers
A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set
Vanyuwa [196]

Answer:

from functools import reduce

def mean(mylist):

   score = reduce(lambda x,y: x + y, mylist)/ len(mylist)

   return score

def median(mylist):

   sorted(mylist)

   list_len = len(mylist) % 2

   i = round(len(mylist)/2)

   x = len(mylist)//2

   if list_len == 0:

       median = (mylist[x] + mylist[x+1]) / 2  

   else:

       median = mylist[i]

   return median

def mode(mylist):

   unique = set(mylist)

   unique = list(unique)

   collector = [mylist.count(key) for key in unique]

   maxi = max(collector)

   loc = collector.index(maxi)

   return unique[loc]

def main():

   scores = input( 'Enter list of numbers: ').split(",")

   scores = [int(score) for score in scores]

   

   operation = input('Enter operation: ')

   operator = ['mean', 'median', 'mode']

   

   for x in iter(list, 0):

       if operation in operator:

           break

       print("Invalid operation: ")

       operation = input('Enter operation')

   

   index_loc = operator.index(operation)

   

   if index_loc == 0:

       return mean(scores)

   elif index_loc == 1:

       return median(scores)

       #return np.median(scores)  can be used of the defined function

   elif index_loc == 2:

       #return stats.mode(scores)[0]  can be used of the defined function

       return mode(scores)

print( main( ) )

Explanation:

The main python function calls conditionally three statistical functions namely mean, median and mode. It prompts for user input for a list of integer numbers and a function name name to return the corresponding result.

8 0
3 years ago
Im stuck in this and its a easy
Tamiku [17]

Answer:

just turn off your computer.

Explanation:

4 0
3 years ago
Read 2 more answers
How to get a javascript's varible
Kamila [148]

Answer:

If you want to use a js variable in a php script you MUST pass it within a HTTP request. There are basically two ways: Submitting or reloading the page.

Explanation:

In programming, just like in algebra, we use variables in expressions (total = price1 + price2). From the example above, you can calculate the total to be 11. JavaScript variables are containers for storing data values. All JavaScript variables must be identified with unique names. These unique names are called identifiers.

8 0
2 years ago
What term is commonly used to refer to HTML formatting?
yanalaym [24]

Answer: No particular term

Explanation:

If by formatting you are referring to the presentation of the html page or website means how the forntend looks then css is used. In case of text formatting then bold <b><b/> italic <i></i> small <small></small> superscript <sup></sup> subscript <sub></sub> etc tags available

6 0
4 years ago
Other questions:
  • What formula would be used to add two cells together after the equal sign?
    9·2 answers
  • a sign is to be hung from the end of a thin pole, and the pole supported by a single cable. your design firm brainstorms the six
    13·1 answer
  • During which phase of film making does the team outline their vision for the film?
    5·1 answer
  • Hoda wants to create a new presentation in PowerPoint with existing graphics and designs. What is the easiest and fastest way fo
    14·1 answer
  • Using media allows us to:
    15·1 answer
  • Write a Python Program that:
    9·1 answer
  • Can anybody please help me with 7.4.7 spelling bee codehs?
    12·1 answer
  • How does the technology affect you daily living? Give situations where you use technology and how it helped you.​
    5·1 answer
  • How have cell phones improved our lives​
    5·1 answer
  • What is a computer?write any four features of computer​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!