Hello @abdulbasitisdost,
Because in ROS, you will usually have to work with launch files in order to execute the programs you create. You could directly execute the Python script without the launch file, for sure, but this is much more limiting. For instance, launch files allow you to execute multiple Python scripts at the same time, define arguments (variables) that your scripts will need, etc… You will see it more clear once you advance through the course.
Best,