01 Prepare : Checkpoint A
Objective
Demonstrate that you can write and submit a simple program in Python.
Overview
Write a program for Python 3 that displays the text Hello Python World! on the screen.
Sample Output
Hello Python World!
Writing Python Programs
To write programs to run in the Department Linux Environment, you have two choices, you can either login to the system and write them there, or you can write them on your own computer and copy them up to the Linux system.
Writing Programs in the Linux Environment
To write programs in the Linux environment, you need to first login, then you can use the program "emacs" to write them. To use it, you type emacs followed by the name of the file that your program is in (either a new file to create, or an existing one), such as:
emacs check01a.py
When using emacs, if you are using a program like MobaXTerm on Windows, or you have used XQuartz on the Mac, it will pop up a separate window with your code. You can use the mouse to save and exit, etc. If emacs opens in the same window, you will have to use the keyboard for any commands. To save, you press "Control and X" then "Control and S". To Quit, you press "Control and X" then "Control and C". Emacs is admittedly cumbersome, but it's nice that you are writing programs that are already in the Linux environment, ready to go.
Writing Program on your own computer, then copying them to Linux.
Another option for writing your programs is to write them first on your own computer using any text editor you'd like. Then, you can copy the program to the Linux environment and run it there.
There are many different text editors that you can choose from, including Sublime, NotePad++, Atom, or others. The trick is to have an editor that is just for text, not something that formats a document like Microsoft Word.
Once you have written your program, you need to copy it to the Linux system. MobaXTerm shows the file locations and can be used to drag and drop files, or to edit them directly. Otherwise, if you are not using that, or if you are on a Mac, you'll need to get a separate program to handle the copying. The most common programs for Windows are FileZilla or WinSCP. The most common one for the Mac is CyberDuck. All of these programs are available for free. But many of them are downloaded from pages that have lots of big bright "download me" links for other stuff. Be careful and make sure you only download the application you want.
Once you have downloaded one of these programs, you will need to configure it to connect to the Linux System, using the same IP address, username, and password that you used to login previously. Make sure to specify port 215 (rather than port 22) as part of your configuration. Once set up, these programs let you drag and drop your Python files between your computer and the Linux system.
Running Python in the Department Linux Environment
You may use any editor your like to write your programs. Then, you can run your program on the Linux server as follows:
python3 check01a.py
Please note that both Python 2 and 3 are installed on our department Linux servers. To run a Python 2, use "python". To run a Python 3 program (what the testBed will use), use "python3" as shown above.
Automatic Grading Script (TestBed)
This assignment is pass/fail. In order to receive credit, it must pass the auto-grading test script (TestBed). You can run this script as many times as you like while you are working on the assignment. The same test script will be run by the instructor for credit, so you should not be surprised at the result.
To run the test script, log into the CS Department Linux system and run the testBed command, providing the class and test script to run as well as the Python program to use, as follows:
testBed class/assignment yourFile.py
Thus, for this checkpoint, if my file were named "check01a.py", I would type the following:
testBed cs241/check01a check01a.py
Submission
Submit your program by logging into the CS Department Linux system, and running the submit command with your filename. Example (assuming my file is named "check01a.py":
submit check01a.py
You should then select the appropriate course (CS 241), instructor, and assignment (check01a) from the list.