Class 9 Python Question Answers For Theory Exam
Class 9 Python Question Answers For Theory Exam
Q1) What are the key features of python ? Mention various applications along with it
Features of Python
Applications of Python
1. Script mode is where you write your code in a .py file and then run it with the python
command. This is the most common way that people use Python because it lets you write
and save your code so that you can use it again later. Script mode produces output that can
be saved and reused.
2. Interactive mode is where you type your code into the Python interpreter directly. This is
useful for trying out small snippets of code, or for testing things out as you’re writing them.
Interactive mode produces output that is displayed on the screen and then disappears.
Q3) What are comments in python ? List down the various types of 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. In Python, we use the
hash (#) symbol to start writing a comment.
Q5) What are the rules for naming of variables and constants
Q6) Explain python input and output with the help of an example.
We use the print() function to output data to the standard output device (screen). We can also
output data to a file. An example is given below.
a = "Hello World!"
print(a)
User input
In python, input() function is used for taking input from user at the time of execution. Input can
be any value, like integer, string, floating number,etc.
Q7) What is type conversion ? Explain the types of type conversion with the help of an
example.
Example:
A=10
B= 20.5
S=A+B
print(S)
In above code, interpreter automatically convert integer value of variable A to float value at the
time of addition with floating number.
Example:
A=10
B= 20.5
Sum =A+int(B)
print(sum)
In the above code, data type of variable B is converted to integer by the user.