156k views
23 votes
Sonja is writing a program to compare two numbers and print the larger number. Which of these should be used?

a while loop
if and else
if, elif, and else
a string variable

User Drejc
by
4.9k points

1 Answer

11 votes

Answer:

if and else

Step-by-step explanation:

if (num1 > num2):

print(num1)

else:

print(num2)

User Pinichi
by
5.0k points