begin process at 2010 09 04 18:04:58
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Chaîne de caratère

 > TRADUCTEUR LEET SPEAK

TRADUCTEUR LEET SPEAK


 Information sur la source

Note :
5 / 10 - par 1 personne
5,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Chaîne de caratère Classé sous :leet speak, condition, boucle, aléatoire, caractères Niveau :Débutant Date de création :03/11/2008 Date de mise à jour :03/11/2008 14:11:51 Vu :3 866

Auteur : hazkaal

Ecrire un message privé
Site perso
Commentaire sur cette source (6)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
Bonjour !

Voici ma première source en Python. Je le bosse depuis seulement quelques jours.
Ce code rassemble :
  -récupérer une chaîne de caractère
  -traiter une chaîne de caractère
  -utiliser les boucles While
  -utiliser le traitement par condition : if - elif - else
  -utiliser les nombres aléatoires
  -afficher des caractères

Ce code permet, de récupérer une chaîne de caractère et de la tranformer en language leetspeak (leet speak --> elite speak --> wikipedia ^.^ ). En leet speak, chaque caractère peut correspondre à plusieurs caractères, pour cela, j'utilises les nobres aléatoires pour les définir.


Visionnez le code maintenant ;)
Vous pouvez aussi regarder la capture d'écran !

Bonne lecture, ou devrais-je dire : 80^//\/[- |3(7(_)|^&

