-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice22.py
More file actions
108 lines (86 loc) · 1.95 KB
/
practice22.py
File metadata and controls
108 lines (86 loc) · 1.95 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# to extract to words defined in the string using string slicing concepts
# to count the n of times the char i appeared in the string
str = 'hi this python class'
str.encode()
print(str[3:7])
print(str[8:15])
count = 0
for i in str:
if(i == 'i'):
count = count +1
print('''the "count" of i's in the given string is''', count )
print("hello",end="\n")
print("pyhton")
str = "hel"
str1= "lo"
print(str+str1)
list = [0,1,2]
liu = [3,4,5]
print(list+liu)
l=[]
num= int(input("enter the number"))
for i in range(0, num):
l[i][0] = str(input("name:"))
l[i][1] = float(input("score:"))
l= [1,2,3,4,5]
l.insert(2,33)
print(l)
l.remove(3)
print(l)
l.append(44)
print(l)
l.sort()
print(l)
l.pop()
print(l)
l.reverse()
print(l)
def print_full_name(a, b):
print("Hello ",a+" "+b,'! You just delved into python.',sep='')
if __name__ == '__main__':
first_name = input()
last_name = input()
print_full_name(first_name, last_name)
# code for disabling the softspace feature
print('G', 'F', 'G', sep='')
# for formatting a date
print('09', '12', '2016', sep='-')
# another example
print('pratik', 'geeksforgeeks', sep='@')
print('G', 'F', sep='', end='')
print('G')
# n provides new line after printing the year
print('09', '12', sep='-', end='-2016n')
print('prtk', 'agarwal', sep='', end='@')
print('geeksforgeeks')
a = "hello my name is tharun"
a = a.split(" ")
print(a)
a = "-".join(a)
print(a)
string = input().strip()
sub_string = input().strip()
print(string, sub_string)
print(string.find(sub_string))
string.lower()
s = str(input())
if (s.isalpha()):
print("True")
else:
print("False")
if (s.isalnum()):
print("True")
else:
print("False")
if (s.isdigit()):
print("True")
else:
print("False")
if (s.islower()):
print("True")
else:
print("False")
if (s.isupper()):
print("True")
else:
print("False")