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
‘#mastery01’ Articles at TC101 Fall 2015, Page 2
Introduction to Programming Python and C++

Tag Archives: #mastery01

Mastery Number #1

Sup’, here’s my video for Mastery number 1, it was kinda simple, check out my channel for my other 3 videos so far, heh. Sorry for the weird sound, im n00b at this.

Mastery Number #1

Sup’, here’s my video for Mastery number 1, it was kinda simple, check out my channel for my other 3 videos so far, heh. Sorry for the weird sound, im n00b at this.

Ability to create C++ file and run from command line

Escribir el código deseado, en este caso un típico “Hello World” 2. Guardar el archivo con el nombre que se quiera y la terminación .cpp (Ejemplo: hello.cpp) 3. Abrir Terminal, en este caso Cygwin 4. Buscar el archivo en la… Continue Reading →

Creating a Python File and running it from the Command Line

For a basic understanding and use of the command line I recommend this Code Academy course. You can watch my tutorial here:

#MASTERY01

HERE IS MY FIRST VIDEO ENJOY:

#Mastery01 -Ability to create C++ file and run from command line

Hi today I´m doing that is about knowing how to create a c++ file and run it, and we are making the “How are you doing?” program that is actually pretty simple and easy to do.

First, you have to make sure you have a text editor. The best option is to have one specially made for programming because that way, when you are writing your code line, the editor marks each word depending on its function. This makes easier, for instance, to realize when you are coding wrong. For this, I use atom, and it is available for both operating systems.

Another thing you need to have is a compiler, if you use Mac, it is all ready installed and it´s called terminal. If you use Windows, you con download Cygwin. Make sure, when installing Cygwin, that you don´t download the whole package, just the stuff you need for the course (you can check out Ken´s video on how to download Cygwin for Windows on his channel.) Link: https://www.youtube.com/watch?v=i2h_976SpV0

So these are the steps you need to follow to program How are you doing? In c++: 

First you have to open up your text editor, and make sure you save it first (easier for me) with any name you want with ending in .cpp. Make sure you remember where you saved it because you are going to need the direction when compiling.

You need to start on first line writing

And second line using namespace std;

And finishing your code, you have to write retun 0; } (you can already write it down if you want to).

Remember to be careful with spaces and most important, don’t forget to put a “;” at the ending of each line. Don´t worry if you miss one, you the compiler will show up the error.

 

 

Then, after the first two lines, type int main() {cout . The cout command means that it is going to print anything that is following that. Typing words in between “” gives them a string value. The endl; means end line.

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

Finally, you have to open your compiler. First you need to change directory, for this, you have to type cd Documents/ (This obviously if you have the file saved on your documents.)

 

 

Then type ls (LS), which gives the list of documents saved on that direction. When you find your document (howareyoudoing.cpp), type g++ howareyoudoing.cpp, this transforms your code in to g++.

 

At last, you have to type to run it, ./a.out (if using Linux or Mac) or ./a.exe (when using Windows). And that´s it! You have finished your first program.

 

Mastery 1 : Ability to create C++ file and run from command line. Mastery 7: Use of comments in C++.

Hello … ok so this is my first mastery … and it is all abot create and run a command line. And I include the use of comments mastery 7. So here are the steps you have to follow: Open atom and create the program “Hello World” Open cygwing. (change directory if needed). Run the… More Mastery 1 : Ability to create C++ file and run from command line. Mastery 7: Use of comments in C++.

Masteries 01 and 02 – How to create, open and execute a Python file on Windows

To create a new file:

To create a file in python first you have to open the Python IDLE, to do this you have to go to the search bar and look for “python”, there you willl see the IDLE exe.

The IDLE is like a comand line, you can´t write code on in, its just for testing. What you need to do to open a new blank space to write python code is to press “Ctrl+N  or to go to the corner and open a new file.
Now that you know how to create a new file, once you have your code written be sure to save it. It will be saved with a “.py” termination. 

To open/edit a file:

Once you have your file (you can even create it or download it) you will sometimes want to edit it, to write some extra code, finish your work or even correct somehing that was wrong. To do this first you have to localize your file: 
On the example I want to open the WSQ07.py file that I have in a folder in my desktop. 
I recommend you to memorize the files locations because if you want to execute it through the command line you will have to write the hole file adress. If you are bad at memorizing you should organize your files in jerarchised folders, this helps you to localize the file without not even knowing the exact location. Example: World/Continent/Country/State/City
This extructure will help you to go from something general to something specific without memorizing the exact adress. By the way, try not to use complicated names like “Masd123”. Use something easy to remember that follows the logic of the jerarchy.
Continuing with the tutorial. The next step is to right-click on the file and select “Edit with IDLE”. If you just open the file by double-clicking on it it will execute in the console or of it´s not finished it will not open anything. You should avoid opening .py files by double-clicking because the console that it launches will instantly run your code and when it ends it will close, you will not be able to see the prints or the results.
This will open the script so that you can continue writing on it.

To execute a file:

There are two ways of executing a file, through the command line and though the IDLE.
In my opinion opening it with the IDLE it´s a lot easier and you save a lot of time but it´s necessary that you know how to execute it with the command line because some text editors don´t have this option.

To execute the file with the command line(windows):

The first thing that you need to do is to open the CMD, look for it in the search bar and open it.
It will look like this:
Masteries 01 and 02 - How to create, open and execute a Python file on Windows
Now you have to write the folder directory of your file, I highly recommend you to save the file on c:/ so that you don´t have to write the location every time you run the program. 
To find the root directory open documents go to C:/ users / (name of the user), there is where the CMD will start. Here is an example:
Now, once that you have localized your file location and you are ready to put it down on the CMD be sure to write “python” before the file separated with a space. This tells the CMD to excute the file with python (if you installed it correctly of course), the CMD will imitate the python console and execute the file you selected with it. 

Always remember to write the file termination, in this case is “.py”.

To execute the file with the IDLE:

This is going to be really simple. First you need to open the file with the edit option that I teached you.
This is my WSQ07 and if want to run it while i´m using the IDLE I just have to pres F5… yes, just that. The console will open the file automatically.

As you can see it atomatically star asking me for the first number, that means that the program is running. 
Just as simple as that you can execute the file and test it without pressing more that 3 buttons, have in mind that in some computers you need to press Fn+F5.

MASTERY 01: Ability to create C++ file and run from command line

(The credit of the background image goes to https://flic.kr/p/aGsKED) Hello once again. This is my first mastery ever!!! For this, I created a “Hello, world.” code. I found easy to do it because I’ve done this kind of example like a million times!!! Here’s the summary of the steps I followed for this assigment: I wrote the […]

Masteries 1 & 2

*This blogpost is for Windows users only* Mastery 1 – Ability to create Python file and run from command line. For this mastery, you only need a proper shell, and the best option (as told by our teacher Ken) is Cygwin, if you don’t want to have any other issue with the Python installation directory, […]

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).