- +91 7075575787
- [email protected]
- Moosarambagh, Hyderabad
A command-line software is a manner of giving operating gadget instructions using strains of text. Command-line packages perform via the command line or PowerShell. It will engage with a command-line script.
Libraries:
Argparse: Python comes with several one of a kind libraries that permit us to put in writing a command-line interface for our scripts, however the widespread way for developing a CLI in Python is through the usage of the Python argparse module. The argparse module enables us to parse the arguments passed with the script and system them extra quite simply.
Sys: Python presents the sys module that gives us independence from the host gadget working system and allows us to function on an underlying interpreter, irrespective of its being a Linux or windows Platform. With the help of the sys module, we can get admission to device-particular parameters and functions. It provides exclusive functions used to control unique parts of the Python Runtime surroundings.
This project is created to perform operations using single command. In the program main function is defined. A variable parser is defined in which argparse .argumentparser class is used in main function add argument is passed as we creating this program to perform calculations using a command in this aegument x is passed as variable which stores the entered value as float datatype same is done for another parameter y. Another argument is passed to perform add or any other type of arithematic operations .
A function is defined calc with parameter args after which if statement is used when args.o is equal to add perform add operation and return the values same is continued for other operations also. If any other operations other calculations is passed it displays something went wrong.
Note: Make sure you have added path while installing the software’s.
https://techieyantechnologies.com/2022/07/how-to-install-anaconda/
7. If your project is in c drive, you can ignore step 4 and go with step 5
8. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.), example: pip install “module_name”.
Click Here To Download This Code And Associated File.
How can we help you?
🟢 we are online | privacy policy
WhatsApp us