Partage
  • Partager sur Facebook
  • Partager sur Twitter

erreur synax

    12 mai 2011 à 0:06:55

    bonjour a tous j'ai résament voulu crée un quizz sur python mais il y a une erreur de synax et je vois pas le quelle
    voila le code
    Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license()" for more information.
    
        ****************************************************************
        Personal firewall software may warn about the connection IDLE
        makes to its subprocess using this computer's internal loopback
        interface.  This connection is not visible on any external
        interface and no data is sent to or received from the Internet.
        ****************************************************************
        
    IDLE 2.6      
    >>> # -*- coding: cp1252 -*-
    >>> from random import choice
    >>> from string import maketrans
    >>> accents="éèçëêàôüû"
    >>> ascii="eeceeaouu"
    >>> conversion=maketrans(accents, ascii)
    >>> question = [" j ai cree la relativite:inchtayne
    	    
    SyntaxError: EOL while scanning string literal
    >>> question = [ "je suis le fils de michele perez:mickael",
    	     "je suis fait en metale mais je te vois quand je suis brencher:webcam",
    	     "je rand aveugle:l amoure",
    	     "je rend la vue:le mariage",
    	     "je suis le plus gros muscle du corp: le cerveaux",
    	     "je suis un serpant qui tient le meme nom qu un language de programation: python",
    	     "on seurf sur moi quand on va sur un ordi: internet",
    	     "ma soeur anna a fete son annive je lui et acheter une boisson si ma famill en a bue un quart et que j ai bue le resste j en est bue combien: troi quarts",
    	     "je doit arivee a l ecole a neuf heur mais j arrive laba a quatorze heur j ai un retard de combien de pemps: cinq heur",
    	     " une expretion se cache dans cette phrase je fais frire du merlan: yeux de merlen fris",
    	     "vrai ou faux les carte bleu sont forcement bleu: faux"]
    >>> adieux = ["fin", "stop", "arret", "salut"]
    >>> reponce = "x"
    >>> print "donnez la reponce"
    donnez la reponce
    >>> print 'repondre" "fin", "stop", "arret", "salut" pour arreter'
    repondre" "fin", "stop", "arret", "salut" pour arreter
    >>> while reponce not in adieux:
    	quest= choice(qustion)
    	reponce= raw_input(quest.split(':')[0]
    			   +'? ').lower()if reponse not in adieux:
    		
    SyntaxError: invalid syntax
    >>> while reponse not in adieux
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest= choice (question)
    	reponce= raw_input(quest.split(',')[0]
    			   +'? ').lower()
    	if reponce not in adieux:
    		if reponce.tr
    		
    SyntaxError: invalid syntax
    >>> while reponce not in adieux;
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest= choice(question)
    	reponce = raw_input(quest.split(':')[0]
    			    +'?').lower()
    	if reponce not in adieux:
    		if reponce.translate(conversion)==
    		
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest= choice(question)
    	reponce= raw_input(quest.split(':')[0]
    			   +'?').lower():
    		
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest= choice(question)
    	reponce= raw_input (quest.split(':')[0]
    			    +'?').lower ()
    	if reponce.translate(conversion) ==:
    		
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest= choice(question)
    	reponce= raw_input(quest.split(':')[0]
    			   +'? ').lower()
    	if reponce not in adieux:
    		if reponce.translate(conversion) ==
    		
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest=choice(question)
    	reponce= raw_input(quest.split(':')[0]
    			   +'? ').lower()
    	if reponce not in adieux:
    		if reponce.translate(conversion) ==:
    			
    SyntaxError: invalid syntax
    >>> while reponce not in adieux:
    	quest=choice(question)
    	reponce=raw_input(quest.split(':')[0]
    			  +'? ').lower()
    	if reponce.translate(conversion) == :
    		
    SyntaxError: invalid syntax
    >>>
    
    • Partager sur Facebook
    • Partager sur Twitter
      12 mai 2011 à 8:48:11

      Bah ton == n'a pas de membre de droite.
      Si tu utilises l'opérateur == pour comparer reponce.translate(conversion) faut bien que tu le compares à quelque chose.
      • Partager sur Facebook
      • Partager sur Twitter

      erreur synax

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown