I’m relatively new to coding so please help me out here. The code will only run until the 5th line. This code may be a total babel, but please humor me.
EDIT: There is no exception, nothing happens. After asking me to choose between 1 and 2, the code just stops.
print('This program will tell you the area some shapes')
print('You can choose between...')
print('1. rectangle')
print('or')
print('2. triangle')
def shape():
shape = int(input('What shape do you choose?'))
if shape == 1: rectangle
elif shape == 2: triangle
else: print('ERROR: select either rectangle or triangle')
def rectangle():
l = int(input('What is the length?'))
w = int(input('What is the width?'))
areaR=l*w
print('The are is...')
print(areaR)
def triangle():
b = int(input('What is the base?'))
h = int(input('What is the height?'))
first=b*h
areaT=.5*first
print('The area is...')
print(areaT)
A better coding style will be putting everything inside functions: