50% found this document useful (4 votes)
13K views4 pages

Answer Key Python Class 7

The document contains details about Python programming concepts like data types, variables, operators, and functions. It provides definitions for key terms: 1. A data type is a classification of data that tells the interpreter how the value can be used. Common Python data types include integers, floats, strings, and booleans. 2. Variables store values that can change during program execution. Variable names must start with a letter and can include numbers and underscores. 3. The print() function displays output to the screen. Operators like + perform operations on values. Relational operators compare values and return True or False.

Uploaded by

Divtej Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
50% found this document useful (4 votes)
13K views4 pages

Answer Key Python Class 7

The document contains details about Python programming concepts like data types, variables, operators, and functions. It provides definitions for key terms: 1. A data type is a classification of data that tells the interpreter how the value can be used. Common Python data types include integers, floats, strings, and booleans. 2. Variables store values that can change during program execution. Variable names must start with a letter and can include numbers and underscores. 3. The print() function displays output to the screen. Operators like + perform operations on values. Relational operators compare values and return True or False.

Uploaded by

Divtej Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

Class 7

Answer Key : Python

1. Python is a versatile/case sensitive/general purpose language.


2. In the interactive mode of python, the instructions are executed line by line.
3. Data types are the classification or categorization of data items.
4. print function prints the specified message to the screen.
5. Syntax refers to the grammatical rules to be followed while writing a program.
6. IDLE stands for Integrated Development and Learning Environment.
7. String is a collection of one or more characters put in a single quote or double-
quote.
8. Assignment Operator (=) in Python is used for assigning the value of the right
operand to the left operand.
9. + operator is used to concatenate two or more strings.
10. Equals to (==) operators are used to compare the values of variables.

Answer the following:

1. What are data types?


Ans: A data type is a classification of data which tells the interpreter how the
programmer intends to use the data. It tells what kind of data that value can have.
For Ex. if the variable "num1" is created with the value "125," the variable would be
created as a integer data type.
2. What is a variable? Discuss the rules for naming the variable.
Ans: Variable is a named memory location that stores the data and whose value
may change during the program execution.

Rules to write the Variable names


 A variable name must start with an alphabet (Capital or small) or an
underscore(_)
 A variable name can consist of alphabets, digits and underscore.
 A python keywords cannot be used as a variable name. Ex. Print,input cannot be
used as variable name.
 Example of valid variable name: Class, emp_code, num1,a45b
3. What is the use of print () function?
Ans: The print() function prints the specified message to the screen, or other
standard output device. Example: print ("Good Morning")
4. What is an interpreter?
Ans: An interpreter is a computer program that directly executes instructions written
in a programming or scripting language into a machine language program. Every
source statement will be executed line by line during execution,

5. Define operator. Name the different types of operators in Python.


Ans: Python Operators are used to perform operations on values and variables.
These are standard symbols used for the purpose of logical and arithmetic
operations.
 Assignment Operator (=)
 Arithmetic Operators (+,-,*, /, //, %,**)
 Relational Operator (>, <, ==, <=,>=)
 String Operators (+,*)

6. What are relational operator?


Ans: Relational operators are used to compare the values of variables and
determine the result in a Boolean expression i.e. either returns True or False
according to the condition.

Relational Operators Meaning

> Greater than

< Less than

>= Greater than or equal to

<= Less than or equal to

== Equal to

!= Not equal to

7. What is the use of ‘+’ in string operator?


Ans:. We use ‘+’ for concatenation that is to join two or more strings.
Application based questions:
1. Kritika’s computer teacher has given her an assignment to display the names
of the fruits separated with a tab space in Python. Which separator should she
use with the print () function?
Ans: \t
2. Aman is working on his mathematics project work. He has to perform some
quick calculations. Which mode of Python programming should he use for
dong them?
Ans: IDLE
3. Rohan’s teacher has asked him to create a program in which the user enters
data in Fahrenheit and it generates the output in Celsius. What kind of
operators do you suggest him to use for this task?
Ans: Arithmetic Operator

Practical Questions:

Write a program to find the area and circumference of a circle.


(Hint: Take radius as input from user)

Ans: r=int(input (“Enter Radius”))


Area=3.14*r*r
Cir=2*3.14*r
print(“Area is”, Area)
print(“circumference is”, Cir)

Write a program swap two numbers using a temporary variable.


Ans: A=10
B=45
print(“A=”, A)
print(“B=”, B)
C=A
A=B
B=C
print(“After Swapping”)
print(“A=”, A)
print(“B=”, B)
Write a program to take amount in dollar and current price of one Dollar from
user. Calculate and display the amount in rupees.
Ans: d=int (input (“Enter amount in Dollars”))
p=int (input (“Enter current price of one Dollar”))
r=d*p
print (“Amount in Rupees =”, r)

Write a program to input Name and Marks of three subjects (Maths, Science,
SST). Calculate the total marks scored and the percentage of student.
(Hint: Let maximum marks for each subject be 50.
∴ Percentage=marks obtained/150*100)
Ans: math=int (input (“Enter marks for Maths (out of 50)”))
Sci= int (input (“Enter marks for Science (out of 50)”))
SST= int (input (“Enter marks for SST (out of 50)”))
TM=math+Sci+SST
Per=(TM/150)*100
print(“Marks scored =”, TM)
print(“Percentage =”, Per)

You might also like