Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Solução do problema dos diamantes feita no primeiro encontro do Grupo de Usuários de Python do Piauí. http://dojopuzzles.com/problemas/exibe/diamantes/
#alfabeto = range(97,(97+26))
letra = raw_input("Insira o caractere: ")
i = ord(letra) - 65
aux = 0
for j in range(i, -1, -1):
if aux == 0:
print "%s%c"%(' '*j, chr(65))
else:
print "%s%c%s%c"%(' '*j, chr(65+aux),' '*((aux-1)*2+1),chr(65+aux))
aux += 1
aux -= 1
for j in range(1, i+1):
if chr(65+i-j) == 'A':
print "%s%c"%(' '*j, chr(65))
else:
print "%s%c%s%c"%(' '*j, chr(65+i-j),' '*((aux-1)*2-1),chr(65+i-j))
aux -= 1
#for i in range(65,(65+26)):
# alfabeto = alfabeto + chr(i)
#print alfabeto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment