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
Vaselesa [24]
3 years ago
5

Def find_max(nums: [int]) -> int:

Computers and Technology
1 answer:
SIZIF [17.4K]3 years ago
8 0

Answer:

The program in recursion is:

def find_max(nums):

    if len(nums) == 0:

         return "None"

    elif len(nums) == 1:

         return nums[0]

    else:

         return max(nums[0],find_max(nums[1:]))

Explanation:

This line defines the function

def find_max(nums):

This checks if the list is empty.

    if len(nums) == 0:

If yes, it returns "None"

         return "None"

If the list has just one element

    elif len(nums) == 1:

It returns the only element as the maximum

         return nums[0]

If the list has numerous elemente

    else:

The maximum is determined recursively

         return max(nums[0],find_max(nums[1:]))

To the (b) part:

<em>This program does not necessarily need to be done recursively because the max built-in function can be used to determine the maximum of the list in just one line of code and it is more efficient.</em>

You might be interested in
Recursive definitions for subsets of binary strings. About Give a recursive definition for each subset of the binary strings. A
Masteriza [31]

Answer:

this program was written in JAVA

Explanation:

import java.util.Scanner;

public class RecursivePalindromeJava

{

public static boolean checkPalindrome(String str)

{

if(str.length() == 0 || str.length() == 1)

return true;

if(str.charAt(0) == str.charAt(str.length() - 1))

return checkPalindrome(str.substring(1, str.length() - 1));

return false;

}

public static void main(String[]args)

{

Scanner sc = new Scanner(System.in);

System.out.println("Please enter a string : ");

String strInput = sc.nextLine();

if(checkPalindrome(strInput))

{

System.out.println(strInput + " is palindrome");

}

else

{

System.out.println(strInput + " not a palindrome");

}

sc.close();

)

)

8 0
3 years ago
Which enables users to try an application before they commit to buying it?
adelina 88 [10]

Answer:

shareware

Explanation:

It is the shareware, which is available for free for a certain period, and after that, the actual fee is charged for continued usage. The public domain is free from copyright, patent or trademark laws, and is the public property. The open-source is the free code of software that is available with code for the whole developer community. And it is shared among all the developers. And the developer can be anybody. The freeware is the software that is provided free of cost by the publisher. And there is no set of rights, licenses or EULA that governs its distribution, and each publisher frames his own set of rules for the usage of the freeware.

8 0
3 years ago
Read 2 more answers
Complete the following sentences by choosing the best answer from the drop-down menus.
aleksandrvk [35]

Answer:

b. Application software

Explanation:

Applications are type of software that are installed in a specific operating system of a computer that deviates from those system software installed together with the system itself. These third-party applications are necessary for other functions such as entertainment, business, leisure and other needs addressing of which the system software can't provide.

Examples:

Microsoft Office Word, Excel, Powerpoint

i think i did that right:)

7 0
3 years ago
Which of the following is not a requirement of a linear programming problem?
vampirchik [111]

requirements of a linear programming problem, moderate

6 0
3 years ago
Which type of data is shown below?<br> apple, 0.85<br> banana, 0.90<br> peach, 1.50
d1i1m1o1n [39]

Answer:

dictionary data

Explanation:

data = {"apple" : 0.85, "banana" : 0.90, "peach": 1.50}

4 0
3 years ago
Other questions:
  • g Create a public non-final generic class called YourSimpleLinkedList. You should extend SimpleLinkedList which is parameterized
    10·1 answer
  • ____________ is defined as the set of activities that revolve around a new software product, from its inception to when the prod
    11·1 answer
  • Which of the following is Microsoft’s fastest, most efficient operating system to date: a. Offering quicker application start up
    14·1 answer
  • Examine the following algorithm.
    9·1 answer
  • For each compound below, identify any polar covalent bonds and indicate the direction of the dipole moment using the symbols δ +
    12·1 answer
  • You don't have to answer them all, just give me 2 or 3. Thanks
    7·1 answer
  • The ____ data source class that reduce your need for accessing individual Data Provider class when you are connecting to an Acce
    15·1 answer
  • Discuss your favorite video games and why you like them. What types of features make a game fun to play? Why are they features e
    11·2 answers
  • A file named "games.txt" exists and has 80 lines of data. You open the file with the following line of code.
    7·2 answers
  • Is the following statement valid or invalid? y + 1 = 6​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!