Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Chapter 1

1.1 Python Installation

Download the latest stable version of Python 3.9.X from the


following link: https://www.python.org/downloads/
After installation, one can see the IDLE shell command prompt installed in the
program menu. you can write the code staements directly on the IDLE shell
command prompt or write your code in the form of a module in an editor as shown
in Fig. 1.1.

Fig. 1.1 IDLE Shell 3.9.10 command prompt interpreter and editor for moduler coding.
1.2 Using IDLE Shell Command Prompt Interpreter 2 1.2 Using IDLE

Shell Command Prompt Interpreter

You can use the IDLE Shell Command Prompt Interpreter to directly execute the
coding staements as shown in Fig. 1.2.

Fig. 1.2 IDLE Shell 3.9.10 command prompt interpreter.

For each of the following expressions, what value will the expression give?
Verify your answers by typing the expressions into Python.
a. 9 - 3
b. 8 * 2.5
c. 9 / 2
d. 9 / -2
e. 9 // -2
f. 9 % 2
g. 9.0 % 2
1.3 Using IDLE Shell Editor for Moduler Coding 3

h. 9 % 2.0
i. 9 % -2
j. -9 % 2
k. 9 / -2.0
l. 4 + 3 * 5
m. (4 + 3) * 5

1.3 Using IDLE Shell Editor for Moduler Coding


For coding in a module, you write the coding statements in the main module and
run it after completing the code. Fig. 1.3 shows a code module which asks the user
to input temperature in celcius. Then it converts the temperature into fahrenheit
and print the result.

Fig. 1.3 IDLE Shell 3.9.10 Editor for Modulor Coding.

1.4 Practice Coding


Given is the code of a program named chaos. The equation in the module define
some chaotic function which is very sensitive to the initial value. A loop statement
is also used to print
1.5 Viva Questions 4
multiple outputs. Write the code in module and see the results by changing the
initial values taken as an input from the user.

Fig. 1.4 Chaos.py Code.

1.5 Viva Questions


1 Why python is better than other programming languages in todays world of
data science?

2 What are the key features of Python?

3 What are the benefits of using Python?

4 What type of language is python? Programming or interpreted?

You might also like