Sunday, November 5, 2017

Six Steps to Learning to Program With Python

Jack Donaldson


Have you ever wanted to learn how to program but it just seems like there is way too much to learn? There are websites that try to make it easier to learn how to code such as code.org but they are far too simple and are aimed at kids in either middle school or younger. What if I told you that you could learn how to write a program in under five minutes? This is easily accomplished by using a more simple programming language, and the one I am going to show you is called Python. Python is known for its simplicity, however this means it is far less powerful than more complicated languages like C++ and Java.
For your first program I'm going to show you how make a program that asks for the user's name and then says “”Hi” to the user using their name.


Step One:
Open Python and you should come to a screen that looks like this. This is known as the shell and this is where your program will run. Press file and then new file to open up a new program.
1.PNG






Step 2:
A screen like this should pop up. This is where you will be writing the actual code.
2.PNG

Step 3:
Use hashtags to write comments. Comments are not read by the computer and are only read by other people who read the program. Comments are important because they allow others who read your program to know what you were trying to write with your code.
3.PNG


Step Four:
Create a variable that stores the user's name. In this case the variable is called “name” and the words in the quotes are the words that the user sees.
4.PNG


Step 5:
Create a print statement that uses the user's name using the variable created previously.
5.PNG


Step 6:
Create an input statement that stops the program. Without this the program will continue to run until you close Python. After you have done this press the run button and run the program!
6.PNG


Once you have run the program it will ask for your name. Type your name and then press enter.
7.PNG

Then the print statement will pop up on the screen and it will prompt you to press enter to exit. Congratulations you have just finished your first program!!!

8.PNG

No comments:

Post a Comment