You are viewing a single comment's thread. Return to all comments →
without using eval(input())
num=list(map(int,input().split())) poly=input() subs='' for i in poly: if i=='x': subs+=f'{num[0]}' else: subs+=i a = list(subs.split(' ')) def po(st): if '**' in st: m=st.split("**") if '*' in m[0]: mm=m[0].split('*') return int(mm[0])*(int(mm[1])**int(m[1])) else: return (int(m[0])**int(m[1])) else: return st tot=po(a[0]) for i in range(len(a)-1): if a[i+1]=='+': tot+=int(po(a[i+2])) elif a[i+1]=='-': tot-=int(po(a[i+2])) else: tot=tot*1 print(tot==num[1])
Seems like cookies are disabled on this browser, please enable them to open this website
Input()
You are viewing a single comment's thread. Return to all comments →
without using eval(input())