SPS 2022 Sec 4E Computing Prelim P2_Marking Scheme
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Sec 4 Computing 2022 Prelim Paper 2 Marking Scheme Task 1:
Task 2: num_inputs = int(input("Enter the number of sets of data to be cateogorised: ")) # 2c[1] for i in range(num_inputs): # 2c[1] systolic = int(input("Enter your systolic pressure (mmHg): ")) diastolic = int(input("Enter your diastolic pressure (mmHg): ")) cat = None result = ["Normal BP", "High-normal BP", "Stage 1 Hypertension", "Stage 2 Hypertension", "Isolated Systolic Hypertension"] # 2b[1] print("Your BP is", systolic, "/", diastolic, "mmHg.") # 2a[1] if systolic < 120 and diastolic < 80: cat = 0 if (systolic >= 120 and systolic <= 139) or (diastolic >= 80 and diastolic <= 89): cat = 1 if (systolic >= 140 and systolic <= 159) or (diastolic >= 90 and diastolic <= 99): cat = 2 # 2b[2] if systolic >= 160 or diastolic >= 100: cat = 3 # 2b[2] if systolic > 140 and diastolic < 90: cat = 4 # 2b[2] print("Diagnosis:", result[cat])
Task 3 all_hashes = ["#gogreen#recycling#upcycling",'' "#coolgames#experiment#expertmode#awesomegames",'' "#diycook#ironchef",'' "#outdoor#fauna#flora#nature#scenery#sunset",'' "#magic#howcanitbe"] views = [230, 683, 388, 597, 127] post_titles = ["My Upcycling Project", '' "Stanley's Awesome Games", '' "Chef @ Home", '' "An afternoon at Bukit Timah Reserve", '' "Card Tricks"] #1 Missing ] num_hashes = [] for i in range(5): #2 Missing : num_hashes += [len(all_hashes[i].split("#")) - 1] #3 Typecast [] highest_hash = max(num_hashes) index = None for j in range(5): if num_hashes[j] == highest_hash: #4 == not = index = j #5 index instead of j print(post_titles[index],"has",highest_hash,"hashtags which is the highest among all posts.") average = sum(num_hashes) / 5 #6 / instead of % print("The average number of hashtags is", average) #7 average instead of sum highest_view = max(views) #8 views instead of view index = None for k in range(5): #9 5 instead of 4 if views[k] == highest_view: index = k #10 index = k instead of the other way print(post_titles[index],"has",highest_view,"views which is the highest among all posts.")
Task 4 11) receipt = input("Enter your receipt number: ") #[1] Initialize receipt and mobile while len(receipt) != 9 or receipt[:4] != "DRAW" or receipt[4:].isdigit()==False: receipt = input("Enter your receipt number: ") #[2] Data validation of receipt mobile = input("Enter your mobile phone number: ") while len(mobile) != 8 or mobile.isdigit()==False: mobile = input("Enter your mobile phone number: ") #[2] Data validation of mobile prize_lst = ["a 65-inch television", "a $50 shopping voucher", "a $10 shopping voucher", "a recylable bag"] available = [1, 20, 50, 999999] #[1] Initialize prize list and availability import r
Content continues in the PDF.
Related notes
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 MSExam Papers · 2024
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices

