Objectives
🟃 Working inScript mode
❖Create program
❖Run a program
🟃 Data Types
❖Integer
❖Float
❖String
🟃 Input Function
🟃 Print Function
🟃 Recap
3.
Working in Script
mode
Forwriting lengthy programs in Python, Script
mode is used. Using this mode, we can create and
edit Python programs. In this mode, we can save
our file so that it can be used later. The complete
script is written in an editor, such as a Notepad in
Windows.
Step-1: File New
🡪
Step-3: Type the
pythonprogram
Step-4: Save the
python program
.py is the
extension for
PYTHON files.
6.
Step-5: Run Run
🡪
Moduleor Press
function key F5
Step-6: The output in
interactive mode
Script
Mode
Interactive
Mode
7.
1. Write aprogram to print your hobbies. (any two, in two different
lines.)
2. Write a program to print the 4 item’s total price. (The items can
be fruits, books, mobile, pizza etc.)
3. Write a program to print three subject’s total marks and
average.
int float str
int
longint
(Older version)
bool
Stores a
number with
out decimal
number
long int
(Older version)
It represents
logical value True
means 1, False
means 0
Data Types
10.
Assignment – Writethe data type for the
following values.
1. 56
2. 89.25
3. Name
4. 7>3
5. Two
6. ‘67.89’
7. Age>=18
8. 0
9. 15-Aug-2020
10.function
11.
input() function
⮚ Inputfunction is used to accept the
value for a variable from the user. To
input integer and float values, we
can use int() or float() along with
input().
⮚ In python, input() function takes
one string argument. This means
that whatever values is being
entered by the user, it will be taken
as a string argument.
12.
It doesn’t display
sumrather the
numbers are
displayed together
and are printed as
string.
13.
Write a Pythonprogram to read school name and
grade, display in which grade he/she will be studying
after two years.
Then
how do
we
do?????
14.
It is displayingsum.
As the int function
has converted
string to integer.
Thus addition is
possible.
int function is used to
convert string to integer
value.
1. Write aprogram to calculate 5% discount on total purchase of
stationery.
2. Write a program to convert miles into kilometers.
1mile=1.6 km
3. Write a program to convert temperature from Fahrenheit to Celsius.
Celsius=(Fahrenheit-32) * 5/9
17.
Features of print()function
🞇The print() function in python is used to print
a message or value on the output device.
🞇It converts the message or an object into a
string before writing it on the screen.
🞇It can have multiple parameters.
🞇It supports multiple escape sequences to
format the output,
eg., ‘n’- new line
‘t’ – tab space
‘r’ – carriage return.