#! /usr/bin/env python3 def lexorder(a, b): i = 0 while i < len(a) and i < len(b): ai = ord(a[i]) bi = ord(b[i]) if ai < bi: return True if ai > bi: return False i += 1 return i == len(a) for a, b in [ ("titi", "toto"), ("tot", "toto"), ("pim", "poum"), ]: print(a, "<=", b, "=", lexorder(a, b)) def maj(x): return 'A' <= x and x <= 'Z' def VOY(x): return len(x) == 1 and x in 'AEIOUY' def is_maj(x, y): return 'a' <= x and x <= 'z' and ord(x) - ord('a') + ord('A') == ord(y) print(is_maj('c', 'C')) def pyramide(): k = ord('a') l = 1 while True: i = 0 while i < l: if k > ord('z'): c = '-' else: c = chr(k) k += 1 print(c, end=' ') i += 1 print() if k > ord('z'): break l += 1 pyramide()