Computer science project

profileJerry Shen
Project2feedback.pdf

Traceback (most recent call last): File "Prj2_test.py", line 3, in <module> from Project_2 import * ModuleNotFoundError: No module named ’Project_2’ $ 0 1000 $ 0 100

generate_numbers_super_defaults: Generated [8, 12, 1, 27, 5, 14] Checking min, max, length, and frequency

generate_numbers_super_equal: Sample larger than population or is negative Testing failed.

lotto_prize_search_jackpot_same: attempt: [5, 15, 2, 24, 56] winning: [5, 15, 2, 24, 56] prizes: [10000, 1000, 100, 10, 1] Return value was 10000

lotto_prize_search_jackpot_shuffle: attempt: [5, 15, 2, 24, 56] winning: [24, 15, 56, 2, 5] prizes: [10000, 1000, 100, 10, 1] Return value was 10000

lotto_prize_search_jackpot_shuffle_2: attempt: [5, 15, 2, 24, 56] winning: [24, 35, 56, 2, 5] prizes: [10000, 1000, 100, 10, 1] Return value was 1000

lotto_prize_search_lose: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 20, 11] prizes: [10000, 1000, 100, 10, 1] Return value was 0

lotto_prize_search_prize_odd: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 2, 11] prizes: [10000, 1000, 100] Return value was 0

lotto_prize_search_prize_odd_2: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [44, 35, 13, 2, 11, 19, 42] prizes: [10000, 1000, 100] Return value was 0

lotto_prize_prize_search_odd_3: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [44, 15, 13, 2, 11, 19, 42] prizes: [10000, 1000, 100] Return value was 0

lotto_prize_prize_search_odd_4: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [24, 15, 13, 2, 11, 19, 56] prizes: [10000, 1000, 100] Return value was 100

lotto_prize_search_prize_odd_5: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [24, 15, 23, 2, 11, 19, 56] prizes: [10000, 1000, 100] Return value was 100

lotto_prize_search_prize_one: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [24, 15, 23, 2, 11, 29, 56] prizes: [10000] Return value was 0

lotto_prize_search_prize_one_2: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [2, 5, 19, 24, 77, 15, 56] prizes: [10000] Return value was 10000

lotto_prize_search_shuffle_3: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 56, 2, 5] prizes: [10000, 1000, 100, 10, 1] Return value was 100

lotto_prize_search_shuffle_4: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 56, 2, 11] prizes: [10000, 1000, 100, 10, 1]

Return value was 10

lotto_prize_search_shuffle_5: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 2, 11] prizes: [10000, 1000, 100, 10, 1] Return value was 1

lotto_prize_super_jackpot_same: attempt: [5, 15, 2, 24, 56] winning: [5, 15, 2, 24, 56] prizes: [10000, 1000, 100, 10, 1] local variable ’prize’ referenced before assignment Testing failed.

lotto_prize_super_jackpot_same_2: attempt: [5, 15, 2, 24, 56, 2] winning: [5, 15, 2, 24, 56, 2] prizes: [10000, 1000, 100, 10, 1] Mult:4 Return value was 40000

lotto_prize_super_jackpot_shuffle: attempt: [5, 15, 2, 24, 56, 6] winning: [24, 15, 56, 2, 5, 6] prizes: [10000, 1000, 100, 10, 1] Mult:5 Return value was 50000

lotto_prize_super_lose: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 20, 11] prizes: [10000, 1000, 100, 10] Return value was 0

lotto_prize_super_shuffle_1: attempt: [5, 15, 2, 24, 56, 32] winning: [44, 35, 56, 2, 11, 32] prizes: [10000, 1000, 100, 10, 1] Mult:4 Return value was 40

Traceback (most recent call last): File "Prj2_test.py", line 3, in <module> from Project_2 import * ModuleNotFoundError: No module named ’Project_2’ $ 0 1000 $ 0 100

generate_numbers_super_defaults: Generated [8, 12, 1, 27, 5, 14] Checking min, max, length, and frequency

generate_numbers_super_equal: Sample larger than population or is negative Testing failed.

lotto_prize_search_jackpot_same: attempt: [5, 15, 2, 24, 56] winning: [5, 15, 2, 24, 56] prizes: [10000, 1000, 100, 10, 1] Return value was 10000

lotto_prize_search_jackpot_shuffle: attempt: [5, 15, 2, 24, 56] winning: [24, 15, 56, 2, 5] prizes: [10000, 1000, 100, 10, 1] Return value was 10000

