
PROJECT WORK 1:
GUESS THE NUMBER

Need to know
–Variables
–Integers
–Input / Output
–Print
–While loop
–If/Else statements
–Random numbers (provided in this chapter)
2

TERMINOLOGY
random -
кездейсоқ -
случайный
to locate -
орналастыру -
разместить
package -жинақ
-набор, пакет
search -іздеу -
поиск
to generate -
түрлендіру -
генерировать
3

Random
Numbers
(and Modules)
4

Random number
is a number that is
picked without
any order or rule.
5

In programming, it is very
difficult to think out and write
an algorithmthat can randomly
pick numbers.
In Python, such difficult
calculations like ‘random’are
stored in form of packages and
are called ‘modules’.
6

In this exercise we need
to use a module that
generates random
numbers.
This module is called
‘random’.
7

To use a module, type the
following at the top of your file:
import random
This means that you allow to use
a module called ‘random’
in your code.
8

To generate a random integer type:
a = random.randint(2, 6)
Once you run this code,
the variable abecomes equal to a
random integer between 2 and 6
inclusively.
9

Let us play a game.
A program thinks out
a number that remains
unknown to us.
Our task is to find that number.
10

11
If our input is incorrect,
the program must indicate
what is exactly wrong with
the guess (e.g. ‘your number is
too high or too low’).
If the guess is correct, the
program must give a message
‘You are right, man!’.

12

GROUP PROGRAMMING
Divide into groups & Make this project.
After completion check & share your codes.
13

THANKS!
Any questions?
14