fork download
  1. # your code goes here
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. def na10(dana):
  12. pom = 0
  13. for i in range(len(dana)):
  14. x = int(dana[- i -1])
  15. pom = pom + x * 2 ** i
  16. return pom
  17.  
  18. print (na10("101010"))
  19. print (na10("110101"))
  20.  
  21.  
  22.  
  23.  
  24.  
Success #stdin #stdout 0.04s 9712KB
stdin
stdout
42
53