Ch-Python Class 9
Ch-Python Class 9
1. What is Python?
Simple and Easy to Learn: Python has a simple syntax that is easy to understand.
High-Level Language: Python allows you to write programs that are closer to human language.
Portable: Python code can run on different platforms (Windows, Mac, Linux).
Open Source: Python is free to use and its source code is available to everyone.
3. Write the applications of Python
Game Development
Automation (Scripts)
GUI Applications
4. Mention the modes in Python
Python shell can be used in two ways, viz., interactive mode and script mode. Where Interactive Mode, as
the name suggests, allows us to interact with OS; script mode lets us create and edit Python source file.
5. Explain Python Basics.
a) Comments
A comment is text that doesn't affect the outcome of a code; it is just a piece of text to let someone know
what you have done in a program or what is being done in a block of code.
Single-line comment: # This is a comment
Multi-line comment:
'''
This is a
Multi-line comment
'''
b) Variable
A variable is a named placeholder of data that is assigned a value. If the value is modified, the name does
not change. A variable in Python can hold any type of data value.
Follow some rules of naming convention while declaring a variable. These rules are:
c) Data Types
In Python, each value has a data type. Data types are basically classes, and variables are instances
(objects) of these classes, because everything in Python programming is an object.
a) Integer & Long
Integer & Long Integer Range of an integer in Python can be from -2147483648 to 2147483647, and long
integer has unlimited range subject to available memory.
b) Float / floating point
Numbers with fractions or decimal point are called floating point numbers.
c) String
String is an ordered sequence of letters/characters. They are enclosed in single quotes (‘ ‘) or double (“ “).
d) Lists
List is also a sequence of values of any type. Values in the list are called elements / items. These are
indexed/ordered.
6. Explain Input and Output in Python