- What gets printed?
x = 1
y = 2
x = y
y = 3
print(x)
print(y)
- What gets printed?
x = 1
x = x + x
x = x * x
print(x)
- What gets printed?
name = 3
name = "foo" * name
print(name)
- Python allows names to contain letters, numbers, and underscore. Some examples of valid names are
pi
,area51
, andarea_of_circle
. The underscore is usually used to separate different words in a name. Why doesn't python allow hyphens in names? For example,area-of-circle
is an invalid name in python. What could be the reason for this?