Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
323 views
mystr = '100000001010' mystr[-4:]
'1010'
a=0xf b=Integer(a).binary();f=b[-2:]; c=sum(Integer(i) * (2^Integer(e)) for e, i in enumerate(f)) print c
3