Laboratory 1

Set up your computing environment

The objectives of this laboratory session are:

  1. Access Python on-line compiler (for quick simple work)
  2. Write and run "HELLO WORLD"
  3. Set up a functioning CoCalc workspace (using the free tier)
  4. Write and run "HELLO WORLD"

Exercise 1 - Python On-Line

  1. Select one of the on-line compilers below:

    1. A few Python 3.6+ On-Line Compilers (interfaces vary)
      1. https://www.programiz.com/python-programming/online-compiler/
      2. https://www.onlinegdb.com/online_python_compiler
  2. The compilers will automatically provide the "HELLO WORLD" script, run the script, verify output, then modify the script as follows:

    1. Find the part that looks like print("hello world")
    2. Change it to look like print("Were gonna build a dog park")
    3. Run the modified script
    4. (Optional) If you know how, screen capture the output, save as a .png file.

Video demonstration of above exercise https://engrmediacast.ttu.edu/mediasite/mymediasite/presentations/a865e7aa98e94388ad2d9db56672f8861d

Exercise 2 - CoCalc Environment

The CoCalc environment is a recomended environment for this course.
The URL is https://cocalc.com/

You will need an account; to obtain an account you will provide your name and email. Their server will send you a message, so use an email you can easily access. Once you have an account select Sign In.

Video demonstrating login and initial set-up for this lab: https://engrmediacast.ttu.edu/mediasite/mymediasite/presentations/e6f31bdb661d4197bde4b2eddb51a8c91d

Exercise 3 - Hello World in CoCalc

The cell below contains the classic "first program" of many languages.

The script input is quite simple, we instruct the computer to print the literal string "hello world" to standard input/output device which is the console. Here our jupyter interface intercepts to output stream and embeds it into this document.

In [1]:
print("hello world")
hello world

Change Contents and Run Again

Now we try changing the contents of the literal string (everything between the quotes is the literal. I'll try with something elaborate like:

Were gonna build a dog park, the best one ever - and the cats are gonna pay for it!

In [2]:
print("Were gonna build a dog park, the best one ever - and the cats are gonna pay for it!")
Were gonna build a dog park, the best one ever - and the cats are gonna pay for it!

Exercise 4 (Optional) Embed .png into markdown cell

The graphics are not quite cut-and-paste as in MS Word, or Libre Office. In Markdown, the files must exist, and be in same directory (or you provide a local path), and you insert them using $$\texttt{![](filename.png)}$$

Now insert the screen capture you made earlier by

  1. Upload the .png to your CoCalc space, into same directory as your lab notebook.
  2. type $$![](name_of_your_image_file.png)$$
  3. Set the cell type to `Markdown'
  4. Run the cell -- you should get the image.

Video demonstration of above exercise https://engrmediacast.ttu.edu/mediasite/mymediasite/presentations/3bdd0fdfd4f646648a7706522291f5711d

Here is the image

Handing in your work

For this laboratory, once you have sucessfully run a CoCalc notebook, export as .html, download the .html file, and submit it to Blackboard (or Moodle)

In [ ]: