Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

i wrote this code to find the largest and smallest (int)number but it does not work

I wrote this code to get an input of several int numbers and write the smallest and largest of them but the code does not work.

numbers=[]    
num=input('enter your number')    
Int_num=int(num)    
Int_num.append(numbers)    
print('maximum number is:',max(numbers))    
print('minimum number is:',min(numbers))

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In order to get a sequence of numbers:

numbers = []
while True:
  number = input('Enter a number or enter q to exit: ')
  if number == 'q':
      break
  else:  
      numbers.append(int(number))

print(f'Max: {max(numbers)}, Min: {min(numbers)}')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading