Sep-04-2020, 07:25 AM
(This post was last modified: Sep-04-2020, 07:25 AM by ShityCoder.)
Hello everyone, idea to count how many attempts module random takes before <==> to original string
unfortunatelly <while> not interrupted((((
unfortunatelly <while> not interrupted((((
import random str_org = "ABC" arr = ['A', 'B','C'] str_pat = [] for i in range(len(arr)): str_pat.append(random.choice(arr)) result = "".join(str_pat) count = 0 while result != str_org: count += 1 if result==str_org: break print(count)
Error://////////////////////
Run concole example:
56
197257
197258
197259
197260
197261
197262
......