Dec-14-2018, 07:41 PM
If someone can send code: I am making simple program which I will use in calculating Pitagora's theorem, so I made that program but I want to python draw that triangle in turtle but I do not to code size of angle?
import math from turtle import* odgovor = str(input("Ako želite izračunati stranice jednakokračnog trokuta upišite AAC, a ako želite izračunati stranice raznostraničnog trokuta upišite ABC: ")) odgovor = odgovor.upper() if odgovor == ("ABC"): stranica = str(input("Upišite stranicu koju želite izračunati: ")) stranica = stranica.capitalize() if stranica == ("A"): kateta_druga = int(input("Upišite veličinu druge katete: ")) hipotenuza = int(input("Upišite veličinu hipotenuze: ")) dulj_stranice = math.sqrt((hipotenuza**2) - (kateta_druga**2)) str_dulj_stranice=str(dulj_stranice) print("Duljina stranice je " + str_dulj_stranice) fd(dulj_stranice*100) lt(90) fd(kateta_druga*100) rt(180) #ka_hip = kateta_druga/hipotenuza #sin_ka_hip = math.sin(math.radians(ka_hip)) #I need math.sin with exponent(-1) elif stranica == ("B"): kateta_druga = int(input("Upišite veličinu druge katete: ")) hipotenuza = int(input("Upišite veličinu hipotenuze: ")) dulj_stranice = math.sqrt((hipotenuza**2) - (kateta_druga**2)) str_dulj_stranice=str(dulj_stranice) print("Duljina stranice je " + str_dulj_stranice) elif stranica == ("C"): kateta_prva = int(input("Upišite veličinu prve katete: ")) kateta_druga = int(input("Upišite veličinu druge katete: ")) dulj_stranice = math.sqrt((kateta_prva**2) + (kateta_druga**2)) str_dulj_stranice=str(dulj_stranice) print("Duljina stranice je " + str_dulj_stranice) if odgovor == ("AAC"): stranica = int(input("Upišite duljinu stranice: ")) hipotenuza = math.sqrt((stranica**2) + (stranica**2)) hipotenuza = str(hipotenuza) print("Duljina hipotenuze je " + hipotenuza) fd(stranica*100) lt(90) fd(stranica*100) rt(180) rt(45) fd(hipotenuza*100)
print('Duljina hipotenuza je {:.2f}'.format(hipotenusa)
input('Press enter to finish: ')
at the end. Also note that are drawing way too much. Unless you enter really small values, the turtle is going to go off the screen because you are multiplying everything by 100.