rylan8394 rylan8394
  • 01-02-2018
  • Computers and Technology
contestada

Given the variables name1 and name2, write a fragment of code that assigns the larger of their associated values to first.

Respuesta :

Kalahira
Kalahira Kalahira
  • 14-02-2018
We can compare strings like numbers,
 if "a" > "b":
   do something
   Solutions will be

   Python:
  first = max(name1, name2)
 second = min(name1, name2)

   Or if we are not supposed to use max() and min(), we can achieve the same thing with a conditional,
 Python:
  if name1 > name2: ...
Answer Link

Otras preguntas

Kelsey painted 1/4 of her bedroom in 3/7 of an hour at this rate how long would it take her to paint the entire room
What questions can you ask about Cleopatra that incorporates either leadership and legacy. Eg. What long lasting impacts did Julius Caesar's reign have on the R
Which formula represents a nonpolar molecule containing polar covalent bonds? (1) H2O (3) NH3 (2) CCl4 (4) H2
Why does the Mandarin’s daughter give advice from behind a screen?
In 451 BCE Roman laws were written down, they were known as the Twelve Tables. What caused the Roman government to finally write these laws down? Why was it imp
What is the domain and range of y = x+1/x-1
How many milliliters of 0.100 M NaOH(aq) would be needed to completely neutralize 50.0 milliliters of 0.300 M HCl(aq)? (1) 16.7 mL (3) 150. mL (2) 50.0 mL (4) 3
What Is Cholecalciferol Granule Used For?
A quadrilateral has two right angles. The measure of the third angle is 99 degrees. What is the measure of the fourth angle.
a glacier that covers a wide area is called a