Ask Question
9 December, 05:55

2.8 Code Practice: Question 1

Write a program that takes three numbers as input and prints the largest.

Sample run:

Enter a number: 20

Enter a number: 50

Enter a number: 5

Largest: 50

+1
Answers (1)
  1. 9 December, 06:53
    0
    First take the input of the numbers:

    x = int (input ("Enter the number of elements to be in the list:"))

    b=[ ]

    for i in range (0, x):

    a=int (input ("Element: "))

    b. append (a)

    c=[ ]

    d=[ ]

    for i in b:

    if (i%2==0):

    c. append (i)

    else:

    d. append (i)

    c. sort ()

    d. sort ()

    count1=0

    count2=0

    for k in c:

    count1=count1+1

    for j in d:

    count2=count2+1

    print ("Largest even number:", c[count1-1])

    print ("Largest odd number", d[count2-1])
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “2.8 Code Practice: Question 1 Write a program that takes three numbers as input and prints the largest. Sample run: Enter a number: 20 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers