Escolar Documentos
Profissional Documentos
Cultura Documentos
python3
# please print a keyword
# by Giorgi R.
import keyword
print ('There is ' + (str(len(keyword.kwlist))) + ' keywords in python')
print (keyword.kwlist)
#['False','None','True','and','as',
# 'assert','break','class','continue',
# 'def','del','elif','else','except',
# 'finally','for','from','global',
# 'if','import','in','is','lambda',
# 'nonlocal','not','or','pass',
# 'raise','return','try','while',
# 'with','yield']
print('please print a keyword:')
keyword = input()
if keyword.lower() == 'false':
print('True and False are truth values in Python. They are the results of com
parison operations or logical (Boolean) operations in Python.')
elif keyword.lower() == 'none':
print('None is a special constant in Python that represents the absence of a
value or a null value.')
elif keyword.lower() == 'true':
print('True and False are truth values in Python. They are the results of com
parison operations or logical (Boolean) operations in Python.')
elif keyword.lower() == 'and':
print('and, or, not are the logical operators in Python. and will result into
True only if both the operands are True.')
elif keyword.lower() == 'as':
print('as is used to create an alias while importing a module. It means givin
g a different name (user-defined) to a module while importing it.')
elif keyword.lower() == 'assert':
print('assert is used for debugging purposes.')
elif keyword.lower() == 'break':
print('break and continue are used inside for and while loops to alter their
normal behavior.')
elif keyword.lower() == 'class':
print('class is used to define a new user-defined class in Python.')
elif keyword.lower() == 'continue':
print('break and continue are used inside for and while loops to alter their
normal behavior.')