How to Write your 1st Python Program (and Save your Script)?

🎓 Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you learn Python from A to Z!

🖥️ Write your first Python Program and Save your Python Code into a Script

You will eventually find it tedious to retype programs into your shell, line by line. Like other interpreted programming languages, you can store and execute Python code, from a file.

There are two main types of Python files: plain text, and bytecode files.

Plain text files are simple files that you can create and edit, with just a simple plain text editor. For instance: Notepad, Notepad++, or Python Integrated Development Environment.

○ The other type of file, bytecode files, are compiled Python files. Don’t worry about this type of file for now, which will be discussed later on in this course.

A Python script file name ends with the extension “.py”, and will be executable when you execute the script by itself, on most operating systems…

Create a file called “hello.py” and write the following code into it.

#!/usr/bin/python3
print("Hello world, from a Python script!")
input("Press enter to continue... ")


Now, run the script by either clicking on it, or by running it from your system’s shell. Then the script should print “Hello world, from a Python script” and “Press enter to continue…”, then it should pause until you press the Enter key!

Hello world, from a Python script!
Press enter to continue...


Congratulations, you wrote your first Python Script 🙂

Let’s play this video, stick around and watch until the end of this video! 👍🏻

– Digital Academy™ 🎓

***

☞ WATCH NEXT:
○ HOW TO Learn Python? Python Tutorial for Beginners [FULL Course] https://youtu.be/9hvnSZPMtuw

📖 Blog: http://digital.academy.free.fr/blog

📖 Complete Python Development Course for Beginners [PLAYLIST]: http://digital.academy.free.fr/playlist/python-development-for-beginners

#Python #Tutorial #Beginners #Shorts

***

♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.

***

♡ FOLLOW US ♡
http://digital.academy.free.fr/
https://twitter.com/DigitalAcademyy
https://www.facebook.com/digitalacademyfr
https://www.instagram.com/digital_academy_fr/
https://www.youtube.com/c/DigitalAcademyOnline

♡ SUPPORT US ♡
http://digital.academy.free.fr/join
http://digital.academy.free.fr/donate
http://digital.academy.free.fr/subscribe
https://www.patreon.com/digital_academy
https://www.buymeacoffee.com/digital_academy

***

Copy link
Powered by Social Snap