Write a function that takes the input of two numbers, and outputs the greater value.

Example:def greater():num1 = int(input("Enter a number")num2 = int(input("Enter another number")if num1>num2 print(num1)elif num1<num2 print(num2)else print(num1)greater()

Answered by Alex H. Python tutor

1666 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

How do I use for loops in Python?


Ask the user for a number and output the smallest divisor, bigger than one, for the inputted number. Output "Prime" if the number is a prime number.


Explain the difference between local and global variables


What would you expect to be the output of the following code snippet: `a = [1, 2, 3]; b = a; b[1] = 4; print(a); print(b);`, and why?


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2024

Terms & Conditions|Privacy Policy