Selenium Python - Advanced Patterns
Consider this retry decorator and test function:
What will be printed when running this code?
def retry(func):
def wrapper():
attempts = 3
for i in range(attempts):
try:
return func()
except Exception:
pass
return 'Failed'
count = 0
@retry
def test():
global count
count += 1
if count < 3:
raise Exception('Fail')
return 'Success'
print(test())What will be printed when running this code?