Source

  • #!/usr/bin/python
  • phrase = raw_input()
  • from random import randrange
  • x = ''
  • i = 0
  • while i < len(phrase):
  • if (phrase[i] == 'A') or (phrase[i] == 'a'):
  • r = randrange(1,7)
  • if r == 1:
  • x = x + '4'
  • if r == 2:
  • x = x + '/\\'
  • if r == 3:
  • x = x + '@'
  • if r == 4:
  • x = x + '^'
  • if r == 5:
  • x = x + 'aye'
  • if r == 6:
  • x = x + '/-\\'
  • if r == 7:
  • x = x + '|-\\'
  • elif (phrase[i] == 'B') or (phrase[i] == 'b'):
  • r = randrange(1,10)
  • if r == 1:
  • x = x + '8'
  • if r == 2:
  • x = x + '6'
  • if r == 3:
  • x = x + '13'
  • if r == 4:
  • x = x + 'P>'
  • if r == 5:
  • x = x + '|:'
  • if r == 6:
  • x = x + '!3'
  • if r == 7:
  • x = x + '(3'
  • if r == 8:
  • x = x + '/3'
  • if r == 9:
  • x = x + ')3'
  • if r == 10:
  • x = x + '|3'
  • elif (phrase[i] == 'C') or (phrase[i] == 'c'):
  • r = randrange(1,3)
  • if r == 1:
  • x = x + '['
  • if r == 2:
  • x = x + '('
  • if r == 3:
  • x = x + '<'
  • elif (phrase[i] == 'D') or (phrase[i] == 'd'):
  • r = randrange(1,8)
  • if r == 1:
  • x = x + ')'
  • if r == 2:
  • x = x + '[)'
  • if r == 3:
  • x = x + 'I>'
  • if r == 4:
  • x = x + '|>'
  • if r == 5:
  • x = x + '?'
  • if r == 6:
  • x = x + 'T)'
  • if r == 7:
  • x = x + '|)'
  • if r == 8:
  • x = x + '0'
  • elif (phrase[i] == 'E') or (phrase[i] == 'e'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '3'
  • if r == 2:
  • x = x + '&'
  • if r == 3:
  • x = x + '[-'
  • if r == 4:
  • x = x + '|=-'
  • elif (phrase[i] == 'F') or (phrase[i] == 'f'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '|='
  • if r == 2:
  • x = x + '|#'
  • if r == 3:
  • x = x + 'ph'
  • if r == 4:
  • x = x + '/='
  • elif (phrase[i] == 'G') or (phrase[i] == 'g'):
  • r = randrange(1,7)
  • if r == 1:
  • x = x + '6'
  • if r == 2:
  • x = x + '&'
  • if r == 3:
  • x = x + '(_+'
  • if r == 4:
  • x = x + '9'
  • if r == 5:
  • x = x + 'C-'
  • if r == 6:
  • x = x + 'gee'
  • if r == 7:
  • x = x + '(y,'
  • elif (phrase[i] == 'H') or (phrase[i] == 'h'):
  • r = randrange(1,12)
  • if r == 1:
  • x = x + '#'
  • if r == 2:
  • x = x + '/-/'
  • if r == 3:
  • x = x + '[-]'
  • if r == 4:
  • x = x + ']-['
  • if r == 5:
  • x = x + ')-('
  • if r == 6:
  • x = x + '(-)'
  • if r == 7:
  • x = x + ':-:'
  • if r == 8:
  • x = x + '|~|'
  • if r == 9:
  • x = x + '|-|'
  • if r == 10:
  • x = x + ']~['
  • if r == 11:
  • x = x + '}{'
  • if r == 12:
  • x = x + '}-{'
  • elif (phrase[i] == 'I') or (phrase[i] == 'i'):
  • r = randrange(1,6)
  • if r == 1:
  • x = x + '1'
  • if r == 2:
  • x = x + '!'
  • if r == 3:
  • x = x + '|'
  • if r == 4:
  • x = x + 'eye'
  • if r == 5:
  • x = x + '3y3'
  • if r == 6:
  • x = x + ']'
  • elif (phrase[i] == 'J') or (phrase[i] == 'j'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '_|'
  • if r == 2:
  • x = x + '_/'
  • if r == 3:
  • x = x + '</'
  • if r == 4:
  • x = x + '(/'
  • elif (phrase[i] == 'K') or (phrase[i] == 'k'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '|{'
  • if r == 2:
  • x = x + '|<'
  • elif (phrase[i] == 'L') or (phrase[i] == 'l'):
  • r = randrange(1,5)
  • if r == 1:
  • x = x + '1'
  • if r == 2:
  • x = x + '7'
  • if r == 3:
  • x = x + '1_'
  • if r == 4:
  • x = x + '|'
  • if r == 5:
  • x = x + '|_'
  • elif (phrase[i] == 'M') or (phrase[i] == 'm'):
  • r = randrange(1,14)
  • if r == 1:
  • x = x + '|v|'
  • if r == 2:
  • x = x + '[V]'
  • if r == 3:
  • x = x + '{V}'
  • if r == 4:
  • x = x + '|\\/]'
  • if r == 5:
  • x = x + '/\\/\\'
  • if r == 6:
  • x = x + '(u)'
  • if r == 7:
  • x = x + '(v)'
  • if r == 8:
  • x = x + '(\\/)'
  • if r == 9:
  • x = x + '/|\\'
  • if r == 10:
  • x = x + '^^'
  • if r == 11:
  • x = x + '/|/|'
  • if r == 12:
  • x = x + '//.'
  • if r == 13:
  • x = x + '.\\\\'
  • if r == 14:
  • x = x + '/^^\\'
  • elif (phrase[i] == 'N') or (phrase[i] == 'n'):
  • r = randrange(1,10)
  • if r == 1:
  • x = x + '^/'
  • if r == 2:
  • x = x + '|v'
  • if r == 3:
  • x = x + '|\\|'
  • if r == 4:
  • x = x + '/\\/'
  • if r == 5:
  • x = x + '[\\]'
  • if r == 6:
  • x = x + '<\\>'
  • if r == 7:
  • x = x + '{\\}'
  • if r == 8:
  • x = x + '[]\\'
  • if r == 9:
  • x = x + '// []'
  • if r == 10:
  • x = x + '/V'
  • elif (phrase[i] == 'O') or (phrase[i] == 'o'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '0'
  • if r == 2:
  • x = x + '()'
  • if r == 3:
  • x = x + 'oh'
  • if r == 4:
  • x = x + '[]'
  • elif (phrase[i] == 'P') or (phrase[i] == 'p'):
  • r = randrange(1,8)
  • if r == 1:
  • x = x + '|*'
  • if r == 2:
  • x = x + '|o'
  • if r == 3:
  • x = x + '|^(o)'
  • if r == 4:
  • x = x + '|>'
  • if r == 5:
  • x = x + '|"'
  • if r == 6:
  • x = x + '9'
  • if r == 7:
  • x = x + '[]D'
  • if r == 8:
  • x = x + '|7'
  • elif (phrase[i] == 'Q') or (phrase[i] == 'q'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '(_,)'
  • if r == 2:
  • x = x + '()_'
  • if r == 3:
  • x = x + '0_'
  • if r == 4:
  • x = x + '<|'
  • elif (phrase[i] == 'R') or (phrase[i] == 'r'):
  • r = randrange(1,8)
  • if r == 1:
  • x = x + '2'
  • if r == 2:
  • x = x + '|?'
  • if r == 3:
  • x = x + '/2'
  • if r == 4:
  • x = x + '|^'
  • if r == 5:
  • x = x + 'lz'
  • if r == 6:
  • x = x + '[z'
  • if r == 7:
  • x = x + '12'
  • if r == 8:
  • x = x + '|2'
  • elif (phrase[i] == 'S') or (phrase[i] == 's'):
  • r = randrange(1,5)
  • if r == 1:
  • x = x + '5'
  • if r == 2:
  • x = x + '$'
  • if r == 3:
  • x = x + 'z'
  • if r == 4:
  • x = x + 'ehs'
  • if r == 5:
  • x = x + 'es'
  • elif (phrase[i] == 'T') or (phrase[i] == 't'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '7'
  • if r == 2:
  • x = x + '+'
  • if r == 3:
  • x = x + '-|-'
  • if r == 4:
  • x = x + '1'
  • elif (phrase[i] == 'U') or (phrase[i] == 'u'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '(_)'
  • if r == 1:
  • x = x + '|_|'
  • if r == 3:
  • x = x + 'v'
  • if r == 4:
  • x = x + ']_|'
  • elif (phrase[i] == 'V') or (phrase[i] == 'v'):
  • r = randrange(1,3)
  • if r == 1:
  • x = x + '\\/'
  • if r == 1:
  • x = x + '1/'
  • if r == 1:
  • x = x + '|/'
  • elif (phrase[i] == 'W') or (phrase[i] == 'w'):
  • r = randrange(1,9)
  • if r == 1:
  • x = x + '\\/\\/'
  • if r == 2:
  • x = x + 'vv'
  • if r == 3:
  • x = x + '\\^/'
  • if r == 4:
  • x = x + '(n)'
  • if r == 5:
  • x = x + '\\V/'
  • if r == 6:
  • x = x + '\\X/'
  • if r == 7:
  • x = x + '\\|/'
  • if r == 8:
  • x = x + '\\_|_/'
  • if r == 9:
  • x = x + '\\_:_/'
  • elif (phrase[i] == 'X') or (phrase[i] == 'x'):
  • r = randrange(1,4)
  • if r == 1:
  • x = x + '><'
  • if r == 2:
  • x = x + '}{'
  • if r == 3:
  • x = x + 'ecks'
  • if r == 4:
  • x = x + ')('
  • elif (phrase[i] == 'Y') or (phrase[i] == 'y'):
  • r = randrange(1,2)
  • if r == 1:
  • x = x + '\'/'
  • if r == 2:
  • x = x + ''
  • elif (phrase[i] == 'Z') or (phrase[i] == 'z'):
  • r = randrange(1,7)
  • if r == 1:
  • x = x + '2'
  • if r == 2:
  • x = x + '7_'
  • if r == 3:
  • x = x + '~/_'
  • if r == 4:
  • x = x + '%'
  • if r == 5:
  • x = x + '>_'
  • if r == 6:
  • x = x + '-\\_'
  • if r == 7:
  • x = x + '\'/_'
  • elif (phrase[i] == ' '):
  • x = x + ' '
  • else:
  • x = x + phrase[i]
  • i = i + 1
  • print x
#!/usr/bin/python 

phrase = raw_input()
from random import randrange

x = ''
i = 0

while i < len(phrase):
	if (phrase[i] == 'A') or (phrase[i] == 'a'):
		r = randrange(1,7)
		if r == 1:
			x = x + '4'
		if r == 2:
			x = x + '/\\'
		if r == 3:
			x = x + '@'
		if r == 4:
			x = x + '^'
		if r == 5:
			x = x + 'aye'
		if r == 6:
			x = x + '/-\\'
		if r == 7:
			x = x + '|-\\'
	elif (phrase[i] == 'B') or (phrase[i] == 'b'):
		r = randrange(1,10)
		if r == 1:
			x = x + '8'
		if r == 2:
			x = x + '6'
		if r == 3:
			x = x + '13'
		if r == 4:
			x = x + 'P>'
		if r == 5:
			x = x + '|:'
		if r == 6:
			x = x + '!3'
		if r == 7:
			x = x + '(3'
		if r == 8:
			x = x + '/3'
		if r == 9:
			x = x + ')3'
		if r == 10:
			x = x + '|3'
	elif (phrase[i] == 'C') or (phrase[i] == 'c'):
		r = randrange(1,3)
		if r == 1:
			x = x + '['
		if r == 2:
			x = x + '('
		if r == 3:
			x = x + '<'
	elif (phrase[i] == 'D') or (phrase[i] == 'd'):
		r = randrange(1,8)
		if r == 1:
			x = x + ')'
		if r == 2:
			x = x + '[)'
		if r == 3:
			x = x + 'I>'
		if r == 4:
			x = x + '|>'
		if r == 5:
			x = x + '?'
		if r == 6:
			x = x + 'T)'
		if r == 7:
			x = x + '|)'
		if r == 8:
			x = x + '0'
	elif (phrase[i] == 'E') or (phrase[i] == 'e'):
		r = randrange(1,4)
		if r == 1:
			x = x + '3'
		if r == 2:
			x = x + '&'
		if r == 3:
			x = x + '[-'
		if r == 4:
			x = x + '|=-'
	elif (phrase[i] == 'F') or (phrase[i] == 'f'):
		r = randrange(1,4)
		if r == 1:
			x = x + '|='
		if r == 2:
			x = x + '|#'
		if r == 3:
			x = x + 'ph'
		if r == 4:
			x = x + '/='
	elif (phrase[i] == 'G') or (phrase[i] == 'g'):
		r = randrange(1,7)
		if r == 1:
			x = x + '6'
		if r == 2:
			x = x + '&'
		if r == 3:
			x = x + '(_+'
		if r == 4:
			x = x + '9'
		if r == 5:
			x = x + 'C-'
		if r == 6:
			x = x + 'gee'
		if r == 7:
			x = x + '(y,'
	elif (phrase[i] == 'H') or (phrase[i] == 'h'):
		r = randrange(1,12)
		if r == 1:
			x = x + '#'
		if r == 2:
			x = x + '/-/'
		if r == 3:
			x = x + '[-]'
		if r == 4:
			x = x + ']-['
		if r == 5:
			x = x + ')-('
		if r == 6:
			x = x + '(-)'
		if r == 7:
			x = x + ':-:'
		if r == 8:
			x = x + '|~|'
		if r == 9:
			x = x + '|-|'
		if r == 10:
			x = x + ']~['
		if r == 11:
			x = x + '}{'
		if r == 12:
			x = x + '}-{'
	elif (phrase[i] == 'I') or (phrase[i] == 'i'):
		r = randrange(1,6)
		if r == 1:
			x = x + '1'
		if r == 2:
			x = x + '!'
		if r == 3:
			x = x + '|'
		if r == 4:
			x = x + 'eye'
		if r == 5:
			x = x + '3y3'
		if r == 6:
			x = x + ']'
	elif (phrase[i] == 'J') or (phrase[i] == 'j'):
		r = randrange(1,4)
		if r == 1:
			x = x + '_|'
		if r == 2:
			x = x + '_/'
		if r == 3:
			x = x + '</'
		if r == 4:
			x = x + '(/'
	elif (phrase[i] == 'K') or (phrase[i] == 'k'):
		r = randrange(1,4)
		if r == 1:
			x = x + '|{'
		if r == 2:
			x = x + '|<'
	elif (phrase[i] == 'L') or (phrase[i] == 'l'):
		r = randrange(1,5)
		if r == 1:
			x = x + '1'
		if r == 2:
			x = x + '7'
		if r == 3:
			x = x + '1_'
		if r == 4:
			x = x + '|'
		if r == 5:
			x = x + '|_'
	elif (phrase[i] == 'M') or (phrase[i] == 'm'):
		r = randrange(1,14)
		if r == 1:
			x = x + '|v|'
		if r == 2:
			x = x + '[V]'
		if r == 3:
			x = x + '{V}'
		if r == 4:
			x = x + '|\\/]'
		if r == 5:
			x = x + '/\\/\\'
		if r == 6:
			x = x + '(u)'
		if r == 7:
			x = x + '(v)'
		if r == 8:
			x = x + '(\\/)'
		if r == 9:
			x = x + '/|\\'
		if r == 10:
			x = x + '^^'
		if r == 11:
			x = x + '/|/|'
		if r == 12:
			x = x + '//.'
		if r == 13:
			x = x + '.\\\\'
		if r == 14:
			x = x + '/^^\\'
	elif (phrase[i] == 'N') or (phrase[i] == 'n'):
		r = randrange(1,10)
		if r == 1:
			x = x + '^/'
		if r == 2:
			x = x + '|v'
		if r == 3:
			x = x + '|\\|'
		if r == 4:
			x = x + '/\\/'
		if r == 5:
			x = x + '[\\]'
		if r == 6:
			x = x + '<\\>'
		if r == 7:
			x = x + '{\\}'
		if r == 8:
			x = x + '[]\\'
		if r == 9:
			x = x + '// []'
		if r == 10:
			x = x + '/V'
	elif (phrase[i] == 'O') or (phrase[i] == 'o'):
		r = randrange(1,4)
		if r == 1:
			x = x + '0'
		if r == 2:
			x = x + '()'
		if r == 3:
			x = x + 'oh'
		if r == 4:
			x = x + '[]'
	elif (phrase[i] == 'P') or (phrase[i] == 'p'):
		r = randrange(1,8)
		if r == 1:
			x = x + '|*'
		if r == 2:
			x = x + '|o'
		if r == 3:
			x = x + '|^(o)'
		if r == 4:
			x = x + '|>'
		if r == 5:
			x = x + '|"'
		if r == 6:
			x = x + '9'
		if r == 7:
			x = x + '[]D'
		if r == 8:
			x = x + '|7'
	elif (phrase[i] == 'Q') or (phrase[i] == 'q'):
		r = randrange(1,4)
		if r == 1:
			x = x + '(_,)'
		if r == 2:
			x = x + '()_'
		if r == 3:
			x = x + '0_'
		if r == 4:
			x = x + '<|'
	elif (phrase[i] == 'R') or (phrase[i] == 'r'):
		r = randrange(1,8)
		if r == 1:
			x = x + '2'
		if r == 2:
			x = x + '|?'
		if r == 3:
			x = x + '/2'
		if r == 4:
			x = x + '|^'
		if r == 5:
			x = x + 'lz'
		if r == 6:
			x = x + '[z'
		if r == 7:
			x = x + '12'
		if r == 8:
			x = x + '|2'
	elif (phrase[i] == 'S') or (phrase[i] == 's'):
		r = randrange(1,5)
		if r == 1:
			x = x + '5'
		if r == 2:
			x = x + '$'
		if r == 3:
			x = x + 'z'
		if r == 4:
			x = x + 'ehs'
		if r == 5:
			x = x + 'es'
	elif (phrase[i] == 'T') or (phrase[i] == 't'):
		r = randrange(1,4)
		if r == 1:
			x = x + '7'
		if r == 2:
			x = x + '+'
		if r == 3:
			x = x + '-|-'
		if r == 4:
			x = x + '1'
	elif (phrase[i] == 'U') or (phrase[i] == 'u'):
		r = randrange(1,4)
		if r == 1:
			x = x + '(_)'
		if r == 1:
			x = x + '|_|'
		if r == 3:
			x = x + 'v'
		if r == 4:
			x = x + ']_|'
	elif (phrase[i] == 'V') or (phrase[i] == 'v'):
		r = randrange(1,3)
		if r == 1:
			x = x + '\\/'
		if r == 1:
			x = x + '1/'
		if r == 1:
			x = x + '|/'
	elif (phrase[i] == 'W') or (phrase[i] == 'w'):
		r = randrange(1,9)
		if r == 1:
			x = x + '\\/\\/'
		if r == 2:
			x = x + 'vv'
		if r == 3:
			x = x + '\\^/'
		if r == 4:
			x = x + '(n)'
		if r == 5:
			x = x + '\\V/'
		if r == 6:
			x = x + '\\X/'
		if r == 7:
			x = x + '\\|/'
		if r == 8:
			x = x + '\\_|_/'
		if r == 9:
			x = x + '\\_:_/'
	elif (phrase[i] == 'X') or (phrase[i] == 'x'):
		r = randrange(1,4)
		if r == 1:
			x = x + '><'
		if r == 2:
			x = x + '}{'
		if r == 3:
			x = x + 'ecks'
		if r == 4:
			x = x + ')('
	elif (phrase[i] == 'Y') or (phrase[i] == 'y'):
		r = randrange(1,2)
		if r == 1:
			x = x + '\'/'
		if r == 2:
			x = x + ''
	elif (phrase[i] == 'Z') or (phrase[i] == 'z'):
		r = randrange(1,7)
		if r == 1:
			x = x + '2'
		if r == 2:
			x = x + '7_'
		if r == 3:
			x = x + '~/_'
		if r == 4:
			x = x + '%'
		if r == 5:
			x = x + '>_'
		if r == 6:
			x = x + '-\\_'
		if r == 7:
			x = x + '\'/_'
	elif (phrase[i] == ' '):
		x = x + ' '
	else:
		x = x + phrase[i]
	i = i + 1

print x

 Conclusion

Voilà !

N'hésitez pas à poster des commentaires pour m'aider à améliorer cette source !


 Historique

03 novembre 2008 14:10:16 :
Correction d'un elif
03 novembre 2008 14:11:51 :
Modif d'un elif

 Sources de la même categorie

Source avec Zip Source avec une capture GÉNÉRATEUR DE PASSWORD par PlugnPlay666
Source avec Zip Source avec une capture VOCABULARY, RÉVISER SON VOCABULAIRE PÉDAGOGIQUEMENT par Clempython
Source avec Zip Source avec une capture PROGRAMME POUR LES MOTS CROISÉS par Clempython
CHANGEMENT DE CASSE par linkid
Source avec Zip CONCATÉNER DES FICHIERS TEXTES par amaury74

 Sources en rapport avec celle ci

MA PREMIERE CALCULATRICE EN PYTHON!! par djisse95
Source avec une capture HISTOGRAMME ALÉATOIRE par bastelmann
Source avec une capture JEU DU CHIFFRE PYTHON par alexei12
Source avec Zip Source avec une capture GÉNÉRATEUR DE MOTS ALÉATOIRES par lomar et lomar
Source avec Zip Source avec une capture DÉTERMINATION APPROXIMATIVE DE PI À L'AIDE DE LA MÉTHODE DE ... par Shakan972

Commentaires et avis

Commentaire de aera group le 04/11/2008 17:17:17

Bonjour,

Bien, ta source ne contient pas d'erreur ni de bug apparat. Ton programme réalise en effet l'objectif que tu t'es fixé, à savoir : "récupérer une chaîne de caractère et de la tranformer en language leetspeak". Sur un plan purement algorithmique, ça vaux un 10/10.

Mais, malheureusement, nous ne faisons pas de l'algorithmie (oui, je suis un peu fâcher avec les algorithme, j'ai des cour "d'informatique" qui sont en faite des cour d'algorithmie ridicule où j'ai un prof qui se crois très malin avec ces arbres et qui ne sais même pas ce qu'est un langage orienté objet, mais passons sur ma vie personnel ...) et regardons un peu l'utilisation de ta source :

Pas de phrase pour guider l'utilisateur et pas de fonctions pour traduire dans l'autre sens dommage...
Il y a pourtant des chose à faire, comme par exemple utiliser des listes et des tuples pour la correspondance entre les lettres et les symboles. De plus après une traduction, le programme s'arrête là encore c'est dommage, une boucle "infini" (oui, je met "infini" entre guillemets car d'après mon prof sa n'existe pas ou alors sinon c'est une erreur de syntaxe, même si je fais remarquer que votre microprocesseur à un programme qui tourne en boucle :p) suffirait à résoudre se problème avec à la fin une question pour quitter le programme

Mon conseil : Pense à l'utilisateur, dis toi que tes programmes ne sont pas là juste pour montrer à tous le monde ce que tu sais faire, mais pour être utiliser. Même si ton programme n'a d'utilité pour personne imagine qu'il en ait une et fait en sorte qu'un éventuel utilisateur puisse utiliser convenablement ton programme. Tes codes prendrons une autre dimension, on pourrait dire que ce sont des logiciels et plus de simples algorithmes bidons ...

Ta source vaut bien un 7/10, j'attends de voir si tu ne l'améliore pas, qui sais, elle peu devenir bien plus intéressante.

Bon courage et n'oublies pas de penser à l'utilisateur. Ciao ...

Commentaire de hazkaal le 04/11/2008 17:47:30

Salut !

Et merci pour ton commentaire !
Je vais essayer de faire dans le sens inverse alors :) traduction de leet à 'européen'.
Et aussi pourquoi pas relancer le programme une fois terminé (avec une question à l'utilisateur).

Je vais essayer de faire tout ceci !

Merci encore !

Commentaire de wkenw le 10/11/2008 13:41:35

salut

perso, je ne vois pas vraiment d'algorithmique ici... Mais comme aera group l'écrit, mieux faut créer des fonctions.

Ce que tu pourrais faire aussi, c'est utiliser des dictionnaires.
Par ex :
dico = {'X':( '><', '}{', 'ecks', ')('),
        'Z':( '2', '7_')}
Cette structure me parait très adaptée ici, puisque tout ton programme se résumerait alors à :

from random import randrange

def convert2leet(txt):
    dico = {} # je te laisse compléter...
    x=''
    for car in txt:
        r = randrange(1,dico[car.upper()])
        x += dico[car][r]
    return x

phrase = raw_input()
print conveert2leet(phrase)

A+

Commentaire de aera group le 10/11/2008 23:10:04

Il s'agit bien ici d'un algorithme : il y a un vrai travail de réflection et un certain nombre d'opérations logiques succécive en vu de résoudre un problème (définition certe basique mais correcte). L'utilisation de teste à la suite est la manière la plus rapide pour le micro d'exécuté ce programme en un minimum de variables (bien que je pense on peut faire mieu sur ce dernier point : à étudier ...) ; L'utilisation de Dictinaire et de boucle est plus long car plus complexe, mais beaucoup plus élangant et efficace.

Les régles obselettes d'algorithmie ne sont pas obligatoire, ns ne sommes pas en Pascal ! Tu fait de la programmation orienté objet, utilise tt sont potentiel et oublie l'algorithmie ...

Commentaire de xeolin le 20/11/2008 22:11:18 5/10

Hum Je suis capable d'écrire la mm chose en 5 minutes. Tu sais comment ? Avec un dictionnaire...

Mais bon, si tu veux un moyen d'apprendre tu as le fabuleux li vre de Gerard Swimen "apprendre a programmer avec python", et si simplement tu voulais un logiciel pour ecrire en l33t, tu as l33k3y qui est une extention de firefox...

Xeolin

1/10
+4 pts pour tencourager

Commentaire de xeolin le 17/07/2009 14:28:28

de plus ton script est buggé !!!!
#  elif (phrase[i] == 'U') or (phrase[i] == 'u'):
# r = randrange(1,4)
# if r == 1:
# x = x + '(_)'
# if r == 1:
# x = x + '|_|'
# if r == 3:
# x = x + 'v'
# if r == 4:
# x = x + ']_|'

#  elif (phrase[i] == 'V') or (phrase[i] == 'v'):
# r = randrange(1,3)
# if r == 1:
# x = x + '\\/'
# if r == 1:
# x = x + '1/'
# if r == 1:
# x = x + '|/'


Tu n'as même pas pris la peine de te relire !!!!!
Il y a plein de fautes de frappes !!!!!!

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

Changer le nom d'une variable ds une boucle [ par Bl0tCh ] Bonjour à tous,Mon probleme aujourd'hui est de changer le NOM d'une variabale :i=0while 1: i=i+1 exemple='test' print exempleEn fait je voudr Problème d'encodage [ par tomix81 ] Salut, J'ai un problème avec les caractères speciaux. Par exemple au lieu d'avoir un caractère comme "é", j'ai le caractère ù en majuscule. J'ai incl Transformer une liste en chaine de caractères [ par fredouzzz ] Bonjour,        j'ai une liste stockée dans une variable (result_set)        j'aimerais convertir cette liste en une chaîne de caractère.  Par exemp Condition ne fonctionne pas [ par Fabrizio001 ] Bonjour,Je débute (1 semaine )en python et je sollicite votre aide. Voici ce que j'essaye de faire:Je veux contrôler le contenu d'un fichier .txt qui voir si un caractère a déjà était écrit dans une boucle [ par Lutcho74 ] Bonjour,Ma question est un peu dans le titre du sujet...Je compte faire un programme qui donne un nombre aléatoire grâce au module random pour ensuite codage Windows jeu de caractères [ par creaduff ] Bonjour,Avant tout, précisons que je ne suis pas un aigle en Python ! Voici mon problème:J'ai écrit une petit programme permettant d'accéder à ma boit chaine de caractères [ par bossou ] Bonjour.j'ai un fichier texte où je récupère une ligne en faisant une recherche sur un mot.la ligne récupérée contient plusieurs points virgules exemp Tuto Swinnen : mouvement aléatoire ? [ par nemo43 ] Bonjour à tous,J'étudie le langage python - c'est un loisir - avec le livre de Gérard Swinnen (comme beaucoup de francophones je pense ). Je bloque su transfomer une liste en chaine de caractères [ par bossou ] Bonjour à tous. J'ai la liste suivante: ['USLUC1', '30422423', '05/11/2009', '24.20', 'USD', 'CHASUS33XXX','', '', '', '', '', '', '3630900'] et j écrire équation contenant des caractères grec sur le pannel wx [ par zannguyen ] Bonjour, Je voudrais écrire une équation mathématique contenant des caractères grecs dans un panel de wxPython. Il est très bien si on peut écrire av


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Septembre 2010
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
27282930   

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,967 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales