Python Assignment
Python Assignment
SOLVED ASSIGNMENT
CLASS – XI
4. It is extensible language.
2. Script mode
(c) Write any four basic numeric data types used in Python.
(d) Write a program that asks two people for their names; stores the names in variables called
Ans: 1. Identifiers may have letters A-Z, a-z, numbers 0-9 and _ (underscore).
4. it is case sensitive i.e. upper case letters and lower case letters are different
(b) Write any two-assignment statement to assign float and string value.
Pi = 3.14
1. + - Addition
- - subtraction
* - multiplication
/ - division
** - Exponentiation
% - Modulus
Operator Description
** Exponentiation (raise to the power)
+,- unary plus and minus
% =, / =, // = , -
Assignment operators
=, + =, * =
not and or Logical operators
Q3 (a) Write
the following expressions using operators used in Python:
a+ b
(i) c= (ii) x = a 3 + b3 + c3
2a
−b ± √ b2−4 ac
(iii) A=π r ( r+ h)2 (iv) x=
2a
Answer: 1. c = (a + b) / (2 *a)
X = 2* 3/ 5 + 10 //3 - 1
Ans: 3
(c) Write a program to input values for Principle, rate and Time and calculate compound interest.
r = input(“Enter rate : “)
t = input(“Enter time : “)
A = p * (1 + r/100.0) ** t
CI = A – p
A = 3 – 4 + 10
B=5*6
C = 7.0/2.0
D = “Hello” * 3