Python script : Swap two numbers.

  Note: I would appreciate your support of this blog by going to the link below to "Buy me a pizza" so that I may continue to provide educational scripts, resources and general tech stuff. 🍕

Thank you.

https://www.buymeacoffee.com/infosec_coder

--------------------------------------------------------------------------------------

The following scripts takes user input (2 numbers) and swaps the numbers.

1. You will learn to use try/except in case the user input is invalid.

2. Termcolor is a library module used to add colour to the output.

Resource: https://pypi.org/project/termcolor/

Screenshot 1


Screenshot 2


This was made in Visual Studio Code within a virtual environment.

The most important commands in working with your virtual environment are:

1. Create your virtual environment:

> py -m venv env

2. Activate your virtual environment:

> env\Scripts\activate

3. Go to View > select Command Palette > Select Python Interpreter > (env:venv)

3. Run your application:

> py main.py

Python script to swap two numbers:

To view the script more clearly, CTRL + (scroll up using your mouse). This will zoom in on the script.




Comments

Popular posts from this blog

Developer's Arsenal: How HashiCorp unites cloud securite and upholds the AWS Well-Architected Framework when implementing Policy as Code using Sentinel One.

C++ code base - Cloud provider services menu using if/else, switch/case. 2023.

AWS - Amazon Customer Outreach Ecommerce diagram with notes