0% found this document useful (0 votes)
26 views

Evidence Python

Uploaded by

alexpickleton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Evidence Python

Uploaded by

alexpickleton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

9618 Paper 41 – AS & A Level Computer Science evidence document

Candidate Name: [Enter your name here]


Centre Number: [Enter your centre number here]
Candidate Number: [Enter your candidate number here]

Screenshots or program listings must be copied into appropriate cells in the following table.

Save this evidence document as evidence_ followed by your centre number_ candidate number,
for example, evidence_ zz999_9999 and insert your name, centre number and candidate number
into the header above.

Examiners must be able to read the contents including any screenshots without the use of a
magnifying glass. Answers that are not readable or are missing will not be awarded any marks.

Save this evidence document at regular intervals, for example every 10 minutes.

Question 1
Part 1(a)(i)
DataArray = []

with open("Data.txt", 'r') as inputFile:


for i in range(25):
DataArray.append(int(inputFile.readline().strip()))

Part 1(a)(ii)
DataArray = []

with open("Data.txt") as inputFile:


for item in inputFile:
DataArray.append(item.strip())

Part 1(b)(i)
def printArray(list):
for item in list:
print(item)

1
9618 Paper 41 – AS & A Level Computer Science evidence document

Candidate Name: [Enter your name here]


Centre Number: [Enter your centre number here]
Candidate Number: [Enter your candidate number here]

Part 1(b)(ii)
def printArray(list):
for item in list:
print(item)

DataArray = []

with open("Data.txt") as inputFile:


for item in inputFile:
DataArray.append(item.strip())

printArray(DataArray)

Part 1(b)(iii)
{Copy and paste the screenshot for Question 1(b)(iii) here}

Part 1(c)
def LinearSearch(list, target):

count = 0

2
9618 Paper 41 – AS & A Level Computer Science evidence document

Candidate Name: [Enter your name here]


Centre Number: [Enter your centre number here]
Candidate Number: [Enter your candidate number here]

for item in list:


if item == target:
count += 1
return count

Part 1(d)(i)
DataArray = []

with open("Data.txt") as inputFile:


for item in inputFile:
DataArray.append(int(item.strip()))

def LinearSearch(list, target):

count = 0

for item in list:


if item == target:
count += 1
return count

inputNumber = int(input("Input a whole number between 0 and 100 inclusive:


"))

while inputNumber > 100 or inputNumber < 0:


inputNumber = int(input("Input a whole number between 0 and 100
inclusive: "))

foundCount = LinearSearch(DataArray, inputNumber)

print(f"The number {inputNumber} is found {foundCount} times. ")

3
9618 Paper 41 – AS & A Level Computer Science evidence document

Candidate Name: [Enter your name here]


Centre Number: [Enter your centre number here]
Candidate Number: [Enter your candidate number here]

Part 1(d)(ii)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy