Putting variables in Python

Viewed 131

I'm a complete newbie to Python (and programming itself for that matter) and so i bought a Raspberry Pi. I also bought a magazine to help me get a grasp of the basics. Now, I've downloaded Geany and I am using the Terminal tab of that for very simple commands. In the magazine, the first variable you come across should happen like this:

>>> a=2
>>> print(a*3)
6

However, when I write this, it actually ends up as the following:

>>> a=2
>>> print(a*3)
bash:syntax error near unexpected token 'a*3'

so, I tried it with spaces and it came back with the following:

>>> a=2
>>> print(a * 3)
bash: syntax error near unexpected token 'a'

I have also tried putting the same things into the LXTerminal of the Raspberry Pi (I am using the Raspbian OS). Please can someone point out where I am going wrong. Thank you!

2 Answers
Related