forked from TUTPy/TUTSLPtest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path219835825_Assi2.py
More file actions
78 lines (70 loc) · 1.3 KB
/
219835825_Assi2.py
File metadata and controls
78 lines (70 loc) · 1.3 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
#################
### Problem 1 ###
#################
def list_check(num):
s = ''.join(str(i) for i in num)
print('023' in s)
list_check([0,1,2,3,0,2,3,4,5])
#################
### Problem 2 ###
#################
def string_bit(str):
x=0
y=""
i = len(str)
while x <i:
y =y + str[x]
x = x+ 2
print(y)
string_bit("Hello")
#################
### Problem 3 ###
#################
def last_char(a,b):
a= a.lower()
b= b.lower()
cd = len(a)
de = len(b)
end=""
count = -1
if(cd>de):
e = de
e = e*-1
c = b
else:
e = cd
e = e*-1
c = a
while e<=count:
if(cd>de):
end = end + a[e]
else:
end = end + b[e]
e +=1
print(c==end)
last_char("Blue","Rediblue")
#################
### Problem 4 ###
#################
def double_value(str):
dup_char=""
n = len(str)
i=0
while i < n:
dup_char = dup_char + str[i] + str[i]
i +=1
print(dup_char)
double_value("Great stuff")
#################
### Problem 6 ###
#################
def count_even(even):
even_number =0
n = len(even)
i=0
while i < n:
if(even[i]%2==0):
even_number+=1
i+=1
print(even_number)
count_even([2,1,2,6,4])