Answers for "pythagoras python"

21

pythagorean theorem python

distance = math.sqrt((abs(distancex) ** 2) + (abs(distancey) ** 2))
Posted by: Guest on September-10-2020
1

pythagore

BC2 = AC2 + AB2
Posted by: Guest on January-14-2021
0

pythagoras python

import math

input1 = input('What do you want to find: ')


def c():
    inputA = float(input('Enter a: '))
    inputB = float(input('Enter b: '))
    fc = math.sqrt(inputA ** 2 + inputB ** 2)
    print(f'c = {round(fc, 3)}')


def ab(t, ans):
    inputB = float(input(f'Enter {t}: '))
    inputC = float(input('Enter c: '))
    if inputC > inputB:
        a = math.sqrt(inputC ** 2 - inputB ** 2)
        print(f'{ans} = {round(a, 3)}')
    else:
        print('Invalid input')


    if input1 == 'c':
        c()

    elif input1 == 'a':
        t = 'b'
        ans = 'a'
        ab(t, ans)

    elif input1 == 'b':
        t = 'a'
        ans = 'b'
        ab(t, ans)
Posted by: Guest on August-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language