337,351 views
9 votes
9 votes
This coding language is Python.

Please help, I'm having a hard time figuring this out.

Write a program that takes three numbers as input from the user, and prints the largest.

Sample Run
Enter a number: 20
Enter a number: 50
Enter a number: 5

Largest: 50
Hint: Remember that the numbers should be compared numerically. Any input from the user must be transformed into an integer, but printed as a string.

This is my code:
var = input("Enter a number:")
vartwo = input("Enter a number: ")
varthree = input("Enter a number: ")

print("\\")
print (max(var, vartwo, varthree))
I'm not sure how to do print("Largest: ") on the same line as print (max(var, vartwo, varthree)). Please help!

User Kyle West
by
2.1k points

1 Answer

8 votes
8 votes

Answer:

Oh, man. You're wild for that.

Here you go:

var = input("Enter a number: ")

vartwo = input("Enter a number: ")

varthree = input("Enter a number: ")

print("\\")

breh= max(var, vartwo, varthree)

print("Largest number:", breh)

Step-by-step explanation:

Just put them in a variable, lol.

You put them in 1 print statement.

User Raj Parmar
by
3.3k points