import random import scipy.stats as stats for x in range(20): nums = [] for _ in range(4): nums.append(random.randint(1,201)) _, two_sided_pvalue = stats.fisher_exact([[nums[0], nums[1]], [nums[2], nums[3]]], 'two-sided') _, less_sided_pvalue = stats.fisher_exact([[nums[0], nums[1]], [nums[2], nums[3]]], 'less') _, greater_sided_pvalue = stats.fisher_exact([[nums[0], nums[1]], [nums[2], nums[3]]], 'greater') print("([{}, {}, {}, {}], {}, {}, {}),".format( nums[0], nums[1], nums[2], nums[3], less_sided_pvalue, greater_sided_pvalue, two_sided_pvalue))