Skip to content

Commit 0f0a656

Browse files
committed
commit feature3
1 parent 2916170 commit 0f0a656

File tree

11 files changed

+164
-2
lines changed

11 files changed

+164
-2
lines changed

Aexamples/datatype.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
str1 = " Hello"
2+
str2 = "World"
3+
arn_text = "arn:w:123:456::789"
4+
val = str1 + " " + str2
5+
print (val)
6+
print (len(val))
7+
print (val.lower())
8+
print (val.upper())
9+
print (val.replace("World", "New"))
10+
print(arn_text.split("::"))
11+
print(val.strip())
12+
print(val[1:-5])

Aexamples/regexpression.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import re
2+
3+
text = """The rain in Spain
4+
is the single line
5+
The tai"""
6+
web_server = "my_server"
7+
port = 8080
8+
9+
print(f"Web server : {web_server}")
10+
print(f"Port : {port}")
11+
print(f"Regular Expression: ,{web_server}")
12+
y= re.search("^The", text)
13+
print(y)
14+
15+
txt = "The rain in Spain"
16+
x = re.findall("aia", txt)
17+
print(len(x))
18+
19+
20+
print(re.search("tai$", text))
21+
print(re.split(" ", text))
22+
print(re.findall("he", text))
23+
24+
print(f"Output of Findall: {re.findall("he", text)}")

Day-02/examples/01-string-split.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
text = "Python is awesome"
2-
words = text.split()
1+
text = "Python, is:awesome"
2+
words = text.split(",")
33
print("Words:", words)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
3+
total = int(sys.argv[1])
4+
total += 5;
5+
6+
print(total)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
3+
# Input values from console
4+
val1 = str(sys.argv[1])
5+
val2 = int(sys.argv[2])
6+
val3 = str(sys.argv[3])
7+
8+
def comparisonOpr(val1, val2):
9+
# print("Greather than:", val1 > val2)
10+
# print("Less than:", val1 <= val3)
11+
print("Greather than or equal to:", val1 == val3)
12+
13+
comparisonOpr(val1, val2)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
3+
# Input values from console
4+
val1 = str(sys.argv[1])
5+
val2 = int(sys.argv[2])
6+
val3 = str(sys.argv[3])
7+
8+
def logicalOpr():
9+
# print("Greather than:", val1 > val2)
10+
# print("Less than:", val1 <= val3)
11+
print("logical opr:", (val1 == val3) or (val1 == val2))
12+
13+
logicalOpr()

Day-07/testcondition.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
x = 5;
2+
y = 10;
3+
z = 4 + 1;
4+
5+
if (x == z):
6+
print("success" )
7+
else:
8+
print("failure")

Day-08/01-Notes/testlisttuple.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import sys
2+
3+
listOfStudents = [ 1, 2, 33, "ragav", 5 ]
4+
listOfAdmin = ("admin1", "admin2")
5+
6+
print("admin3" in listOfAdmin)
7+
print(listOfAdmin[0:1])
8+
9+
#listOfStudents.append("karthi")
10+
11+
if "ragav" in listOfStudents:
12+
print('before remove success')
13+
14+
listOfStudents.remove(str("ragav"))
15+
16+
listOfStudents.sort()
17+
18+
listOfStudents.reverse()
19+
20+
print(listOfStudents[0:len(listOfStudents)])
21+
22+
if "ragav" in listOfStudents:
23+
print('after')
24+
else:
25+
print('else after remove')
26+
27+
28+
29+

Day-09/testloop.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
input = "Athiran"
3+
print(len(input))
4+
5+
listOfStudents = [ 1, 2, 33, "ragav", 5 ]
6+
listOfAdmin = ("admin1", "admin2")
7+
8+
for i in listOfStudents:
9+
if 33 in listOfStudents:
10+
print("Output success")
11+
continue;
12+
print("Inside loop")
13+
14+
15+
'''
16+
for i in range(len(input)):
17+
if "a" in i:
18+
print(input[(len(input) - 1) - i])
19+
'''
20+

Day-09/testloop2.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# test while loop
3+
a = 11111111111111111111111111
4+
b = 111111111111111110 + 1
5+
6+
#while a is b:
7+
if a is b:
8+
print("output")
9+
#done
10+
11+
log_file = [
12+
"INFO: Operation successful",
13+
"ERROR: File not found",
14+
"DEBUG: Connection established",
15+
"ERROR: Database connection failed",
16+
]
17+
18+
for line in log_file:
19+
if "ERROR" in line:
20+
print(line)

0 commit comments

Comments
 (0)