lotto_prize_search_jackpot_shuffle_2: attempt: [5, 15, 2, 24, 56] winning: [24, 35, 56, 2, 5] prizes: [10000, 1000, 100, 10, 1] Return value was 1000

lotto_prize_search_lose: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 20, 11] prizes: [10000, 1000, 100, 10, 1] Return value was 0

lotto_prize_search_prize_odd: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 2, 11] prizes: [10000, 1000, 100] Return value was 0

lotto_prize_search_prize_odd_2: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [44, 35, 13, 2, 11, 19, 42] prizes: [10000, 1000, 100] Return value was 0

lotto_prize_prize_search_odd_3: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [44, 15, 13, 2, 11, 19, 42] prizes: [10000, 1000, 100] Return value was 0

lotto_prize_prize_search_odd_4: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [24, 15, 13, 2, 11, 19, 56] prizes: [10000, 1000, 100] Return value was 100

lotto_prize_search_prize_odd_5: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [24, 15, 23, 2, 11, 19, 56] prizes: [10000, 1000, 100] Return value was 100

lotto_prize_search_prize_one: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [24, 15, 23, 2, 11, 29, 56] prizes: [10000] Return value was 0

lotto_prize_search_prize_one_2: attempt: [5, 15, 2, 24, 56, 77, 19] winning: [2, 5, 19, 24, 77, 15, 56] prizes: [10000] Return value was 10000

lotto_prize_search_shuffle_3: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 56, 2, 5] prizes: [10000, 1000, 100, 10, 1] Return value was 100

lotto_prize_search_shuffle_4: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 56, 2, 11] prizes: [10000, 1000, 100, 10, 1]

Return value was 10

lotto_prize_search_shuffle_5: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 2, 11] prizes: [10000, 1000, 100, 10, 1] Return value was 1

lotto_prize_super_jackpot_same: attempt: [5, 15, 2, 24, 56] winning: [5, 15, 2, 24, 56] prizes: [10000, 1000, 100, 10, 1] local variable ’prize’ referenced before assignment Testing failed.

lotto_prize_super_jackpot_same_2: attempt: [5, 15, 2, 24, 56, 2] winning: [5, 15, 2, 24, 56, 2] prizes: [10000, 1000, 100, 10, 1] Mult:4 Return value was 40000

lotto_prize_super_jackpot_shuffle: attempt: [5, 15, 2, 24, 56, 6] winning: [24, 15, 56, 2, 5, 6] prizes: [10000, 1000, 100, 10, 1] Mult:5 Return value was 50000

lotto_prize_super_lose: attempt: [5, 15, 2, 24, 56] winning: [44, 35, 13, 20, 11] prizes: [10000, 1000, 100, 10] Return value was 0

lotto_prize_super_shuffle_1: attempt: [5, 15, 2, 24, 56, 32] winning: [44, 35, 56, 2, 11, 32] prizes: [10000, 1000, 100, 10, 1] Mult:4 Return value was 40

from Project_2_EC import * from Project_21 import * from random import randint, choice, choices, sample, shuffle import sys #Your main program goes here #Main Program #1 attempt = generate_numbers(65, 5) #2 winning = generate_numbers(65, 5) #3 prizes = [100000, 500, 50] prize = lotto_prize(attempt,winning, prizes) print("$", prize) #4 max_pick = 20 max_play = 1000 winning_number = generate_numbers(20, 6) plays = simulate_lotto(winning_number, max_pick, max_play) print(plays) #Extra Credits #1 attempt = generate_numbers_super(65,5,20) winning = generate_numbers_super(65,5,20) prizes = [1000,100,10] #2 prize = lotto_prize_super(attempt, winning, prizes, True, 5) print("$", prize) #3 print(lotto_prize_search([1,2,3,4,5],[1,2,3,4,6],[1000,100,10]))

from random import randint, choice, choices, sample, shuffle from Project_21 import *

def generate_numbers_super(limit = 34, num = 5, super_limit = 20): return sample(range(1,limit),num) + sample (range(super_limit),1)

def lotto_prize_super(attempt, winning, prizes, super_ = False, multiplier = 1): if super_: prize = lotto_prize(attempt, winning, prizes) super_attempt = attempt[-1] super_winning = winning[-1] if super_attempt == super_winning: prize *= multiplier return prize else: return lotto_prize(attempt, winning, prize) def lotto_prize_search(attempt, winning, prizes): matches = len(set(attempt).intersection(winning)) count = len(winning) for prize in prizes: if(matches == count): return prize count = count - 1 return 0

#Absolutely no additional code in this file #No function calls #No input lines #There should be no unindented code other than the import line and the def lines