Skip to content

Instantly share code, notes, and snippets.

@mrspucches
Last active June 18, 2017 23:22
Show Gist options
  • Save mrspucches/6233917376d4560c4bc1b9879ba97125 to your computer and use it in GitHub Desktop.
Save mrspucches/6233917376d4560c4bc1b9879ba97125 to your computer and use it in GitHub Desktop.
Simple, which rectangle input is larger than the other.
def rectangle1():
width1 = int(input('Enter the width of rectangle 1: '))
height1 = int(input('Enter the height of rectangle 1: '))
print('The area of rectangle 1 is: ', width1 * height1)
return width1 * height1
def rectangle2():
width2 = int(input('Enter the width of rectangle 2: '))
height2 = int(input('Enter the width of rectangle 2: '))
print('The area of rectangle 2 is: ', width2 * height2)
return width2 * height2
if rectangle1() < rectangle2():
print('Rectangle 1 is bigger than rectangle 2')
elif rectangle2() > rectangle1():
print('Rectangle 2 is bigger than rectangle 1')
else:
print('These rectangles are equal!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment