Computer Science
Write a short program to find largest number of a list of numbers entered through keyboard.
Python
Python Control Flow
47 Likes
Answer
print("Enter numbers:")
print("(Enter 'q' to see the result)")
l = input()
if l != 'q' and l != 'Q' :
l = int(l)
while True:
n = input()
if n == 'q' or n == 'Q' :
break
n = int(n)
if n > l :
l = n
print("Largest Number =", l)
Output
Enter numbers:
(Enter 'q' to see the result)
3
5
8
2
4
q
Largest Number = 8
Answered By
18 Likes
Related Questions
Write a program to take N (N > 20) as an input from the user. Print numbers from 11 to N. When the number is a multiple of 3, print "Tipsy", when it is a multiple of 7, print "Topsy". When it is a multiple of both, print "TipsyTopsy".
Write a program to input N numbers and then print the second largest number.
Write a program to take an integer a as an input and check whether it ends with 4 or 8. If it ends with 4, print "ends with 4", if it ends with 8, print "ends with 8", otherwise print "ends with neither".
Given a list of integers, write a program to find those which are palindromes. For example, the number 4321234 is a palindrome as it reads the same from left to right and from right to left.