Project Level 1: Beginner
This project is designed for beginner learners who are still learning and practicing Python fundamentals.
Project Description
This program defines three numbers and determines which one is the largest. It then displays the largest number.
How the Project Works
Start by defining three numbers in your script:
num1 = 12
num2 = 45
num3 = 32
Create an if-elif-else algorithm that finds out the largest number of the three. Here is the backbone of the script to get you started:
num1 = 12
num2 = 45
num3 = 32
if num1>...:
...
elif ...
...
else:
...
print(f"The largest number is {}")
And here is the expected output:
Prerequisites
Required Libraries:
Required Files: No files are required.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
Once you code the project, compare it with our solution below.
num1 = 12
num2 = 45
num3 = 32
if num2 > num1 and num2 > num3:
max_number = num2
elif num2 < num3 and num1 < num3:
max_number = num3
else:
max_number = num1
print(f"The largest number is {max_number}")
num1=float(input("Ingrese el primer numero: "))
num2=float(input("Ingrese el segundo numero: "))
num3=float(input("Ingrese el tercer numero: "))
if num1>num2 and num1>num3:
print(f'El numero mayor es: {num1}')
elif num2>num1 and num2>num3:
print(f'El numero mayor es: {num2}')
else:
print(f'El numero mayor es: {num3}')