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
Paha777 [63]
3 years ago
12

Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. Fo

r example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two
Computers and Technology
1 answer:
RoseWind [281]3 years ago
6 0

Answer:

The solution code is written in Python

  1. def max(a, b):
  2.    if(a > b):
  3.        return a  
  4.    else:
  5.        return b
  6. num1 = int(input("Please input the first number: "))
  7. num2 = int(input("Please input the second number: "))
  8. print(max(num1, num2))

Explanation:

Firstly create a function max that accepts two input, a and b, as required by question (Line 1). In the function, create if statement to check if a greater than b return a and vice versa (Line 2 -5).

In the main program (Line 7 - 10), prompt user to input two numbers (Line 7 - 8). At last call the function by passing num1 and num2 as arguments and print the result (Line 10).

You might be interested in
A palindrome is a string that reads the same from left to right and from right to left. Design an algorithm to find the minimum
stepladder [879]

Answer:

Explanation:

The following code is written in Python. It is a recursive function that tests the first and last character of the word and keeps checking to see if each change would create the palindrome. Finally, printing out the minimum number needed to create the palindrome.

import sys

def numOfSwitches(word, start, end):

   if (start > end):

       return sys.maxsize

   if (start == end):

       return 0

   if (start == end - 1):

       if (word[start] == word[end]):

           return 0

       else:

           return 1

   if (word[start] == word[end]):

       return numOfSwitches(word, start + 1, end - 1)

   else:

       return (min(numOfSwitches(word, start, end - 1),

                   numOfSwitches(word, start + 1, end)) + 1)

word = input("Enter a Word: ")

start = 0

end = len(word)-1

print("Number of switches required for palindrome: " + str(numOfSwitches(word, start, end)))

3 0
3 years ago
Steve adds a second 1-GB 240-pin DIMM to his PC, which should bring the total RAM in the system up to 2 GB. The PC has an Intel
egoroff_w [7]

Answer:

Option A is correct.

Explanation:

He attaches the second 1 Gigabyte 240 pins DIMM for his system the overall RAM will be up around 2 Gigabytes. System is fitted with Intel Core 2 Dual 3-GHz cpu as well as three 240 pins DIMM ports on the motherboard. Transforms on a system, just 1 Gigabytes of RAM is seen through that RAM count.

Thus, the following issue is much more probably to be the failure to correctly grab that RAM.

5 0
4 years ago
A company has offices in Honolulu, Seattle, Ogden, and Dublin, Ireland. There are transmission links between Honolulu and Seattl
Dmitry_Shevchenko [17]

Answer:

See explaination

Explanation:

Looking at telecommunications network, a link is a communication channel that connects two or more devices for the purpose of data transmission. The link is likely to be a dedicated physical link or a virtual circuit that uses one or more physical links or shares a physical link with other telecommunications links.

Please check attachment for further solution.

4 0
4 years ago
Who know's web Design
balu736 [363]

Answer: B

Explanation:

inline is the answer

4 0
3 years ago
Describe Variables in detail. Give examples
KATRIN_1 [288]

Answer:

A variable is a quantity that may be changed according to the mathematical problem. The generic letters which are used in many algebraic expressions and equations are x, y, z. In other words, a variable is a symbol for a number where the value is not known. For example, x + 5 = 10. Here “x” is a variable.

Explanation:

please mark me brainliest

3 0
3 years ago
Read 2 more answers
Other questions:
  • Store shelves are empty during periods of Excess Demand. What is another term for Excess Demand?
    8·1 answer
  • You can add envelopes to existing documents. <br> a. True <br> b. False
    10·1 answer
  • A personal business letter is a letter that is ____.
    13·1 answer
  • When is it most appropriate to quote from an e-mail message in a response?
    9·2 answers
  • What is the purpose of a diode in a cordless drill or power screwdriver?
    14·1 answer
  • Business competition is no longer limited to a particular country or even a region of the world.
    10·1 answer
  • The time delay of a long-distance call can be determined by multiplying a small fixed constant by the number of communication li
    8·1 answer
  • What is one advantage of top-down programming design?
    8·1 answer
  • What feature is required to track customer search terms on a website?
    9·1 answer
  • Im trying to do an animation only using simplegui in python and my objective is make the ball enters frame, be confused and jump
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!