1. list directory
code:
O/P:
print your current directory
code:
O/P:
avi
345
45.32
True
<class 'str'>
<class 'int'>
<class 'float'>
<class 'bool'>
O/P:
The value of 3+4 is 7
The value of 3-4 is -1
The value of 3*4 is 12
The value of 3/4 is 0.75
22.0
True
The value of bool1 and bool2 is False
The value of bool1 or bool2 is True
The value of not bool2 is True
4. input fuctions
code:
O/P:
Enter a number: 21
<class 'int'>
5. sum of two number
code:
O/P:
Input 1st Number = 25
INput 2nd Number = 20
the sum of 1st and 2nd number is = 45
6. Remainder after dividing
code:
O/P:
the remainder when a diveded by b 15
7. average of two number
code:
8. Slicing
code:
O/P:
avinashis very good boy.
a
s
avi
avinas
avinash
vin
nas
se ob.
i
17
True
3
Is very good boy.
3
is very bad boy.
9. String Fuctions
code:
10. Escape Sequence
code:
O/P:
avinash is very
very cleaver boy
11.
code:
12.Letter
code:
O/P:
Dear aviator,
Greeting from ABC coding institute. You are
selected for Executive
congratulation!
Have a great day ahead!
Thanks and regards
12-12-2021
13.Finding double space
code:
O/P: 28
14. replace 2 space with single space
code:
O/P: This is a string with double spaces ok
15. List
code:
O/P:
[1, 2, 4, 56, 6]
4
[98, 2, 4, 56, 6]
[45, 'avi', False, 6.9]
16. slicing of List
cocd:
O/P:
['Avi', 'Tom', 'Rohan', 'Sam']
['Rohan', 'Sam', 'Divya', 45]
17. List Methods
code:
O/P:
[1, 8, 7, 2, 21]
[1, 2, 7, 8, 21]
[21, 8, 7, 2, 1]
[21, 8, 7, 2, 1, 45]
[21, 8, 544, 7, 2, 1, 45]
[21, 544, 7, 2, 1, 45]
[544, 7, 2, 1, 45]
18. Tuple
code:
O/P:
(1,)
1
19. tuple method
code:
O/P:
4
3
20. store List
code:
O/P:
Enter fruit number 1 Mango
Enter fruit number 2 Banana
Enter fruit number 3 Orenge
Enter fruit number 4 Apple
Enter fruit number 5 Grapes
Enter fruit number 6 ShrgarCane
Enter fruit number 7 Cucumber
['Mango', 'Banana', 'Orenge', 'Apple', 'Grapes', 'ShrgarCane', 'Cucumber']
21. tuple test cannot chage
code:
O/P:
TypeError: 'tuple' object does not support item assignment
22. sum of List
code:
O/P: 69
69
23. count number in tuple
code:
O/P: 3
24. fav Languge Dict
code:
O/P:
In a Quick Manner
A coder
[1, 2, 3, 4]
Player
[2, 0, 2, 3]
25. Dict method
code:
O/P:
['Fast', 'Avi', 'Marks', 'anotherdict', 1]
dict_values(['In a Quick Manner', 'A coder', [1, 2, 3, 4], {'AVo': 'Player'}, 2])
dict_items([('Fast', 'In a Quick Manner'), ('Avi', 'A coder'), ('Marks', [1, 2, 3, 4]), ('anotherdict', {'AVo': 'Player'}), (1, 2)])
{'Fast': 'In a Quick Manner', 'Avi': 'A coder', 'Marks': [1, 2, 3, 4], 'anotherdict': {'AVo': 'Player'}, 1: 2}
{'Fast': 'In a Quick Manner', 'Avi': 'A coder', 'Marks': [1, 2, 3, 4], 'anotherdict': {'AVo': 'Player'}, 1: 2, 'lovish': 'friend', 'divya': 'pooja'}
26. Set
code:
O/P:
<class 'set'>
{1, 3, 5, 6}
27. Empty Set
code:
O/P:
<class 'dict'>
<class 'set'>
28. Set method
code:
O/P:
<class 'set'>
{4, 5, 7}
{(9, 8, 3, 1), 4, 5, 7}
4
{(9, 8, 3, 1), 4, 7}
29. finding value of key in Dict
code:
30. empty dict and empty set
code:
O/P:
<class 'dict'>
<class 'set'>
{4, 5}
31. fav lang Dict
code:
O/P:
Enter your favorite language Shubham English
Enter your favorite language Ankit Marathi
Enter your favorite language Sonali Hindi
Enter your favorite language Harshita German
{'shubham': 'English', 'ankit': 'Marathi', 'sonali': 'Hindi', 'harshita': 'German'}
32.
code:O/P:
1.
code:
O/P:
1.
O/P:
1.
O/P:
1.
O/P:
1.
O/P:
1.
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code:
O/P:
1.
code: