Laboratory Walkthrough 1 - Submissiondeadline...

This preview shows page 1 - 3 out of 4 pages.

Intro2cs Ex0 ­ Some Basics Submission deadline Tuesday, 22 October, 20:55 Objectives This exercise's purpose is get you familiarized with some basic operations ­ working with the shell, and running your first Python program. 1. Create a directory Create a directory named intro2cs under your safe home-directory ( ~/safe ). You should write your solutions to the intro2cs exercises under this directory (each exercise will have its own directory). Under ~/safe/intro2cs create two directories named: ex0 (for this exercise) and ex1 (for the next exercise). Remember to set the permissions to the intro directory so it will not be accessible/viewable to others. If you're in the directory ~/safe it could be done by executing chmod 700 intro2cs . 2. Run a Given Python Program . Using IDLE , create a file named Hello.py under the directory ~/safe/intro2cs/ex0/ (that you've just created). The file should contain the following python code: ############################################################# # FILE : Hello.py # WRITER : your_name + your_login + your_id # EXERCISE : intro2cs ex0 20013­2014 # DESCRIPTION: # A simple program that prints "Hello World" to the standard # output (screen). ############################################################# print( "Hello World") As you can see, this program simply prints the string "Hello World" to the screen. Save the file and run it using the F5 button. Did you see the output in the Python Shell? If you made a mistake while typing the file above, the compiler might describe your error(s). Fix them. Make sure the correct output is printed. Another method to run your code is using the shell. go to ~/safe/intro2cs/ex0/ and run python3 Hello.py” (without the quotes). Try to run your program also using this method.
Image of page 1

Subscribe to view the full document.

3. Run another Python Program . Using IDLE, we will create another "hello world" program, this time a more complicated one. In python we may import a code written by others, using the import command. Later in the course, we will speak about the importance of import and how python interprets this command and finds the relevant code. For this exercise we will use the module Turtle. This module (or a python file that contains definitions and statements), allow us to create simple graphics.
Image of page 2
Image of page 3
  • Spring '14
  • Avraham
  • Meaning of life, WIE  ornm  orlgn+yu_d, Asml rga htpit

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern