# First Python Program

The ruggedBOARD A5D2x comes with an inbuilt python interpreter, let us see some simple examples of running small python codes on your board. \
Let's dive in.

There are two ways you can write a python code, \
1\. Using shell as our python interpreter.\
2\. Writing code on a text editor (eg: vi, vim, etc..) and using the interpreter to compile it

**Using Shell as our interpreter**

**Step 1: Enter into your board's terminal, type in** `python3` **and hit the \<Enter> key**

**Step 2: Now we are inside an inbuilt python interpreter. Here we can type in some simple python codes and play around for a while.**\
**Given below is a screen shot to which you can refer and start off wrinting python codes.**

![Example Python codes. ](https://2940024201-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbvnQRGvCTc2Zmsi6BG%2F-LeQN1HlKphuoCx-Y0YA%2F-LeQNLQ1hUdu4Pv3bjmR%2Fpython_1.png?alt=media\&token=be9a6100-f9fe-4cd2-a37e-e7a8c480d53e)

**Method 2:**

**Step 1: Write any python code on a text editor and then save it with a** `.py` **extension.** \
**You can use the code given below(In our example we save it as add.py)**

```
#Example program in python that adds two numbers.

num1 = 6
num2 = 8
sum = num1 + num2
print("The sum of", num1, "and", num2, "is:", sum)
```

**Step 2: Run the code using** `python3 add.py`&#x20;

![Python using Method2](https://2940024201-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LbvnQRGvCTc2Zmsi6BG%2F-LeRbjbQbg9fCfF7SRLR%2F-LeRdlTeRtcJB4VEzLo8%2Fpython_2.png?alt=media\&token=79c3582d-12bc-4095-a818-8b73eb20aa20)

**You should be able to see the output as**\
`The sum of 6 and 8 is: 14`
