0

import math problem 🤔

We know tan 45° = 1 But in python, 1. why tan 45° = 0.999....? 2. How can I fix it? Sample input: tan 45° Expected output: 1 Sample input: tan 225° Expected Output: 1

15th Sep 2021, 5:04 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar
2 ответов
+ 2
#I found a solution: from math import * x = tan(radians(45)) if str(0.999999) in str(x): x = round(x) print (x)
15th Sep 2021, 6:15 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar