pythonapd 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythonapd-0.0.2 → pythonapd-0.0.3}/PKG-INFO +1 -1
- {pythonapd-0.0.2 → pythonapd-0.0.3}/pyproject.toml +1 -1
- pythonapd-0.0.3/src/pythonapd/error_handling.py +1 -0
- pythonapd-0.0.3/src/pythonapd/lambda.py +42 -0
- pythonapd-0.0.3/src/pythonapd/loops.py +37 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/src/pythonapd.egg-info/PKG-INFO +1 -1
- {pythonapd-0.0.2 → pythonapd-0.0.3}/src/pythonapd.egg-info/SOURCES.txt +3 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/LICENSE +0 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/README.md +0 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/setup.cfg +0 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/src/pythonapd/__init__.py +0 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/src/pythonapd/aitesting.py +0 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/src/pythonapd.egg-info/dependency_links.txt +0 -0
- {pythonapd-0.0.2 → pythonapd-0.0.3}/src/pythonapd.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## pending
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# lambda function
|
|
2
|
+
# Anonymous → Means a nameless function
|
|
3
|
+
#Inline → Written directly where it is needed
|
|
4
|
+
#Single-use function → Usually used for a small, simple operation
|
|
5
|
+
#Returns one value → No return keyword is required
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
#lamda no arguments syntax
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
r= lambda: "This is lambda function"
|
|
12
|
+
print(r())
|
|
13
|
+
|
|
14
|
+
#syntax of lambda function
|
|
15
|
+
# lambda arguments: expression
|
|
16
|
+
add = lambda x , y: x + y
|
|
17
|
+
print(add(5,6))
|
|
18
|
+
|
|
19
|
+
square= lambda x: x*x
|
|
20
|
+
print(square(5))
|
|
21
|
+
|
|
22
|
+
bigger= lambda a,b: f"{a} is the bigger" if a > b else f"{b} is the bigger"
|
|
23
|
+
print(bigger(5,6))
|
|
24
|
+
|
|
25
|
+
emp_salary=[50000, 60000, 70000, 80000, 90000]
|
|
26
|
+
|
|
27
|
+
highest_salary= lambda salary: max(salary)
|
|
28
|
+
print(highest_salary(emp_salary))
|
|
29
|
+
|
|
30
|
+
#filter salary greater than 70000
|
|
31
|
+
filtered_salary=list(filter(lambda salary: salary>70000,emp_salary))
|
|
32
|
+
print(filtered_salary)
|
|
33
|
+
|
|
34
|
+
#bonus salary with 10% increment
|
|
35
|
+
bonus= list(map(lambda salary: int(salary+salary*0.10),emp_salary))
|
|
36
|
+
print(bonus)
|
|
37
|
+
|
|
38
|
+
#find the lowest salary
|
|
39
|
+
from functools import reduce
|
|
40
|
+
|
|
41
|
+
lowest_salary= reduce(lambda a,b: a if a<b else b, emp_salary)
|
|
42
|
+
print(lowest_salary)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#while loop example
|
|
2
|
+
|
|
3
|
+
#exit loop when x is less than 20
|
|
4
|
+
x=[5, 15, 19,25,10, 35]
|
|
5
|
+
i=0;
|
|
6
|
+
while x[i]<20:
|
|
7
|
+
print(x[i])
|
|
8
|
+
if x[i]==10:
|
|
9
|
+
print("10 is found")
|
|
10
|
+
break # break the loop if x[i] is equal to 10
|
|
11
|
+
i+=1
|
|
12
|
+
|
|
13
|
+
#for loop example with continue statement
|
|
14
|
+
y=[20,30,50, 60, 65,70,75, 80,85,90,91,99,100]
|
|
15
|
+
for i in y:
|
|
16
|
+
if i>90:
|
|
17
|
+
continue # skip the iteration if i is greater than 90
|
|
18
|
+
elif i>=60:
|
|
19
|
+
print("First class student with marks:",i)
|
|
20
|
+
elif i>=50:
|
|
21
|
+
print("Second class student with marks:",i)
|
|
22
|
+
elif i>=75:
|
|
23
|
+
print("Distinction student with marks:",i)
|
|
24
|
+
else:
|
|
25
|
+
print("Fail student with marks:",i)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#for loop with pass statement
|
|
29
|
+
a=[1,2,3,4,5,6,7,8,9]
|
|
30
|
+
for i in a:
|
|
31
|
+
if i%2==0:
|
|
32
|
+
pass # do nothing for even numbers
|
|
33
|
+
else:
|
|
34
|
+
print(i) # print odd numbers
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
@@ -3,6 +3,9 @@ README.md
|
|
|
3
3
|
pyproject.toml
|
|
4
4
|
src/pythonapd/__init__.py
|
|
5
5
|
src/pythonapd/aitesting.py
|
|
6
|
+
src/pythonapd/error_handling.py
|
|
7
|
+
src/pythonapd/lambda.py
|
|
8
|
+
src/pythonapd/loops.py
|
|
6
9
|
src/pythonapd.egg-info/PKG-INFO
|
|
7
10
|
src/pythonapd.egg-info/SOURCES.txt
|
|
8
11
|
src/pythonapd.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|