Search Header Logo
Python Applied Stream

Python Applied Stream

Assessment

Presentation

•

Computers, Education

•

•

Practice Problem

•

Medium

Created by

Ormac Designs

Used 2+ times

FREE Resource

24 Slides • 19 Questions

1

Introduction to Programming

Week 1: Lesson 1

media

2

Objectives
  • Introducing the concept of coding programs

  • Understanding the programming language

  • Discuss the purpose of programming and its usage

  • Perform a coding activity

  • Define Basic Elements of programming languages

  • Evaluate your new knowledge of coding

3

Programs and Machines

We are surrounded by computer programs. Many of these devices and gadgets that we use everyday are controlled by computer programs.


These machines all follow step-by-step instructions written by computer programmers.

media

4

media

5

What is Coding?

Is a term used for computer programming.


Coding is often referred to as a piece of command given to a computer or a device to perform a specific action.

media

6

Computer Language:

A computer language is often called a "programming language".


A programming language is a type of written language that tells computers what to do in order to work.


It used to make all the computer programs and computer software.



media

7

Computer Language:


A programming language is like a set of instructions that the computer follows to do something.

media

8

Example of programming device to follow instructions


A min-robot programmed to move by it's own, but following certain instructions, which is following black line.

media

9

media

10

Fill in the Blanks

What programming languages do we have? Give one language name

Type answer...

11

media

12

Open Ended

Question image

Discussion: What is the Purpose of Programming?

13

media

14

Some Programming Terms:
  • Code or Program: is a set of instructions to tell the computer what to do

  • Bug: is an error in a code or program

  • Debug: is the process of fixing the error

  • Execute a program: is the process of running the set of instructions

  • programming language: a language to communicate with computers

  • Programmer: a person who writes a program

15

Steps to code:
  • Choose a language

  • Use a code editor or software to program

  • On a piece of paper, write the steps you want your device to do

  • Code the instructions to be performed

  • Compile and debug your program

  • Run and Execute the program

media

16

Coding a calculator to add 2 numbers.

media

17

Coding Activity!

A Blue Bot wants your help in making a cake. Write the steps for cake recipe that Blue Bot needs to follow to make a cake.

media

18

Multiple Select

Objectives Covered

1

Introducing the concept of coding programs

2

Understanding the programming language

3

Discuss the importance of programming and it's usage

4

Perform a coding activity

5

Define Basic Elements of programming languages

19

Basic Elements of any Programming Language
  • Input Data

  • Arithmetic Operations

  • Conditional Statements

  • Looping Statements

  • Output Data

20

For the next class we will cover....

Basic Elements of Programming Languages and

Introducing C++ programming Language

so I want you to research some basic elements of C++

21

Multiple Choice

What is programming?

1

a set of related activities

2

a recipe

3

giving the computer a set of commands

4

someone who knows how to program

22

Multiple Choice

What is a "bug" in programming?

1

an error in a code

2

a scratch on the screen

3

something is wrong with the computer

4

none of the above

23

Poll

What is the purpose of a programming Language?

To understand English

To help people communicate with computers and electronic devices

To be a computer translator

To stop air pollution

24

Multiple Choice

What is "debugging" in programming?

1

the process of finding and fixing errors in programming

2

a programming language of the web

3

giving the computer a set of commands

4

an error in a code

25

Poll

Which of the following is not a programming language?

Java

C++

Python

Android

26

Multiple Choice

What will the output be from the following code?
print("Hello world!")
1
SyntaxError
2
Hello world!
3
"Hello world!"
4
print(Hello world!)

27

Multiple Choice

What symbol do you use to make a comment in Python?
1
@
2
¬
3
;
4
#

28

Multiple Choice

What is the Python built-in function used to display numbers and text on the screen?

1

print

2

input

3

output

4

command

29

Multiple Choice

what is correct code for INTEGER in python?
1
in
2
ing
3
int

30

media
media

Data types and arithmetic
Introduction to Python

Arithmetic operators

Arithmetic

Operator

Example

Output

Addition

+

2 + 10

12

Subtraction

-

9 – 6

3

Multiplication

*

5 * 4

20

Division

/

5 / 2

2.5

Floor division

//

7 // 2

3

Remainder

%

7 % 3

1

31

Multiple Choice

Which of these is the symbol for divide in python?

1

÷

2

/

3

>

32

media
media

Data types and arithmetic
Introduction to Python

Sleep calculator

• Create a program to calculate how many hours per

week you sleep

• Try this code and find the problem!

hourspernight =input("How many hours per night do
you sleep? ")

hoursperweek = hourspernight * 7

print ("You sleep",hoursperweek,"hours per week")

33

media
media

Data types and arithmetic
Introduction to Python

Sleep calculator

• Extend the problem to find the total number of hours

spent sleeping in a month

• Assume an average of 4.35 weeks per month

hourspernight = input("How many hours per night do
you sleep? ")

hoursperweek =float(hourspernight) * 7

print ("You sleep",hoursperweek,"hours per week")

hourspermonth =hoursperweek * 4.35

print("You sleep",hourspermonth,"hours per month")

34

media
media
media

Data types and arithmetic
Introduction to Python

Sleep calculator

• Now find the equivalent number of days per month

you sleep for!

35

media
media

Data types and arithmetic
Introduction to Python

Rounding

hourspermonth = 228.37499999999997
round(hourspermonth) = 228
round(hourspermonth,2) = 228.37

hourspernight = input("How many hours per night do you sleep? ")
hoursperweek = float(hourspernight) * 7
print ("You sleep",hoursperweek,"hours per week")
hourspermonth = hoursperweek * 4.35
hourspermonth = round(hourspermonth)
print (“\nYou sleep",hourspermonth,"hours per month")

36

media
media

Data types and arithmetic
Introduction to Python

Choosing data types

Data

Example

Data Type

Code

Age

14

Integer

int(age)

Shoe Size

6.5

Float

Price

14.99

Postcode

Height

Quantity in Stock

Telephone Number

37

media
media

Data types and arithmetic
Introduction to Python

Defining variable data types

• Python automatically assigns a data type to a

variable

• You can override this to manually define or change

the data type using:

•str()

str(age)

•int()

int(goals_scored)

•float() float(share_price)

• This is called Casting

38

Multiple Choice

What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
1
Good morning 'Dave'
2
Good morning Dave
3
Good morning name
4
Good morning + Dave

39

Multiple Choice

Question image

What do you get when you CLICK ENTER AFTER YOU type the following code:

print(Hi Python!)

1

SyntaxError

2

HI PYTHON!

3

"HI PYTHON!"

4

print(HI PYTHON!)

5

None of the above

40

Multiple Choice

Question image

What do you get when you CLICK ENTER AFTER YOU type the following code:

print("Hi Python!")

1

SyntaxError

2

HI PYTHON!

3

"HI PYTHON!"

4

print(HI PYTHON!)

5

None of the above

41

Multiple Choice

Question image

#What is the output?

1

1,2,3,4,5

2

0,1,2,3,4

3

1,2,3,4

4

5,4,3,2,1

42

Multiple Choice

Question image

#What is the output?

1

a, b, c, d, e

2

a, a, a, a, a

3

0,1,2,3,4

4

e, d, c, b, a

43

Multiple Choice

What will be printed after running this FOR loop:

for number in range(6):
 
    print(number)
1
The number 6 
2
The numbers 0 - 5
3
The number 5
4
The numbers 1 - 6
pattern-tertiary
Introduction to Programming

Week 1: Lesson 1

media

Show answer

Auto Play

Slide 1 / 43

SLIDE