- Mastering Python Scripting for System Administrators
- Ganesh Sanjiv Naik
- 224字
- 2021-07-02 14:00:18
Writing scripts with the Python interactive console
The Python interactive console starts from >>> prefix. This console will accept the Python commands, which you'll write after >>> prefix. Refer to the following screenshot:

Now, we will see how to assign values to the variable, as in the following example:
>>> name = John
Here, we've assigned a character value of John to the name variable. We pressed Enter and received a new line with >>> prefix:
>>> name = John
Now, we will see an example of assigning values to variables and then we will perform a math operation to get the values:
>>> num1 = 5000
>>> num2 = 3500
>>> num3 = num1 + num2
>>> print (num3)
8500
>>> num4 = num3 - 2575
>>> print (num4)
5925
>>>
Here, we assigned values to variables, added two variables, stored the result in a third variable, and printed the result on to the Terminal. Next, we subtracted one variable from the result variable, and the output will get stored in the fourth variable. Then, we printed the result on to the Terminal. So this tells us that we can also use the Python interpreter as a calculator:
>>> 509 / 22
23.136363636363637
>>>
Here, we performed a division operation. We divided 509 by 22 and the result we got is 23.136363636363637.
- Learning Python Web Penetration Testing
- 跟“龍哥”學C語言編程
- C#完全自學教程
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- UML 基礎與 Rose 建模案例(第3版)
- 精通Python自動化編程
- Mastering Akka
- 創意UI:Photoshop玩轉APP設計
- Delphi開發典型模塊大全(修訂版)
- 青少年學Python(第2冊)
- Maven for Eclipse
- 分布式數據庫HBase案例教程
- Learn Linux Quickly
- C/C++代碼調試的藝術
- Raspberry Pi Robotic Projects