added code template
This commit is contained in:
21
CodeTemplate.py
Normal file
21
CodeTemplate.py
Normal file
@@ -0,0 +1,21 @@
|
||||
######################################
|
||||
# DCS 229 --
|
||||
# short description of file
|
||||
# Date:
|
||||
# Name:
|
||||
# Resources Used:
|
||||
##########################################
|
||||
# import statement to support more type hints
|
||||
from __future__ import annotations
|
||||
|
||||
#### Write your class here
|
||||
|
||||
|
||||
|
||||
### write your tests in main function
|
||||
def main():
|
||||
pass
|
||||
|
||||
# only execute when you run this file directily
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -13,15 +13,23 @@ import random #to generate the 100 random values
|
||||
import time #for part 4, to calculae total time
|
||||
|
||||
#### Write your class here
|
||||
def generate_random_list(n):
|
||||
data = []
|
||||
for _ in range(n):
|
||||
data.append(random.randint(0, 1000))
|
||||
class Search:
|
||||
|
||||
"""
|
||||
This function generates the list of random integers.
|
||||
"""
|
||||
def generate_random_list(self, n):
|
||||
data = []
|
||||
for _ in range(n):
|
||||
data.append(random.randint(0, 1000))
|
||||
|
||||
if 42 not in data:
|
||||
data[random.randint(0, n - 1)] = 42
|
||||
|
||||
return data
|
||||
|
||||
|
||||
if 42 not in data:
|
||||
data[random.randint(0, n - 1)] = 42
|
||||
|
||||
return data
|
||||
|
||||
|
||||
### write your tests in main function
|
||||
|
||||
Reference in New Issue
Block a user