Category: Coding

Revision for Computer Science test: Storage

Memory and Storage Primary Memory Primary memory, also known as main memory, is the only type of memory that could be directly accessed by the microprocessor. It is transistor-based, therefore is faster to do reading and writing. There are two types of primary memory: ROM and RAM. ROM (Read Only

Conversation Machine

import randomdef has_questionmark(qus): wordlist = qus.split() last_word = wordlist[-1] split_last_word = list(last_word) if '?' in split_last_word: return Truedef has_special_words(qus): wordlist = qus.split() first_word = wordlist[0] first_word = first_word.lower() special_words = ['what', 'where', 'when', 'how', 'why', 'are','do','did'] if first_word in special_words: return True def is_a_yn_question(qus): wordlist = qus.split() first_word = wordlist[0]

POTW – It all adds up

This code is to find out the 3-digit numbers that have their digits add up to 9. The problem was originated from the “Problem of the week” from the university of Waterloo. The original question is stated here: https://www.cemc.uwaterloo.ca/resources/potw/2019-20/English/POTWD-19-NA-02-P.pdf The digit positive integer is the sum of all of its digits.

Largest and Smallest Number Flowchart

Grade 9 Computer Science class has started. Although I have learned how to code in C and Python before, I have never drawn a flowchart. I had planned for my code, but not as precise as a flowchart. My first flowchart, a super easy one, to find the largest and

ID Tech Camp: Intro to Coding for Machine Learning

In the past week (July 1 to July 2), I participated in a coding camp organized by the ID Tech organization called “Intro to Coding for Machine Learning”. I found the camp so exciting. I have learned to code before, but never with other students or a formal teacher (Dad

.items in dictionary (Python)

The items() method returns a view object. The view object contains the key-value pairs of the dictionary, as tuples in a list. Details: https://www.w3schools.com/python/ref_dictionary_items.asp

The Daffodil Numbers

//Daffodil Numbers! #include <stdio.h> int main(){    int i, j, k = 0;    for( i = 1; i<= 9; i++){        for( j = 0; j <= 9; j++){            for( k = 0; k <= 9; k++)