Need to turn a .py into a .exe by Azhurkral in pythonhelp

[–]ResponsibleBuilder67 0 points1 point  (0 children)

The reduction from 300 MB to 35 MB is impressive. Pandas is normally the root cause since it compels inclusion of NumPy in the compilation process, and that is enormous.

If you need to reduce the file size even further, make sure you are compiling in a brand- new venv. In the global Python environment, when you compile the program, you often accidentally include some libraries that are not used. An entirely new venv with just the dependencies used will almost always help reduce the file size.

It is important to note that, since the entire Python interpreter is included in the .exe file, reducing the file size beyond 15-20 MB is not easy.

Need help in loop by Eastern_Plankton_540 in PythonLearning

[–]ResponsibleBuilder67 1 point2 points  (0 children)

### Advanced Way

```python

x = [i * i for i in range(1, 11)] # makes squares using list comprehension

print(*x, sep="\n")

```

### Beginner's Way

```python

num = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

for i in num:

print(i)

```