Skip to content

Commit a311fbb

Browse files
committed
After Course section8
1 parent b824952 commit a311fbb

File tree

8 files changed

+15
-9
lines changed

8 files changed

+15
-9
lines changed

Section8/.idea/Section8.iml

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section8/.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section8/lecture81/Program2.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Program to show Arithmetic operations on Counter
1+
# Program to show operations on Counter
22

33
from collections import Counter
4+
45
c1 = Counter({"a": 2, "b": 3, "c": 5})
56
c2 = Counter({"a": 4, "b": 3, "c": 1})
67
print("c1 + c2 = ", (c1 + c2))
7-
print("c2 - c1 = ", (c2 and c1))
88
print("c2 - c1 = ", (c2 - c1))
99
print("c2 and c1 = ", c1 and c2)
1010
print("c2 or c1 = ", c1 or c2)

Section8/lecture82/Program1.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Program to show declaration and usage of Named tuple
22

33
from collections import namedtuple
4+
45
Employee = namedtuple("Employee", ["id", "name", "department"])
56
emp1 = Employee(12, "David", "Management")
67
print("Employee Details")

Section8/lecture82/Program2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Program to show indexing and getattr() method in Named tuple
22

33
from collections import namedtuple
4+
45
Customer = namedtuple("Customer", ["id", "name", "location"])
56
cust1 = Customer(21, "David", "India")
6-
print("cust1 name = ",cust1[1])
7+
print("cust1 name = ", cust1[1])
78
print("cust1 location = ", getattr(cust1, "location"))

Section8/lecture82/Program3.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Program to show conversion of list and dict to a named tuple
2-
list1 = [10, "David", 31]
32
from collections import namedtuple
3+
4+
list1 = [10, "David", 31]
45
Student = namedtuple("Student", ["id", "name", "age"])
56
stud1 = Student._make(list1)
67
print("stud1 : ", stud1)

Section8/lecture86/Program2.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
print("ciel() = ", math.ceil(3.92))
66
print("exp() = ", math.exp(10))
77
print("pow() = ", math.pow(10,2))
8-
98
print("degrees() = ",math.degrees(1))

Section8/lecture86/Program3.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Program to show trignometric methods
22

3-
var1 = 2
3+
44
import math
5+
6+
var1 = 2
57
print("sin(0) =", math.sin(0))
68
print("cos(0) =", math.cos(0))
79
print("tan(0) =", math.tan(0))

0 commit comments

Comments
 (0)