Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Analyzing code samples, comparing more than 2 numbers

# Read three numbers.
number1 = int(input("Enter the first number: "))
number2 = int(input("Enter the second number: "))
number3 = int(input("Enter the third number: "))

# Check which one of the numbers is the greatest
# and pass it to the largest_number variable.

largest_number = max(number1, number2, number3)

# Print the result.
print("The largest number is:", largest_number)

#output:

Enter the first number: 55
Enter the second number: 96
Enter the third number: 2

The latgest number is:  96
---------------------------------  
Enter the first number: 8
Enter the second number: 3
Enter the third number: 101
  
The latgest number is:  101
---------------------------------  
Enter the first number: 556
Enter the second number: 6
Enter the third number: 82
  
The latgest number is:  556
Source by edube.org #
 
PREVIOUS NEXT
Tagged: #Analyzing #code #comparing #numbers
ADD COMMENT
Topic
Name
6+1 =