HOME/Articles/

pythagoras (snippet)

Article Outline

Python example 'pythagoras'

Modules used in program:

  • import math

pythagoras

Python beginners example: pythagoras

# Pythagoras Formula
import math
# a.sq + b.sq = c.sq

a = float(input('Value for A : '))
b = float(input('Value for B : '))
c = math.sqrt(a ** 2 + b ** 2)
# here's the answer
print(c)