Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152
‘MASTERY2’ Articles at TC101 Fall 2015, Page 2
Introduction to Programming Python and C++

Tag Archives: MASTERY2

Mastery 2

Description: Ability to create C++ project in IDE and run inside the IDE. A great way to set up the perfect work space is an IDE, and in this mastery we will do just that. Mastey 2

IDLE


      There exist different ways to create a Python file and to run it in your computer. The most complicated ones involve installing a text editor that allows you to create a file written in Python language and save it as a Python file. This way, you will be able to open it as a program but edit it later if something goes wrong. Also it may be necessary to install some kind of shell in which your program will be running after you have done the file.

But there is an easier way to get through this process; through IDLE.

      IDLE is one of the programs you accepted to be installed during the “Terms and Conditions” amd the complements while installing Python 3. You probably didn’t notice, but this program works as an interactive console, a text editor, a shell, and it’s able to run your Python files.

In this post I will show you step by step how to do every of these things.

      To find this program, you can do it by the easy way which is just typing its name on the search bar for Windows. It looks like a Python file because it has the Python logo on the right just as the files created in Python.



      Once you select this option, this window will be opened:

      This is the Python Interactive Shell. It allows you to run small pieces of code such as it is shown in the following example:


      Later on, this can be used for trying new functions and experiment with the results. You can even use it as a calculator (as Ken Bauer recommends):


DO NOT CONFUSE THIS WITH CREATING A PYTHON FILE. THE CODE WRITTEN IN HERE CANNOT BE SAVED AND RUN LATER.  – THIS IS NOT ACTUAL CODE, JUST PIECES OF CODE.


      For actually creating a Python file you need to follow the next steps:


       On the “File” section located in the menu, there is an option which reads “New File”. You need to select it.

IDLE

      This will open the following window:


      This one just looks like an empty space ready to be used for writing code on it. For the purpose of showing how this works, we will write an easy piece of code that most programmers know:



     This programs asks the user’s name and saves it as a variable called “x”. Later, the program shows the text “Hello, “ followed by the name you wrote when you were asked.


     For saving it we just select the same option we did before from the menu on the upper side; which is “File”. And the we select the option “Save As”.


     After this you can name your file however you want. The only condition is that the name has to end with “.py”, which means this file is a Python file and not just a .txt, .jpg, .png, etc file.

        Now that we have our Python file we just need to run it so we can see if it works. For these we select the option “Run” from the menu shown on the upper side of the window. After doing this we have two different options which are: Running the program from the Python Shell, or running the program from the Run Module. If we select the second option this is what will happen:


      Now we know how to create, save and run a python file, but we still need to know how to edit it. Let´s suppose that I have already closed IDLE, and let’s say we now want to say “Goodbye” to the same person. For this we open IDLE and select the option “File” followed by the option “Open…”.

Now we look for our file and select it. Once it opened you can edit it however you want.



      Once you are done remember to save the changes.


     Now we can run this file and the output will be different from before.

Mastery 2

Here is y video for mastery 2. I have already made it but Ken gave me the suggestion to use a real IDE so here is the video.

Mastery 2

Here is y video for mastery 2. I have already made it but Ken gave me the suggestion to use a real IDE so here is the video.

Masteries 1 & 2

Mastery 1 – Ability to create Python file and run from command line To accomplish this Mastery you will need to have Python, Atom and Cygwin installed (if you are a Windows user like me). When you open Atom you will have something like this:  Click where it says Plain Text. Search for the coding […]

Masteries 1 & 2

Mastery 1 – Ability to create Python file and run from command line To accomplish this Mastery you will need to have Python, Atom and Cygwin installed (if you are a Windows user like me). When you open Atom you will have something like this:  Click where it says Plain Text. Search for the coding […]

Masteries 1 & 2

Here is another video tutorial to create and run C++ files (With Atom and Mac terminal). And create a project in an IDE (Xcode).

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).