fork download
  1. def na10(dana):
  2. pom = 0
  3. for i in range(len(dana)):
  4. x = int(dana[- i - 1 ])
  5. pom = pom + x * 2 ** i
  6. return pom
  7. print (na10 ("101010"))
  8. print (na10 ("110101"))
  9. print (na10 ("10101010101001010100101010101"))
  10. print (na10 ("101010100001111111001010101010101010101010101010101010011111111111"))
  11. print (na10 ("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))
  12.  
Success #stdin #stdout 0.03s 9860KB
stdin
Standard input is empty
stdout
42
53
357869909
49034958180329367551
5444517870735015415413993718908291383295