I've been through some answers to similar questions on stackoverflow, whereas I appears to be facing a quite delicate situation wherein some of them won't work. below is my code:
import random
from datetime import datetime
array = ['a', 'b', 'c', 'd', 'e', 'f']
def log():
print(random.choice(array))
characters_to_remove = ".-:"
now = str(datetime.now()).replace(" ", "")
for character in characters_to_remove:
now = now.replace(character, "")
# print(now)
time = now
time = int(time)
# print(time)
paramTime = time % 535
# print(paramTime)
# param = int(str(paramTime)[:2])
param = int(str(paramTime)[:1])
# print(param)
def repeat(times, func):
for i in range(param): func()
print(repeat(param, log))
# print(str(repeat(param, log)).split(""))
# print('----------')
as you can see, the for loop is used in order to call a function (for multiple times):
def repeat(param, func):
# param stands for the number of times the function is to be called
for i in range(param): func()
now I want to convert my outputs as a list and ergo be able to get the most commonly outputted value... what do I do?