0

Please Help Me To Fix This Calculator 😢 🙏🙏

My code is not working 😢 Sample input: 9+sin90° Expected Output: 10.0 https://code.sololearn.com/cKoDW6MZFPZn/?ref=app Help me to fix this 🙏🙏

10th Sep 2021, 8:57 AM
Ferdous ☑
Ferdous ☑ - avatar
3 Answers
+ 1
MD. Ferdous Ibne Abu Bakar Now enter any input and tell me if anything wrong https://code.sololearn.com/c9cyja4No2Jp/?ref=app
11th Sep 2021, 10:08 AM
A͢J
A͢J - avatar
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ I have another problem in code↓↓↓ ''' SAMPLE INPUT (1): cos0°+sin90° EXPECTED OUTPUT: 2.0 SAMPLE INPUT (2): sin90°/cos0° EXPECTED OUTPUT: 1.0 ''' i = input() import math if 'sin' in i: index = i.find('sin') s = index + 3 d = i.find('°') theta = eval(str((i[s : d]))) value = math.sin(math.radians(theta)) if 'cos' in i: index = i.find('cos') s = index + 3 d = i.find('°') theta = eval(str((i[s : d]))) value = math.cos(math.radians(theta)) #replacing value after operand with calculated value i = i.replace((i[(s-3):(d+1)]), str(value)) print(eval(i))
11th Sep 2021, 9:25 AM
Ferdous ☑
Ferdous ☑ - avatar