Lab 1
Lab 1
1. Present Python programming as the programming platform for the entire course.
2. To review the Python programming environment and basic syntax in variables and
operators, creating lists and arrays, functions, and plotting.
Rationale
This laboratory activity aims to assist the student to review the basic syntax in Python
programming. The knowledge in Python programming will enable the students to solve
succeeding laboratory activities.
Background
If you are not using Anaconda, you can find Spyder and installation instructions at
https://www.spyder-ide.org/
To launch Spyder, you can select it from the list of programs for your computer or you can run
Spyder in a terminal or command window.
When you start Spyder, you should see an interface with multiple panes as shown in Figure
below.
Pre-task
Using any Python editor, try the following mathematical expression to determine the answer.
Example:
Using the Python editor, here is the statement that should be typed, ((2+3)*7), then press
<enter> to see the result. The answer is equal to 35.
Machine Problem
Convert the following equations into valid Python commands and submit both the screenshot
of the input and output of the command from the console. (40 total points)
3. Create the array [3 6 2 9 12] and replace the second element with the value in that
location cubed. That is, cube the value found in that location and store it back in the same
location. (10 pts.)
Results:
Line specifiers—an optional parameter to the plot function—can be used to control the
color of the line, the style of the line, and any data markers.
Plot the data in the following table to explore line specifiers and submit both the input
and output of the command from the interpreter.
Rubrics
Level of Achievement
Correctness – the 100% (50) 80% (40) 60% (30) 40% (20)
program is syntactically
and logically correct
(50%)
Completeness -covers all 100% (50) 80% (40) 60% (30) 40% (20)
the required input,
process and output (50%)
Reference: Gordon, S. I., & Guilfoos, B. (2017). Introduction to Modeling and Simulation with
MATLAB® and Python. Chapman and Hall/CRC.