Advertisement
desdemona

gównoconcat

Oct 13th, 2015
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. import sys
  2. import uuid
  3. import time
  4.  
  5. def my_concat(s1, s2):
  6.     return s1.join(s2)
  7.  
  8. import sys
  9. import time
  10. import random
  11.  
  12. if __name__ == '__main__':
  13.     n = 0
  14.     a = b = ""
  15.     start_time = time.time()
  16.     for line in sys.stdin:
  17.         line = str(line).split(" ")
  18.         if len(line) != 2:
  19.             continue
  20.         a = str(line[0])
  21.         b = str(line[1])
  22.  
  23.         c2 = my_concat(a, b)
  24.  
  25.         a = b = ""
  26.         n += 1
  27.     end_time = time.time() - start_time
  28.  
  29.     petla_start = time.time()
  30.     h = n;
  31.     for i in range(0, n):
  32.         h+= 1;
  33.         if h > random.randrange(6,9999):
  34.             h+=2
  35.     petla_end = time.time()
  36.  
  37.     total_time = end_time - (petla_end-petla_start)
  38.     print("my concat total: " + str(total_time) + "\n")
  39.     print("my concat avg: " + str(total_time/n) + "\n")
  40.     print(str(h))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement