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

Python script - Office supply program

2023: Bash script for system administration

Amazon Macie in a nutshell - 2023 AWS service