answer.
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
dimaraw
23 days ago
5

Assign max_sum with the greater of num_a and num_b, PLUS the greater of num_y and num_z. Use just one statement. Hint: Call find

_max() twice in an expression.
Sample output with inputs: 5.0 10.0 3.0 7.0
max_sum is: 17.0
1 det find_max(num_1, num_2):
2 max_val = 0.0
3
4 if (num_1 > num_2): # if num1 is greater than num2,
5 max_val = num_1 # then num1 is the maxVal.
6 else: # Otherwise,
7 max_val = num_2 # num2 is the maxVal
8 return max_val
9
10 max_sum = 0.0
11
12 num_a = float(input)
13 num_b = float(input)
14 num_y = float(input)
15 num_z = float(input)
16
17"" Your solution goes here
18
19 print('max_sum is:', max_sum)
Computers and Technology
1 answer:
Rzqust [894]23 days ago
5 0

Answer:

def find_max(num_1, num_2):

   max_val = 0.0

   if (num_1 > num_2): # if num1 exceeds num2,

       max_val = num_1 # then num1 becomes the maxVal.

   else: # In the other case,

       max_val = num_2 # num2 becomes the maxVal

   return max_val

max_sum = 0.0

num_a = float(input())

num_b = float(input())

num_y = float(input())

num_z = float(input())

max_sum = find_max(num_a, num_b) + find_max(num_y, num_z)

print('max_sum is:', max_sum)

Explanation:

I incorporated the part that was missing. Additionally, you neglected to include parentheses. Everything I added is emphasized.

To determine the max_sum, you should invoke the find_max function two times and add the outputs. In the first invocation, apply the variables num_a and num_b (This will provide the larger of the two). In the second invocation, apply the variables num_y and num_z (This will again yield the greater of the two)

You might be interested in
Technological improvements have allowed people to inhabit a wider variety of places more easily. Please select the best answer f
zubka84 [942]

True. Technological advances have simplified and accelerated life, making it easier for people to live in a broader range of locations. Purchasing land or a home from a developer is one example of how this facilitates obtaining a desired place.

9 0
13 days ago
Read 2 more answers
OCR Land is a theme park aimed at children and adults. Entrance tickets are sold online. An adult ticket to OCR Land costs £19.9
Rzqust [894]

Answer:

count = 0

while count!= 8:

height = float(input("Enter the height of the rider: "))

if height >= 140:

print("You may ride")

count += 1

else:

if height >= 120:

answer = input("Is the rider accompanied by an adult (yes/no): ")

if answer == "yes":

print("You may ride")

count += 1

else:

print("You are not permitted to ride")

else:

print("You are not permitted to ride")

Explanation:

Begin with a count of zero, which will track the number of riders allowed. Use a while loop that continues until the count reaches 8. During each iteration, request the user's height. If the height is 140 cm or taller, display "You may ride" and increment the count. If the height is 120 cm or more, check if the rider is with an adult. If not, show the message "You are not permitted to ride"; otherwise, allow the ride and increase the count. If the height is below 120 cm, deny the ride.

5 0
29 days ago
Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05
8_murik_8 [892]

Answer:

Below is the Python code:

stock_prices = input().split() #this takes input and separates it into a list

for price in stock_prices: #this loops through each stock price

   print("$",price) #this outputs each stock price prefixed by a dollar sign

Explanation:

The logic behind the program is clearly outlined in the attached comments. To illustrate the program's workings, let's consider an example:

Imagine the user inputs the stock_prices values of

34.62 76.30 85.05

The input() method captures user input, while the split() method divides the input string, providing a list of strings as:

['34.62', '76.30', '85.05']

Following that, the loop statement for price in stock_prices: iterates through each item in the list, and print("$",price) displays each value from the list on the output screen with a dollar sign, as follows:

$ 34.62                                                                                                            

$ 76.30                                                                                                            

$ 85.05    

4 0
1 month ago
A regional trucking company landed a contract to supply products for a major retailer. To do this, it needs to hire an IT profes
zubka84 [942]
I believe the answers are F and A
.
8 0
13 days ago
This question involves the creation of user names for an online system. A user name is created based on a user’s first and last
Rzqust [894]

Response:

Refer to the explanation

Clarification:

import java.util.*;

class UserName{

ArrayList<String> potentialNames;

UserName(String fName, String lName){

if(this.isValidName(fName) && this.isValidName(lName)){

potentialNames = new ArrayList<String>();

for(int j=1;j<fName.length()+1;j++){

potentialNames.add(lName+fName.substring(0,j));

}

}else{

System.out.println("firstName and lastName should only consist of letters.");

}

}

public boolean isTaken(String name, String[] array){

for(int j=0;j<array.length;j++){

if(name.equals(array[j]))

return true;

}

return false;

}

public void removeUnavailableUserNames(String[] takenNames){

String[] namesArray = new String[this.potentialNames.size()];

namesArray = this.potentialNames.toArray(namesArray);

for(int j=0;j<takenNames.length;j++){

if(isTaken(takenNames[j],namesArray)){

int idx = this.potentialNames.indexOf(takenNames[j]);

this.potentialNames.remove(idx);

namesArray = new String[this.potentialNames.size()];

namesArray = this.potentialNames.toArray(namesArray);

}

}

}

public boolean isValidName(String str){

if(str.length()==0) return false;

for(int j=0;j<str.length();j++){

if(str.charAt(j)<'a'||str.charAt(j)>'z' && (str.charAt(j)<'A' || str.charAt(j)>'Z'))

return false;

}

return true;

}

public static void main(String[] args) {

UserName user1 = new UserName("john","smith");

System.out.println(user1.potentialNames);

String[] existing = {"harta","hartm","harty"};

UserName user2 = new UserName("mary","hart");

System.out.println("potentialNames prior to removal: "+user2.potentialNames);

user2.removeUnavailableUserNames(existing);

System.out.println("potentialNames following removal: "+user2.potentialNames);

}

}

8 0
1 month ago
Other questions:
  • In the Scrum board, prioritizing the issue backlog is done in the ———- mode.
    7·1 answer
  • A have a string, called "joshs_diary", that is huge (there was a lot of drama in middle school). But I don't want every one to k
    5·1 answer
  • Write a sequence of statements that create a file named "greeting" and write a single line consisting of "Hello, World!" to that
    5·1 answer
  • Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that holds the
    9·1 answer
  • Users report that the network access is slow. After questioning the employees, the network administrator learned that one employ
    7·1 answer
  • Which generation of programming languages provides programmers with a visual environment for coding programs?
    12·1 answer
  • Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only
    9·2 answers
  • Disk scheduling algorithms in operating systems consider only seek distances, because Select one: a. modern disks do not disclos
    13·1 answer
  • Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
    9·1 answer
  • Explain what might happen if two stations are accidentally assigned the same hardware address?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!