0% found this document useful (0 votes)
2 views2 pages

Ch-8 Python

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Ch-8 Python

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CHAPTER-8: INTRODUCING PYTHON

SECTION A

A. Fill in the blanks:


1. Syntax 2. Guido Van Rossum 3. Edit 4. Line by line 5. Variable 6. Keyword

B. State True or False:


1. True 2. True 3. True 4. False 5. False 6. True

7. True

C. Application Based Questions:


1. Kritika should use '\t' separator with the print() function.

2. Aman should use Interactive mode.

SECTION B
A. Multiple Choice Questions:
1. List 2. Overwritten 3. Assignment 4. float 5. \t 6. Script area 7. 1020

C. Answer the following:

1. Some of the features which make Python so popular are as follows:


i) It is an easy to learn general-purpose programming language.

ii) It is a platform independent programming language, which means it can be used on any machine
and in any operating system.

iii) It has a simple syntax.

iv) Python is a case sensitive language.

v) It is an interpreted language.

vi) It is free to use and even for commercial products.

2. A variable stores data values. It can store only one data value at a time. When a new value is
stored in a variable, its previous value gets overwritten. The rules for valid identifier (variable name)
are:

i) A variable name must start with an alphabet (capital or small) or an underscore (_).

ii) A variable name can consist of alphabets, digits, and underscore. No other character is allowed.
iii) A Python keyword cannot be used as a variable name.

iv) A variable name can be of any length.

v) Variable names are case-sensitive (e.g., Age and age are different variable names).

3. Python works in two modes: Interactive mode and Script mode. In the Interactive mode of
Python, the instructions are executed line by line giving the output. Interactive mode is preferred for
small programs, where only a few commands are to be executed. This mode is also beneficial for
testing code where you type the commands one at a time and get the result or error immediately.
Whereas, for writing 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.

4. A data type represents the type of data stored in a variable. Python has various standard data
types based on the types of values stored in variables. Some examples of data types used in Python
are, int, float, str, bool. float: Represents floating point values (numbers with fractional part). The
fractional part of a floating point number may be 0 as well. Examples of floating point numbers are,
3.14, -48.6, 18.0, etc. str (String): String data type represents strings of characters enclosed within
quotation marks, for example, 'Hello'.

5. The print() function is used to display the output of any command on the screen. We can also pass
more than one argument to the print()function. Separators are used with the print() function to
format the output. The separators used in Python are Using ',' operator: When you use ',' operator
as the separator among the values, the values are displayed with a space between them. Using '\t'
(tab space): When you use '\t' escape sequence as the separator among the values, the values are
displayed with a tab space between them. Using '\n' (Newline character): A newline character in
Python is used to end a line and start a new line. In Python, the new line character can be used with
the input function and with the print function.

6. Interpreter is a language processor. When you type a command next to the python prompt (>>>)
in the interactive mode of Python, and press the Enter key, the interpreter converts the command
into machine language. After processing, the interpreter again converts the machine code into
human readable form (output). A compiler is also a language processor that converts a program
written in high-level language into machine language, and vice versa, just like an interpreter.
However, unlike an interpreter, a compiler does this in one single step.

You might also like