This is a lab assignment and so you will not be submitting it. However, the concepts and practice will help you on both the homework and exams so I encourage you to make a serious effort on it during class and consider finishing it outside of class.
This is a repeat of the walk through that we did together, in case you missed something.
- Mount the COURSES drive
- Create a new folder in your STUWORK folder called
- Open VSCode
- Click and drag you
Lab1folder to the VSCode window to open it
- Create a new file named
- Drag up from the bottom of the VSCode screen to open a
You’ll now test out using Gradescope.
- Navigate to Moodle, today’s class section and click on the “In Class Assignment” Gradescope link
hello.pyto Gradescope (yes, even though it’s empty)
- Notice what the autograder does when your code doesn’t work correctly
print(“hello world!”)a. Don’t copy and paste! You should always type out Python code even if copying and pasting it is an option. Copying often introduces errors to the code because of weird spaces and it is good practice for you to start getting used to typing Python commands.
- See what your program does by typing
python3 hello.pyin the VSCode Terminal (it should print out “hello world!” without the quotes)
hello.pyto Gradescope again and make sure that you pass the first test case
We’ll be doing a lot with getting input from the Terminal in these first few weeks and it’s a little annoying to make sure that the formatting is just right for this sort of thing, so you’ll now get some practice.
- Make another file
- You can accept input from the user with the command
inputand save it to use later in a variable (we’ll learn more about exactly what variables and
inputdo in the coming week). Type the following into your new file:
new_name = input("What is your name?") print(new_name)
- Run your program by typing
python3 hello_input.pyin the Terminal.
- Change your program so that it does the following when run:
python3 hello_input.py What is your name? Anya Hello, Anya!
- Upload both of your files to the Gradescope In Class Assignment to check if all the test cases are now passing.
Switch who is logged in and go back through the exercises on the other partner’s account.
If you finish everything above for both partners, open up Section 1.5 of the book and experiment with the different control structures demonstrated. See what you can make with them!