Python’s functionality can be extended with scripts that are made to do different tasks. They are sometimes super easy to work with and can perform a myriad of tasks with just a few lines of code.
To run a python script. You have to open python in either the command prompt or its IDLE.
We can make use of pyinstaller module. Which will take your script and add all the dependencies and create a standalone executable file which you can use just like any other software.
To install pyinstaller
open your command prompt and execute the following code
pip install pyinstaller
This will install pyinstaller .
After doing it. Browse into your script folder.
pyinstaller --onefile your-python-script.py
If you run the above line it will create a self containing executable file.
You can also have a directory in which all the dependency files are placed along with the executable file.
# If-else Python
a = 1
b = 1
if (a < b):
print("A is Lesser than B")
elif (a ==b):
print("A is equal to B")
else:
print("A is Greater than B")
How to perform a while loop operation
# While Loop
# Using While Loop to perform multiplication using Addition
A = 13131313
sum = 0;
counter = 1
while (counter < 11):
sum = A + sum
print(A," x ",counter," = ",sum)
counter = 1 + counter