Computer Science Lesson #1

What is a computer? (Jot down few key words)

Key words:

  • Calculation 
  • Numbers 
  • Binary 
  • Input and output 
  • communication 
  • Complex 
  • Fast 
  • Data 
  • Information 

Define computer and explain other elements about it:

Computer is an electronic device that produces output based on a certain input.

If there is input, output, storage, process, communication it’s a computer 

Input – taking pictures, typing, buttons 

Output – vibration (little motor spinning = vibrate),  

Process – spelling checking, calculating 

Storage – browsing history, text from one year ago, pictures 

Communication – call, text (sending each other messages), Wi-Fi, cellular

data, Bluetooth 

BASIC PYTHON CODE:

Assigning a function + assigning variables a value + the use of comment (#)

#This code will work when you press the Run button

#BTW hashtags (#) at the start of a line of code signify a comment which means the python interpretor ignores these lines. These are used to add comments to your code to help yourself and others understand what your code is doing.



def add_two_numbers(number1, number2):
  answer = number1 + number2
  return answer


#print(add_two_numbers(7,8))




# Task1 code - At the moment the code doesn't do anything. your task is to make it do the correct thing.abs

def multiply_two_numbers(number1, number2):
  answer = 0  #you need to change this line
  return answer
  
# you need to uncomment the line below (remove the #) to that the function gets called and the result is printed out
#print(multiply_two_numbers(7,8))


# Task 2 - Create a function called subtract_two_numbers and use it to calculate 36-24

def subtract_two_numbers(n1,n2):
  ans = n1 - n2
  return ans

print(subtract_two_numbers(36,24))

THis code includes various functions (Adding, Subtracting, and multiplying)

Comments

Leave a comment