8000 first commit · chandantech56/python-class@6c54eb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c54eb9

Browse files
committed
first commit
0 parents  commit 6c54eb9

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed

python_class1/class1.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
a = 10 #integer value: number
2+
print(a)
3+
b = 22.22 #float value: decimal
4+
print(type(a))
5+
6+
print("float values is: ", b)
7+
8+
print(type(b))
9+
10+
boo1 = True # boolien value: True and false
11+
print("boolien values is:" , boo1)
12+
print(type(boo1))
13+
14+
15+
text= "hello"
16+
print("the string values is: " , text)
17+
print(type(text))
18+
# print(`the string values ${text}`)
19+
20+
txt = "class start at 8 am \n end at 9 am" # \n or """ """ is a divided line(new line)
21+
print(txt)
22+
print(type(txt))

python_class2/class2.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
str = "programiz"
2+
print("string is :", str)
3+
print("print :", str[3])
4+
print(str[1:5]) #slicing: slicing is a technique that allows you to retrieve specific parts, or "slices," of sequences such as strings, lists, tuples, or other iterable objects.
5+
print(str[5:-2])
6+
# print(str[10]) # error: out of charactor
7+
print(str)
8+
str = "python" # replace all values but not replace one character in string. bcz string is a immutable.
9+
print(str)
10+
# length methods
11+
txt1 = "python class starts at 7am"
12+
print(txt1)
13+
print(len(txt1))
14+
# enumerate() function : print data index number with string charactor on by one.
15+
txt2 = "python"
16+
txt3 = list(enumerate(txt2)) #print index number with character name.
17+
print("txt3:", txt3) # out put: txt3: [(0, 'p'), (1, 'y'), (2, 't'), (3, 'h'), (4, 'o'), (5, 'n')]
18+
19+
#mutable: number, integer,float,
20+
#immutable: string,

python_class3/class3.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
a= "python "
2+
b= "programiz"
3+
print(a+ b) #cancatination(+)
4+
#
5+
str1= "hello "
6+
str2 = "world!"
7+
print("str1 + str2= ", str1 + str2)
8+
9+
str1 = "python is " #for spacing given one spaces {"values____(space) "}
10+
str2 = "programing language"
11+
print("str1 + str2=", str1 + str2)
12+
13+
str1= "hello"
14+
str2 = "world!"
15+
print("str1 * 3 = " , str1 * 3) # (*asetric operator)
16+
17+
text = "python" #for loops
18+
for char in text: #for and in is a reserved keyword(for loops), text is a variable and char is a data types.
19+
print(char),
20+
21+
count=0
22+
for letter in "hello world":
23+
print(letter)
24+
if(letter=="l"):
25+
count+=1
26+
print("number of letter l is:", count)
27+
28+
count=0
29+
for char in "chandan":
30+
if(char=="n"):
31+
count+=1
32+
print("n" ,count)
33+
34+
num = [1,4,9,16,25,36,49,]
35+
for list in num:
36+
print(list)
37+
38+
# for i in range(1, 100): # Range function (start, stop, step)
39+
# print(i)
40+
41+
n= 5
42+
for i in range(n+1):
43+
print(i)

python_class4/class4.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
institute="besent technology"
2+
for char in institute:
3+
print("institute name character wise: ", char)
4+
# if(char =="S"):
5+
# count+=1
6+
# print("number of letter t is:", count)
7+
8+
text= "python"
9+
print("p" in text)
10+
print("law" in text)
11+
print("hon" in text)
12+
13+
text = "HELLO,WORLD" # for method lower case (text.lower())
14+
result= text.lower()
15+
print("ther result is:" , result)
16+
17+
text = "hello world" #for upper case (.upper)
18+
result= text.upper()
19+
print("the result is:" , result)
20+
21+
text = "hello world"
22+
result= text.replace("hello", "hi") #replace methods(.replace)
23+
print("change letter hello:", result)
24+
result= text.replace("o", "m")
25+
print("change letter o:", result)
26+
27+
text= "hello world" # find methods(.find())
28+
result= text.find("w")
29+
print("find char w is:", result)
30+
31+
text= "this is a python class" #split methods (.splite())
32+
result= text.split()
33+
print(result)

python_class5/class5.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kala=[1,2,3,4,6,5,7,8,4]
2+
print(kala)
3+
print(2 in kala)

0 commit comments

Comments
 (0)
0