Teaching Kids Programming: Videos on Data Structures and Algorithms
ASCII = American Standard Code for Information Interchange. Basically it is a charset that maps the keys to code (integers).
ASCII Print-able Characters
32 (Space) to 126
ASCII Non Printerable Characters
1 to 31, and 127 (DEL)
Print ASCII Code
1 2 | for i in range(1, 128): print(chr(i), ord(chr(i)) |
for i in range(1, 128): print(chr(i), ord(chr(i))
The chr() function returns ASCII character. And the ord() returns its ASCII for a given character
lower and upper conversion
1 2 | 'A'.lower() # 'a' 'a'.upper() # 'A' |
'A'.lower() # 'a' 'a'.upper() # 'A'
Re-invent the lower/upper function
1 2 3 4 5 6 7 8 9 | def lower(c): if c >= 'A' and c <= 'Z': return chr(ord(c) + 32) return c def upper(c): if c >= 'a' and c <= 'z': return chr(ord(c) - 32) return c |
def lower(c): if c >= 'A' and c <= 'Z': return chr(ord(c) + 32) return c def upper(c): if c >= 'a' and c <= 'z': return chr(ord(c) - 32) return c
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
264 wordsloading...
Last Post: Compute the Inorder Successor of a Binary Tree
Next Post: Recursive Algorithm to Cut a Binary Search Tree (Remove Nodes Not In Range)