xuv's notebook

Side notes, howtos and random bits of information related to Julien Deswaef's projects

User Tools

Site Tools


workshops:blender:python_basics

This is an old revision of the document!


Python basics

Variables

Python variables are very easy to set up and very flexible.

a = 10
print(a)
# 10
 
a = 2.5
print(a)
# 2.5
 
a += a
print(a)
# 5.0
 
a = [ 1, 2, 3, 4, 5 ]
print( a[2] )
# 3
 
len(a)
# 5
 
a = "hello"
a += " world"
print(a)
# hello world
 
len(a)
# 11
 
print(a[10])
# d

So we just saw here that creating a variable is just writing its name and giving it a value. The type of value does not matter. And the variable will accept any type of value even if it's different from the one it use to have before.

workshops/blender/python_basics.1434666648.txt.gz · Last modified: 2015/06/19 00:30 by Julien Deswaef