0% found this document useful (0 votes)
13 views2 pages

Class 11 Python Coding Examples

This document contains a series of Python coding examples suitable for Class 11 students. Each example demonstrates basic programming concepts such as arithmetic operations, control structures, loops, lists, dictionaries, and string manipulation. The document provides the code along with the expected output for each example.

Uploaded by

bosetaraknath02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Class 11 Python Coding Examples

This document contains a series of Python coding examples suitable for Class 11 students. Each example demonstrates basic programming concepts such as arithmetic operations, control structures, loops, lists, dictionaries, and string manipulation. The document provides the code along with the expected output for each example.

Uploaded by

bosetaraknath02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CLASS 11 PYTHON CODING

1.
x = 10
y=5
print(x + y)
Result:
15

2.
a = 20
b=4
print(a // b)
Result:
5

3.
print("Python" * 3)
Result:
PythonPythonPython

4.
x = 15
if x > 10:
print("High")
else:
print("Low")
Result:
High

5.
for i in range(1, 5):
print(i)
Result:
1
2
3
4

6.
i=1
while i <= 3:
print(i)
i += 1
Result:
1
2
3

7.
a = [10, 20, 30]
print(a[1])
Result:
20

8.
a = [1, 2, 3]
[Link](4)
print(a)
Result:
[1, 2, 3, 4]
9.
d = {"A": 1, "B": 2}
print(d["B"])
Result:
2

10.
d = {1: 'One', 2: 'Two'}
d[3] = 'Three'
print(d)
Result:
{1: 'One', 2: 'Two', 3: 'Three'}

11.
s = "COMPUTER"
print(s[1:5])
Result:
OMPU

12.
print(len("Python"))
Result:
6

13.
t = (5, 10, 15)
print(t[-1])
Result:
15

14.
x=5
y = 10
x, y = y, x
print(x, y)
Result:
10 5

15.
n=5
sum = 0
for i in range(1, n+1):
sum += i
print(sum)
Result:
15

You might also like