correct_choice = Truewhile correct_choice: choice = raw_input("введите пожалуйса 1 или 2:") if choice == "1" or choice == "2": correct_choice = False else: print "неправилно,попробуйте есчо раз"print "спасибо"
while True: choice = input("введите пожалуйса 1 или 2:") if choice == "1" or choice == "2": break else: print ("неправилно,попробуйте есчо раз")print ("спасибо")
while True: choice = int(input("введите пожалуйса 1 или 2:")) if choice in [1, 2]: break else: print ("неправилно,попробуйте есчо раз")print ("спасибо")
while not int(input("введите пожалуйса 1 или 2:")) in [1, 2]: print ("неправилно,попробуйте есчо раз")print ("спасибо")
# -*- coding: utf-8 -*-
2.1.3. Comments¶A comment starts with a hash character (#) that is not part of a string literal, and ends at the end of the physical line. A comment signifies the end of the logical line unless the implicit line joining rules are invoked. Comments are ignored by the syntax; they are not tokens.2.1.4. Encoding declarations¶If a comment in the first or second line of the Python script matches the regular expression coding[=:]\s*([-\w.]+), this comment is processed as an encoding declaration; the first group of this expression names the encoding of the source code file. The recommended forms of this expression are# -*- coding: <encoding-name> -*-which is recognized also by GNU Emacs, and# vim:fileencoding=<encoding-name>which is recognized by Bram Moolenaar’s VIM.If no encoding declaration is found, the default encoding is UTF-8. In addition, if the first bytes of the file are the UTF-8 byte-order mark (b'\xef\xbb\xbf'), the declared file encoding is UTF-8 (this is supported, among others, by Microsoft’s notepad).If an encoding is declared, the encoding name must be recognized by Python. The encoding is used for all lexical analysis, including string literals, comments and identifiers. The encoding declaration must appear on a line of its own.
from Blender import Drawb= Draw.Create(0.0) # Data for floating point buttondef bevent(evt): print 'My Button event:', evtdef gui(): global b b= Draw.Number('value: ', 1000, 0,0, 200, 20, b.val, 0,10, 'some text tip')Draw.Register(gui, None, bevent) # we are not going to worry about keyboard and mouse events
rtn, Запусти в 2.4 и узнаешь =)