0% found this document useful (0 votes)
3 views

lecture 4

The document compares interactive mode and script mode in Python, highlighting that interactive mode allows immediate results but cannot save code, while script mode enables saving and editing code. It also explains data types in Python, noting that they classify data items and represent the kind of operations that can be performed. Additionally, it describes various data types such as integers, floats, complex numbers, and sequences.

Uploaded by

vishal10thakwani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

lecture 4

The document compares interactive mode and script mode in Python, highlighting that interactive mode allows immediate results but cannot save code, while script mode enables saving and editing code. It also explains data types in Python, noting that they classify data items and represent the kind of operations that can be performed. Additionally, it describes various data types such as integers, floats, complex numbers, and sequences.

Uploaded by

vishal10thakwani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

s.

no Interactive mode Script mode

1. A way of using the Python interpreter by . A way of using the Python interpreter to read and
typing commands and expressions at the execute statements in a script.
prompt.

2. Cant save and edit the code . Can save and edit the code.

3. If we want to experiment with the code, we If we are very clear about the code, we can use script
can use interactive mode. mode.

4. we cannot save the statements for further we can save the statements for further use and we
use and we have to retype no need to retype
all the statements to re-run them. all the statements to re-run them.

5. We can see the results immediately. We cant see the code immediately.
• Data types are the classification or categorization of data
items.
• It represents the kind of value that tells what operations can
be performed on a particular data.

Since everything is an object in Python programming, data types are


actually classes and variables are instance (object) of these classes.
•This value is represented by int class.
• It contains positive or negative whole
numbers (without fraction or decimal).
•In Python there is no limit to how long
an integer value can be.
• This value is represented by float class.
• It is a real number with floating point
representation.
• It is specified by a decimal point.
• Optionally, the character e or E followed by a
positive or negative integer may be appended
to specify scientific notation.
•Complex number is represented by
complex class.
•It is specified as (real part) + (imaginary
part)j.
•For example – 2+3j
• In Python, sequence is the ordered collection of similar or different
data types.
• Sequences allows to store multiple values in an organized and
efficient fashion.
• There are several sequence types in Python –
• String
• List
• tuple

You might also like