RedstoneHair

3 line wow

Jun 26th, 2022 (edited)
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. type, msg1, msg2 = input('Shape: '), 'Input 1: ', 'Input 2: '
  2. inp = [float(input(msg1)),None] if type in 'square / circle' else [float(input(msg1)), float(input(msg2))] if type in 'rectangle / triangle' else None
  3. print(f"Area of {type} is {round(inp[0]*inp[0],3) if type=='square' else round(inp[0]*inp[1],3) if type=='rectangle' else round(3.14159265359*inp[0]*inp[0],3) if type=='circle' else 0.5 * inp[0] * inp[1]}")
Add Comment
Please, Sign In to add comment