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

A. Python Notes

This document contains revision questions from a Python lesson. It identifies valid and invalid variable names in Python and their reasons for validity or invalidity. It also identifies the data types of different values in Python. The rest of the document contains questions and answers about Python concepts like comments, variables, type conversion, programs, modes, keywords, input statements, power operators, and integer division.

Uploaded by

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

A. Python Notes

This document contains revision questions from a Python lesson. It identifies valid and invalid variable names in Python and their reasons for validity or invalidity. It also identifies the data types of different values in Python. The rest of the document contains questions and answers about Python concepts like comments, variables, type conversion, programs, modes, keywords, input statements, power operators, and integer division.

Uploaded by

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

Revision Questions from python.

Find the invalid variable names or identifiers and


write the reason for invalidity
1.3dGraph-invalid(cannot start with a number)
2.Roll#no-invalid(# cannot be used)
3.DOB-valid
4.D.O.B-invalid(dot cannot be used)
5.Firstname-valid
6.First Name-invalid(space cannot be used)
7.if-invalid(keyword cannot be used)
8.while-invalid(keyword cannot be used)
9.for-invalid(keyword cannot be used)
10.else-invalid(keyword cannot be used)
11.Myfile-valid
12.99flag-invalid(cannot start with a digit)
13._abc-valid
14.break invalid(keyword cannot be used)
15.Breakvalid
16.Whilevalid
17.Forvalid
18.True-invalid(True is a keyword)
19.true-valid
20.1abc-invalid(cannot start the digit)

Identify the data types in python.


1.23.78 float
2.56 integer
3.True Boolean
4.False Boolean
5.’True’ String
6.”False” String
7.”Hello” String
8.90 Integer
9.”My School” String
10.78.0 float
11.”987” String
12. “*&^%” String
1. What are comments?How Many ways we can
give comments in python?
Ans:Comments are non executable statements.2
ways we can give comments in python.Single line
comments and multi line comments.
Single line comment starts with #.Multi line
comments starts and ends with triple quotes(‘’’).
2.What is a variable?
Ans: A variable is a named location used to store
data in the memory.
3.What are the rules for writing a variable name
or an identifier?
Ans:
1.A variable name must start with an alphabet or
an underscore.
2.A variable name cannot have a space or any
other special character.Only special character
used is underscore.
3.Python Keyword cannot be used
4.Cannot start with a digit
4.What is type conversion?
Ans:The process of converting from one data type
to another data type.
5.Which are the two ways of type conversion?
Ans:implicit type conversion and explicit type
conversion.
6.What is a program?
Ans:Program is a set of instructions given to the
computer to do a specific task.
7.Which are the two modes of python?
Ans:script mode and interactive mode
8.Differentiate interactive mode and script mode?
Ans:In script mode what ever we type can be
saved but in interactive mode we cannot save the
commands.
9.What is a keyword(reserved word)?
Ans:Keywords are words having special meaning
in the language.They are also called reserved
words.
10.What is the use of input statement?
Ans:input statement is used to accept the value
from the user at run time.
Syntax
Variable=input(“Prompt message”)
11.Which operator is used for finding the power
of a number?
Ans:**
12.Write a statement to find 9 to the power 6.
print(9**6)
13.Differentiate / and //?
/ is used for division ans returns a float value.
Example 25/10 will give 2.5
// is used for integer division.
Example 25//10 will give 2

You might also like