Now that our computers are set up for Python, we can learn the basics!
Let's talk about variables!
witch = 1
name = 'Sir Lancelot'
my_list = ['african swallow', 'coconuts', 'the oppressed']
Variables can also be re-assigned different types
black_knight = 'worthy adversary'
black_knight = ['Tis but a scratch', 'I've had worse', 'Oh, come on, you pansy!']
Another handy thing about variables, and something else that is attributed to Python being an easy, fast language to use, is that you can define more than one variable at a time.
obj1, obj2 = 'holy grail', 'shrubbery'
monty_python_list = ['witch', 'false', 1, ['knights of the round table', 'Castle Anthrax']]
roman_names = ['Brian', 'Pilate', 'Biggus Dickus', 'Incontinentia Buttocks', 'Sillius Soddus']
print(-3) // 'Biggus Dickus'
political_groups = ['Judean People's Front', 'People's Front of Judea', 'Judean People's Front']
// political_groups = ['Judean People's Front', 'People's Front of Judea', 'Judean People's Front', 'People's Front']
To add multiple items to a list you can use .extend
monty_python_cast = ['Graham Chapman', 'Michael Palin', 'Terry Jones']
monty_python_cast.extend('Eric Idle', 'John Cleese')
//monty_python_cast = ['Graham Chapman', 'Michael Palin', 'Terry Jones', 'Eric Idle', 'John Cleese']
Today we've covered how to set up Python, basic variables and lists. Next week we will delve a little more into python! We will talk more about methods we can use on lists, functions and more! Stay tuned!