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
photoshop1234 [79]
3 years ago
11

Define the function max2 that takes two integers as arguments and returns the largest of them. Then define the function max_list t

hat returns the largest of the elements in a nonempty list of integers by calling max2
Computers and Technology
1 answer:
Serga [27]3 years ago
6 0

Answer:

def max_list(a):

   return max(a)

def max2(a,b):

   return max(a,b)

s=max2(2,3)

print('max of two number is:')

print(s)

a=[1,2,3,4,5,6,7,8,9,10]

max_in_list = max_list(a)

print('\n max element in whole list is:')

print(max_in_list)

Explanation:

Above program is written in python:

Function max2 accept two parameters and return one which is greatest of both and funtion max_list accept a parameter list and returns the greatest number in list.

Note: take care of indentation of function while pasting this code on your compiler or ide

You might be interested in
Explain in details how Galen , a physician during the Middle Ages, expanded on Hippocrates' theory of the four humors and explai
NISA [10]

Answer:

Galen expanded on the Hippocrates' theory of humor by assigning personalities, moods, behaviors, and emotions to the four humors. He believed blood stood for sanguine personality, black bile for a melancholic personality, yellow bile for a choleric personality and phlegm for a phlegmatic personality.

Explanation:

Hippocrates put forward the theory of the four humors. According to the theory, the human body is made up of four substances: black bile, yellow bile, blood, and phlegm. A healthy human body is the product of a balance of among the four humors, while diseases results if there is an imbalance among the four humors.

Galen, a keen admirer of Hippocrates' ideas, further elaborated on this theory and believed that they affected personalities, moods, behaviors, and emotions.

The personalities assigned the four humors are as follows:

People with predominantly black bile are Melancholic (corresponding to the season of autumn dry and cold): They are very sensitive, and enjoy artistic pursuits.

People with predominantly yellow bile are Choleric (corresponding to the season of summer, dry and hot): They possess a passionate temperament, They have a lot of ambition, energy, drive, enormous vitality but are domineering and get angry quickly.

People with predominantly blood are Sanguine (corresponding to the season of spring, wet and hot): These people are confident, joyful, optimistic, expressive, confident, rational and sociable.

People with predominantly phlegm are Phlegmatic (corresponding to the season of winter, wet and cold): They are deep thinkers, fair, calm, very consistent, relaxed, and observant, willing to compromise, and hard workers.

7 0
2 years ago
(True or False) The speed at which data travels on a bus is referred to as the word size.
geniusboy [140]

Answer:

True

Explanation:

4 0
2 years ago
Read 2 more answers
Create a class called StockTester that has the following fucntionality. a. Create a main method with an ArrayList named dataStoc
myrzilka [38]

Solution :

public class $\text{Stock}$ {

private $\text{String}$ stockName, $\text{purchaseDate}$;

private $\text{int}$ nShares;

private $\text{double}$ price;

 

public $\text{Stock}()$

{

this.stockName = "";

this.purchaseDate = "";

this.nShares = 0;

this.price = 0.0;

}

public Stock(String stockName, String purchaseDate, int nShares, double price) {

this.stockName = stockName;

this.purchaseDate = purchaseDate;

this.nShares = nShares;

this.price = price;

}

public String getStockName() {

return stockName;

}

public void setStockName(String stockName) {

this.stockName = stockName;

}

public String getPurchaseDate() {

return purchaseDate;

}

public void setPurchaseDate(String purchaseDate) {

this.purchaseDate = purchaseDate;

}

public int getnShares() {

return nShares;

}

public void setnShares(int nShares) {

this.nShares = nShares;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

 

public String toString()

{

return("Stock name: " + this.stockName + "\nPurchase date: " + this.purchaseDate

+ "\nNumber of shares of stock: " + this.nShares + "\nPrice: $" + String.format("%,.2f", this.price));

}

 

public void printStock()

{

System.out.println("Stock name: " + this.stockName + "\nPurchase date: " + this.purchaseDate

+ "\nNumber of shares of stock: " + this.nShares + "\nPrice: $" + String.format("%,.2f", this.price)

+ "\n");

}

}

StockTester.java (Driver class)

import $\text{java.io.}$File;

import $\text{java.io.}$File$\text{NotFound}$Exception;

import $\text{java.util.}$ArrayList;

import $\text{java.util.}$Scanner;

$\text{public}$ class StockTester {

 

private static final String FILENAME = "StockInfo$.$csv";

 

public static $\text{void}$ main($\text{String}[]$ args)

{

ArrayList$$ dataStock = $\text{readData}$(FILENAME);

 

System.out.println("Initial stocks:");

for(Stock s : dataStock)

s.printStock();

 

System.out.println("Adding a new Stock object to the list..");

Stock newStock = new Stock("Gamma", "03/01/20", 100, 50.5);

dataStock.add(newStock);

 

System.out.println("\nStocks after adding the new Stock..");

for(Stock s : dataStock)

s.printStock();

 

Stock targetStock = dataStock.get(3);

double reqReturn = requiredReturn(targetStock, 4000, 3);

System.out.println("Required rate of return = " + String.format("%.2f", reqReturn) + "%");

}

 

private static ArrayList<Stock> readData(String filename)

{

ArrayList<Stock> stocks = new ArrayList<>();

Scanner fileReader;

try

{

fileReader = new Scanner(new File(filename));

while(fileReader.hasNextLine())

{

String[] data = fileReader.nextLine().trim().split(",");

String stockName = data[0];

String purchaseDate = data[1];

int nShares = Integer.parseInt(data[2]);

double price = Double.parseDouble(data[3]);

 

stocks.add(new $\text{Stock}$(stockName, $\text{purcahseDate}$, nShares, price));

}

fileReader.close();

}catch(FileNotFoundException fnfe){

System.out.println(filename + " cannot be found!");

System.exit(0);

}

return stocks;

}

 

private static double requiredReturn(Stock s, double targetPrice, int years)

{

double reqReturn;

 

double initialPrice = s.getPrice() * s.getnShares();

reqReturn = ((targetPrice - initialPrice) / initialPrice * years) * 100;

 

return reqReturn;

}

}

3 0
2 years ago
Who is responsible for keeping your facility in compliance? A) Technicians B) Supervisors C) Owners D) All of the above
zhenek [66]

Based on my personal experience in the workforce, all of the above would be the correct answer. That's based off my experience though. Owners would regularly come in and talk to our managers and employees to make sure everything was kept in order and in compliance. The only other answer I could see fit would be supervisors. Hope I was able to help :)

3 0
2 years ago
Simone needs to add a query for multiple tables in her database. She is using Access 2016. Which tab should she use to add the q
pshichka [43]
Database tools should be the answer idrk
4 0
3 years ago
Other questions:
  • What happens if you give false information on your driver license application?
    12·1 answer
  • 5. Create a variety of test cases focusing on the sorting algorithm, such as the final element is the smallest, the entire set i
    8·1 answer
  • What is one way to maintain Internet safety? a) avoid interacting with people on the Internet. B) avoid giving out information a
    7·1 answer
  • Assume you previously entered these lines of code.
    14·2 answers
  • Which function would you use to make sure all names are prepared for a mailing label?
    10·2 answers
  • What are the differences in LAN and WAN and how they are used to Increase Cybersecurity
    7·1 answer
  • )finding an unused location in the hash table is called
    5·1 answer
  • What is the answer 11100+01010​
    8·1 answer
  • Which are examples of basic text structures? Check all that apply.
    8·2 answers
  • Whats your favorite .io game (example krunker.io, gawd.io)<br> (PS FWEE PTS BOIS)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!