-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpro2.py
More file actions
68 lines (57 loc) · 1.22 KB
/
Copy pathpro2.py
File metadata and controls
68 lines (57 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# string concatination
str1 = "adan"
str2= "it"
str3 = "center"
print(str1 +" " + str2 + " " + str3)
print(len(str1))
print(len(str1+str2+str3))
#indexs
stri = "python is best"
print(stri[0])
print(stri[1])
print(stri[2])
print(stri[3])
print(stri[4])
print(stri[5])
# slicing
print(stri[0:4])
print(stri[7:9])
print(stri[:9])
print(stri[4:len(stri)])
# string functions
print(stri.upper())
print(stri.lower())
print(stri.title())
print(stri.count("t"))
print(stri.capitalize())
print(stri.find("best"))
print(stri.replace("best", "good"))
print(stri.endswith("best"))
# pracice
p= input("enter a string: ")
print(len(p))
print(p.upper())
print(p.lower())
print(p.count("a"))
#conditional or is statments
marks=int (input("enter your marks: "))
if(marks>=90):
print("grade A")
elif(marks>=80):
print("grade B")
elif(marks>=70):
print("grade C")
elif(marks>=60):
print("grade D")
else:
print("grade F")
#practice greatest number
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if(a>b and a>c):
print("the greatest number is: ", a)
elif(b>a and b>c):
print("the greatest number is: ", b)
else:
print("the greatest number is: ", c)