Assignment-1
Assignment given date: 30th April
Assignment submission date: 16th May
1. What is the maximum possible length of an identifier?
2. List some Python Variable Naming Rules
3. What will be the output of?
a = 12
x = a >> 2
y = a << 1
print(x, y)
4. What is the use of indentation in python?
5. What is the output of: print 1 + 2 * float(3) / 4 – 5 ?
6. How are complex numbers represented in python?
7. How to define Constants in Python?
8. Write a program in python to calculate area of triangle by heron’s
formula? Where s = (a+b+c)/2 and Area = √ s(s-a)(s-b)(s-c)
9. Execute and write down the outputs:
List = [1, 2, 3, 4, 5, 6, 7, 8, 9]
# Display sliced list
print(List[3:9])
print(List[3:9:2])
print(List[3:9:3])
print(List[3:9:8])
print(List[9:11])
print(List[::2])
print(List[::4])
print(List[::])
print(List[::-1])
print(List[::-3])
print(List[:1:-2])
print(List[1:1:1])
10. Write a program to perform following tasks:
- Read a list of integers from a user.
- Display the count of occurrence of each number
- Create two new lists containing the even and odd numbers from the
original list.
11. Read radius of a circle and side of a square from user using single input()
method. Then calculate and display area of the circle and the square.
12. Explain the usage of below string operations:
lower()
isupper()
startswith()
join()
split()
rjust(*)
center()
lstrip()
13. Explain the usage of below list operations:
Append, extend, insert, remove, pop, count, index, clear
14. Python Program to check whether a number is Palindrome or not
15. Python Program to check whether a number is Prime or not