Skip to content

Commit 6b282d5

Browse files
committed
Update Readme.
Unify main functions for Tests. Update Readme information.
1 parent 5ba0b87 commit 6b282d5

9 files changed

Lines changed: 71 additions & 58 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21

32
.project
43

@@ -11,6 +10,7 @@ com/prestonsproductions/sourcecode/BoxFactory2018/Teams/*
1110
com/prestonsproductions/sourcecode/MusicLibrary2018/Teams/*
1211

1312
com/prestonsproductions/sourcecode/RoadTrip2018/Teams/*
13+
1414
=======
1515
# Byte-compiled / optimized / DLL files
1616
__pycache__/
@@ -113,4 +113,4 @@ ENV/
113113

114114
# mypy
115115
.mypy_cache/
116-
>>>>>>> 5dbbe3846ff6626e275dea96d8bff119dc3ace0f
116+

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
# sourcecode
2-
Python coding challenges (tests) for the Science Olympiad event Source Code
1+
# Source Code
2+
3+
Python coding challenges (tests) for the Science Olympiad event Source Code.
4+
5+
Programming tests will be found at com/prestonsproductions/sourcecode
6+
7+
These tests have been uploaded to help Science Olympiad teams (and others) practice programming. Tests contain a variety of questions with increasing difficulty that relate to a similar theme/topic.
8+
9+
An uncompleted and completed python file (with answers) are included for each test. A Main python file is also included, but can be disregarded. Note that in the Source Code event, supervisors will change data from the main function. If code and algorithms are written correctly, the questions/functions will still produce the correct results with the provided data.

com/prestonsproductions/sourcecode/BoxFactory2018/BoxFactory2018.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,42 @@ def main():
246246
972,920,812,320,809,654,702,563,652,599,587,740,680,673,702,263,702,932,562,421,453,23,898,485,968,620,
247247
792,205,179,92,362,2,89,600,18,514,75,110,976,872,458,44,642,411,437,539,233, 1000]
248248

249-
# Print Question Answer
249+
# Print Question Answer 112 Points Total
250250
print('Source Code - Division B/C - Box Factory - Box Production')
251251

252-
print('QUESTION 0: '+str(getBoxProductionTitle('The Source Code Box Production', '00022', '01/13/2019')))
253-
print('Question 1: '+str(getVolume(10,20,5)))
254-
print('Question 2: '+str(getSurfaceArea(4,5,10)))
255-
print('Question 3: '+str(isBoxLargeEnough(12, 11)))
256-
print('Question 4: '+str(getTotalSurfaceArea(boxesSF)))
257-
print('Question 5: '+str(getAverageSurfaceArea(boxesSF)))
258-
print('Question 6: '+str(getSumOfFactors(boxesSF)))
259-
print('Question 7: '+str(reverseList(objects)))
260-
print('Question 8: '+str(getBoxBuildTime(10,20,30)))
261-
print('Question 9: '+str(getBoxCost(99, 0.24)))
262-
print('Question 10: '+str(getBoxAddOnCost(150, 'METAL', 11)))
263-
print('Question 11: '+str(getMaterialPercentage(boxesSF)))
264-
print('Question 12: '+str(getTotalBuildTime(boxes)))
265-
print('Question 13: '+str(getBoxes(objects)))
266-
print('Question 14: '+str(needsPerfectSqaureSticker(64)))
267-
print('Question 15: '+str(getPythagoreanTriples(boxes)))
268-
print('Question 16: '+str(isBoxesLargeEnough(boxesSF, objects)))
269-
print('Question 17: '+str(getMostBoxesCount(boxes, 10000)))
270-
print('Question 18: '+str(getPrimeNumberBoxesVolume(50)))
271-
print('Question 19: '+str(getStatistics(boxes)))
272-
273-
# Print Box Production
252+
print('QUESTION 0 OBJECTIVE A (2): '+str(getBoxProductionTitle('The Source Code Box Production', '00022', '01/13/2019')))
253+
print('Question 1 OBJECTIVE A (2): '+str(getVolume(10,20,5)))
254+
print('Question 2 OBJECTIVE A (3): '+str(getSurfaceArea(4,5,10)))
255+
print('Question 3 OBJECTIVE A (3): '+str(isBoxLargeEnough(12, 11)))
256+
print('Question 4 OBJECTIVE A (4): '+str(getTotalSurfaceArea(boxesSF)))
257+
print('Question 5 OBJECTIVE A (4): '+str(getAverageSurfaceArea(boxesSF)))
258+
print('Question 6 OBJECTIVE A (4): '+str(getSumOfFactors(boxesSF)))
259+
print('Question 7 OBJECTIVE A (4): '+str(reverseList(objects)))
260+
261+
print('Question 8 OBJECTIVE A (4): '+str(getBoxBuildTime(10,20,30)))
262+
print('Question 8 OBJECTIVE B (2): '+str(getBoxBuildTime(39,41,30)))
263+
264+
print('Question 9 OBJECTIVE A (4): '+str(getBoxCost(99, 0.24)))
265+
print('Question 9 OBJECTIVE B (2): '+str(getBoxCost(100, 0.24)))
266+
267+
print('Question 10 OBJECTIVE A (4): '+str(getBoxAddOnCost(150, 'CARDBOARD', 8)))
268+
print('Question 10 OBJECTIVE B (4): '+str(getBoxAddOnCost(150, 'PLASTIC', 11)))
269+
print('Question 10 OBJECTIVE C (4): '+str(getBoxAddOnCost(150, 'METAL', 9)))
270+
271+
print('Question 11 OBJECTIVE A (4): '+str(getMaterialPercentage(boxesSF)))
272+
print('Question 11 OBJECTIVE B (2): '+str(getMaterialPercentage(boxesSF)))
273+
274+
print('Question 12 OBJECTIVE A (6): '+str(getTotalBuildTime(boxes)))
275+
print('Question 13 OBJECTIVE A (6): '+str(getBoxes(objects)))
276+
print('Question 14 OBJECTIVE A (6): '+str(needsPerfectSqaureSticker(64)))
277+
print('Question 15 OBJECTIVE A (6): '+str(getPythagoreanTriples(boxes)))
278+
print('Question 16 OBJECTIVE A (6): '+str(isBoxesLargeEnough(boxesSF, objects)))
279+
print('Question 17 OBJECTIVE A (8): '+str(getMostBoxesCount(boxes, 10000)))
280+
print('Question 18 OBJECTIVE A (8): '+str(getPrimeNumberBoxesVolume(50)))
281+
282+
print('Question 19 OBJECTIVE A (4): '+str(getStatistics(boxes)))
283+
print('QUESTION 19 OBJECTIVE B (2): '+'Check for comment explaining function.')
284+
print('QUESTION 19 OBJECTIVE C (2): '+'Check if previous function in file was called.')
285+
print('QUESTION 19 OBJECTIVE D (2): '+'Check if import statement was used.')
274286

275287
main()

com/prestonsproductions/sourcecode/BoxFactory2018/BoxFactory2018A.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,5 @@ def main():
340340
print('QUESTION 19 OBJECTIVE B (2): '+'Check for comment explaining function.')
341341
print('QUESTION 19 OBJECTIVE C (2): '+'Check if previous function in file was called.')
342342
print('QUESTION 19 OBJECTIVE D (2): '+'Check if import statement was used.')
343-
344-
# Print Box Production
345343

346344
main()

com/prestonsproductions/sourcecode/BoxFactory2018/BoxFactory2018Main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,5 @@ def main():
6161
print('QUESTION 19 OBJECTIVE B (2): '+'Check for comment explaining function.')
6262
print('QUESTION 19 OBJECTIVE C (2): '+'Check if previous function in file was called.')
6363
print('QUESTION 19 OBJECTIVE D (2): '+'Check if import statement was used.')
64-
65-
# Print Box Production
6664

6765
main()

com/prestonsproductions/sourcecode/MusicLibrary2018/MusicLibrary2018.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def main():
250250
{'NAME':'Easier to Run', 'ARTIST':'Linkin Park', 'ALBUM':'Meteora', 'DURATION':205, 'FILESIZE':2.3,'RATING':4},
251251
{'NAME':'Figure 09', 'ARTIST':'Linkin Park', 'ALBUM':'Meteora', 'DURATION':198, 'FILESIZE':2.1,'RATING':3},
252252
{'NAME':'Breaking the Habit', 'ARTIST':'Linkin Park', 'ALBUM':'Meteora', 'DURATION':197, 'FILESIZE':2.1,'RATING':4},
253+
{'NAME':'Radioactive', 'ARTIST':'Imagine Dragons', 'ALBUM':'Night Visions', 'DURATION':188, 'FILESIZE':1.9,'RATING':4},
253254
{'NAME':'Demons', 'ARTIST':'Imagine Dragons', 'ALBUM':'Night Visions', 'DURATION':176, 'FILESIZE':1.7,'RATING':4},
254255
{'NAME':'On Top of the World', 'ARTIST':'Imagine Dragons', 'ALBUM':'Night Visions', 'DURATION':191, 'FILESIZE':1.9,'RATING':5},
255256
{'NAME':'Underdog', 'ARTIST':'Imagine Dragons', 'ALBUM':'Night Visions', 'DURATION':210, 'FILESIZE':2.3,'RATING':2},
@@ -294,14 +295,14 @@ def main():
294295
print('Source Code - Division B/C - Music Library')
295296

296297
print('QUESTION 0 OBJECTIVE A (2): '+str(getMusicLibraryTitle()))
297-
print('QUESTION 1 OBJECTIVE A (2): '+str(getCDArea(4)))
298-
print('QUESTION 2 OBJECTIVE A (2): '+str(hasEnoughSpace(1023,1024)))
299-
print('QUESTION 3 OBJECTIVE A (3): '+str(logSong('Wildest Dreams','Taylor Swift','1989')))
300-
print('QUESTION 4 OBJECTIVE A (3): '+str(formatTime(204)))
301-
print('QUESTION 4 OBJECTIVE B (3): '+str(formatTime(204)))
302-
print('QUESTION 5 OBJECTIVE A (3): '+str(reverseString('Jump On My Shoulders')))
298+
print('QUESTION 1 OBJECTIVE A (2): '+str(getCDArea(5)))
299+
print('QUESTION 2 OBJECTIVE A (2): '+str(hasEnoughSpace(1024,1024)))
300+
print('QUESTION 3 OBJECTIVE A (3): '+str(logSong('Love Me Do','The Beatles','1')))
301+
print('QUESTION 4 OBJECTIVE A (3): '+str(formatTime(205)))
302+
print('QUESTION 4 OBJECTIVE B (3): '+str(formatTime(205)))
303+
print('QUESTION 5 OBJECTIVE A (3): '+str(reverseString('Man in the Wilderness')))
303304
print('QUESTION 6 OBJECTIVE A (4): '+str(getSong(library, 'Soul Vaccination')))
304-
305+
305306
print('QUESTION 7 OBJECTIVE A (4): '+str(getTotalTime(library)))
306307

307308
print('QUESTION 8 OBJECTIVE A (5): '+str(getAverageSize(library, 'RATING')) +' '+ str(getAverageSize(library, 'FILESIZE')))
@@ -313,15 +314,15 @@ def main():
313314
print('QUESTION 10 OBJECTIVE A (2): '+str(getTheBestSong(library)))
314315

315316
print('QUESTION 11 OBJECTIVE A (5): '+str(getSpacesCount(library)))
316-
print('QUESTION 12 OBJECTIVE A (5): '+str(truncateSongTitle('when the World Was at war We kept dancing')))
317-
print('QUESTION 13 OBJECTIVE A (5): '+str(capitalizeSongTitle('When the World Was at War We Kept Dancing')))
317+
print('QUESTION 12 OBJECTIVE A (5): '+str(truncateSongTitle('down to the night Club')))
318+
print('QUESTION 13 OBJECTIVE A (5): '+str(capitalizeSongTitle('down to the night Club')))
318319
print('QUESTION 14 OBJECTIVE A (6): '+str(getAlbumMostSongs(library)))
319320

320321
print('QUESTION 15 OBJECTIVE A (6): '+str(getShortestMixTape(library)))
321322
print('QUESTION 15 OBJECTIVE B (2): '+str(getShortestMixTape(library)))
322-
323+
323324
print('QUESTION 16 OBJECTIVE A (7): '+str(getMedianDuration(library)))
324-
print('QUESTION 17 OBJECTIVE A (7): '+str(fibonnaciSum(library)))
325+
print('QUESTION 17 OBJECTIVE A (7): '+str(fibonnaciSum(library)))
325326
print('QUESTION 18 OBJECTIVE A (8): '+str(getAnagrams(library, 'I hang under lo list')))
326327

327328
print('QUESTION 19 OBJECTIVE A (4): '+str(getStatistic(library)))

com/prestonsproductions/sourcecode/RoadTrip2018/RoadTrip2018.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def main():
245245
{'NAME':'Cadillac', 'DISTANCE':71, 'DURATION':84, 'GASPRICE':3.01},
246246
{'NAME':'Mount Pleasant', 'DISTANCE':65, 'DURATION':65, 'GASPRICE':2.99},
247247
{'NAME':'Flint', 'DISTANCE':90, 'DURATION':87, 'GASPRICE':2.59},
248+
{'NAME':'Clio', 'DISTANCE':15, 'DURATION':18, 'GASPRICE':2.66},
248249
]
249250

250251
tripdata2 = [{'NAME':'Bath', 'DISTANCE':0, 'DURATION':0, 'GASPRICE':2.51},
@@ -264,6 +265,7 @@ def main():
264265
{'NAME':'Tawas City', 'DISTANCE':69, 'DURATION':70, 'GASPRICE':2.89},
265266
{'NAME':'Mackinaw City', 'DISTANCE':165, 'DURATION':152, 'GASPRICE':3.30},
266267
{'NAME':'St. Ignace', 'DISTANCE':12, 'DURATION':25, 'GASPRICE':3.20},
268+
{'NAME':'Sault Ste Marie', 'DISTANCE':60, 'DURATION':56, 'GASPRICE':3.44},
267269
]
268270

269271
landmarks = [('Blue Chair','Alpena','Lansing'),
@@ -279,22 +281,23 @@ def main():
279281
('Sky Resort','Ludington','Traverse City'),
280282
('The Bay Bridge','Bay City','Saginaw'),
281283
('Nothing','Bath','St. Johns'),
284+
('Nothing','Flint','Clio'),
282285
]
283286

284287
# Print Question Answer
285-
print('Source Code - Division B/C - Road Trip - Travel Log')
288+
print('Source Code (MAIN) - Division B/C - Road Trip - Travel Log')
286289

287-
print('QUESTION 0 A (2): '+getTravelLogTitle('The Source Code Travel Log', '00001', '02/02/2018'))
290+
print('QUESTION 0 A (2): '+getTravelLogTitle('The Source Code Travel Log', '10001', '03/03/2018'))
288291

289-
print('QUESTION 1 A (2): '+str(getDistanceBetween(700,600)))
290-
print('QUESTION 1 B (2): '+str(getDistanceBetween(600,700)))
292+
print('QUESTION 1 A (2): '+str(getDistanceBetween(800,600)))
293+
print('QUESTION 1 B (2): '+str(getDistanceBetween(600,800)))
291294

292-
print('QUESTION 2 A (2): '+str(getFuelCost(500,2.59,24)))
293-
print('QUESTION 2 B (2): '+str(getFuelCost(500,2.59,24)))
295+
print('QUESTION 2 A (2): '+str(getFuelCost(501,2.59,24)))
296+
print('QUESTION 2 B (2): '+str(getFuelCost(501,2.59,24)))
294297

295-
print('QUESTION 3 A (3): '+str(getAverageSpeed(500, 450)))
298+
print('QUESTION 3 A (3): '+str(getAverageSpeed(600, 500)))
296299

297-
print('QUESTION 4 A (3): '+str(firstCapital('LanSIng')))
300+
print('QUESTION 4 A (3): '+str(firstCapital('sAGINaW')))
298301

299302
print('QUESTION 5 A (3): '+str(getCents(1.377)))
300303

@@ -303,7 +306,7 @@ def main():
303306
print('QUESTION 7 A (4): '+str(isPrimeNumber(199)) +', ' + str(isPrimeNumber(8335)))
304307

305308
print('QUESTION 8 A (4): '+str(convertUnits(20, 'MI','KM')))
306-
print('QUESTION 8 B (1): '+str(convertUnits(20, 'MI','CE')))
309+
print('QUESTION 8 B (2): '+str(convertUnits(20, 'MI','CE')))
307310

308311
print('QUESTION 9 A (4): '+str(getTotalDistance(tripdata)))
309312

@@ -316,7 +319,7 @@ def main():
316319
print('QUESTION 12 B (2): '+str(getTotalAverageSpeed([])))
317320

318321
print('QUESTION 13 A (4): '+str(getDistantCities(tripdata)))
319-
print('QUESTION 13 B (3): '+str(getDistantCities(tripdata)))
322+
print('QUESTION 13 B (2): '+str(getDistantCities(tripdata)))
320323

321324
print('QUESTION 14 A (5): '+str(getLandMarks('Alpena','Albion', landmarks)))
322325

@@ -332,7 +335,5 @@ def main():
332335
print('QUESTION 19 A (2): '+'Check for comment explaining function.')
333336
print('QUESTION 19 A (2): '+'Check if previous function in file was called.')
334337
print('QUESTION 19 A (2): '+'Check if import statement was used.')
335-
336-
# Print Trip Log
337338

338339
main()

com/prestonsproductions/sourcecode/RoadTrip2018/RoadTrip2018A.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,5 @@ def main():
402402
print('QUESTION 19 A (2): '+'Check for comment explaining function.')
403403
print('QUESTION 19 A (2): '+'Check if previous function in file was called.')
404404
print('QUESTION 19 A (2): '+'Check if import statement was used.')
405-
406-
# Print Trip Log
407405

408406
#main()

com/prestonsproductions/sourcecode/RoadTrip2018/RoadTrip2018Main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,5 @@ def main1():
114114
print('QUESTION 19 A (2): '+'Check for comment explaining function.')
115115
print('QUESTION 19 A (2): '+'Check if previous function in file was called.')
116116
print('QUESTION 19 A (2): '+'Check if import statement was used.')
117-
118-
# Print Trip Log
119117

120118
main1()

0 commit comments

Comments
 (0)