Question

Can you write the Python code of the algorithm that three integers from the user and...

Can you write the Python code of the algorithm that three integers from the user and prints the smallest one please?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

num1 = int(input('Enter 1st integer : '))
smallest = num1  # Assume first number to be the smallest

num2 = int(input('Enter 2nd integer : '))
if smallest > num2: # if second entered number is smaller than our presumed smallest then change it 
    smallest = num2
    
num3 = int(input('Enter 3rd integer : '))
if smallest > num3: # if third entered number is smaller than our presumed smallest then change it 
    smallest = num3
    
print('Smallest number is :',smallest) # Printing the smallest of the three numbers

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Can you write the Python code of the algorithm that three integers from the user and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT