-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.py
More file actions
50 lines (45 loc) · 1002 Bytes
/
temp.py
File metadata and controls
50 lines (45 loc) · 1002 Bytes
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
# -*- coding: utf-8 -*-
# map/reduce pratice 1
def normalize(name):
n = 1
na = name[0].upper()
while n < len(name):
na = na + name[n].lower()
n = n + 1
return na
'''
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
'''
def is_palindrome(n):
s = str(n)
l = len(s)
l2 = int(l/2)
if l == 1:
return False
elif l % 2 == 0:
return False
else:
n = 0
while n < l/2:
if s[n] != s[l-n-1]:
return False
n = n + 1
return True
L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)]
L.keys()
@property
def width(self):
return self._width
@width.setter
def width(self,value):
self._width = value
def height(self):
return self._height
@width.setter
def width(self,value):
self._height = value
@property
def resolution(self):
return self._width*self._height