You are on page 1of 4

More in Python

Q-1) Fill in the blanks :


1. False
2. hahaha
3. [8,4,6]
4. A SET
5. and operator

Q-2) Write T for True and F for False:


1) F
2) T
3) F
4) T
5) F
6) T
7) F
8) T
9) F
10) F

Q-3) Match the following :


1) e
2) d

3) a

4) c
5) b
Q-4) Answer the following questions :

1) A comment is text that doesn’t affect the outcome of a code. It is just an


information to let us know what we have done in a program or what is being
done. In python, hash (#) symbol is used to denote a comment. We have the
two types of comments in python.
(a) Single line comments
(b) Multi – Line comments

2) An Identifier is a name given to entities like class, functions, variables etc. It


helps to differentiate one entity from another. Identifier have different
properties:
(a) Identifiers can be a combination of letters in lowercase (a to z) or
uppercase (A to Z) or digits (0 to 9) or underscore ‘_’
(b) An Identifiers cannot start with a digit.
(c) Keywords cannot be used as identifiers.
(d) We cannot use special symbols like !, @, #, $, % etc. in our identifiers.
(e) An identifiers can be of any length.

3) A variable is a place to store information such as numbers, text, lists of


numbers. A variable is a reserved memory location on the computer’s
memory.

There are some rules for naming variables & constants in python:
(a) Create a name that makes sense. Vowel makes more sense
than v.
(b) Use camel case notation to declare a variable. It starts with
lowercase letter. For example: myName
(c) Use capital letters wherever possible to declare a constant.
For example: PI
(d) Never use special symbols like !, @, #, $, % etc.
(e) Constant and variable names should have combination of
letters in lowercase or uppercase or digits or an underscore (_).
4) The two Data types in python are:
(a) Numbers: A Number stores numeric value. Integer, Float, and Complex
values all belong to the python numbers data types. Example: age = 17 ,
Marks = 42.7
(b) SET: Set is an unordered collection of values of any type with
no duplicate entries.
Example: thisset = {“apple”,”banna”,”cherry”}
Print(thisset)

5) Operators are used to perform operations on variables and


values. Both values and variables, when used with operators, are
known as operands. Operators are categorized as Arithmetic,
Relational, Logical and Assignment.

(a) Arithmetic Operators: The operators which are used to do


mathematical operations by python programming are called Arithmetic
operators. They are :
+ addition
- subtraction
* multiplication
/ division
% modulo (to get remainder)
// floor division
** raised to power

(b) Relational Operators: The operators which are used to compare the
variables are called Relational operators. They are :
> greater than
< lesser than
>= greater than or equal to
<= lesser than or equal to
== is equal to
!= is not equal to
(c) Logical Operators: The operators which are used to compare two or
more logical expressions are called logical operators.

They are : AND , OR , NOT


and – operator returns True if both the statements are true.
or – operator return True if one of the statement is true.
not – operator Reverse the result, returns False if the result is true.

You might also like