Skip to content

Instantly share code, notes, and snippets.

@dketov
Created December 12, 2011 12:35
Show Gist options
  • Save dketov/1466961 to your computer and use it in GitHub Desktop.
Save dketov/1466961 to your computer and use it in GitHub Desktop.
Переменные
# -*- encoding: utf-8 -*-
"""
Динамическая типизация
"""
x = 0 # x bound to an integer object
print x
x = "Hello" # now it's a string
print x
x = [1, 2, 3] # and now it's a list
print x
# -*- encoding: utf-8 -*-
"""
Цепочечное присваивание
"""
x = y = z = 0 # Zero x, y and z
print x
print y
print z
# -*- encoding: utf-8 -*-
"""
'Перечисление'
"""
print range(7)
(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY) = range(7)
print MONDAY
print TUESDAY
print SUNDAY
# -*- encoding: utf-8 -*-
"""
Групповое присваивание
"""
v = ('a', 'b', 'e')
(x, y, z) = v
print x
print y
print z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment