file.py
# Write a program to get largest number from list
list1=[*range(1,50)]
print(max(list1))
#alternate method
largest=0
for i in list1:
if i>largest:
largest=i
print(largest)
file.py
Output:
49
49
# Write a program to get largest number from list
list1=[*range(1,50)]
print(max(list1))
#alternate method
largest=0
for i in list1:
if i>largest:
largest=i
print(largest)
Output:
49
49