0% found this document useful (0 votes)
31 views3 pages

Lab 2 ISYS 480 2025

This document outlines the ISYS 480 Lab 2 assignment for Duquesne University, focusing on Python basic syntax and variables. It includes a series of exercises that students must complete, involving variable definitions, calculations, and user input, with an emphasis on commenting code. Additionally, optional extra credit questions related to data analytics and AI are provided.

Uploaded by

tyler.oresick5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Lab 2 ISYS 480 2025

This document outlines the ISYS 480 Lab 2 assignment for Duquesne University, focusing on Python basic syntax and variables. It includes a series of exercises that students must complete, involving variable definitions, calculations, and user input, with an emphasis on commenting code. Additionally, optional extra credit questions related to data analytics and AI are provided.

Uploaded by

tyler.oresick5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ISYS 480 Lab 2 - Python Basic Syntax/Variables Lab Duquesne University

Adjunct Professor E.I. Levenson

Points: 10 (up to 14 points with extra credit)

We will begin this lab together in class. As part of your weekly exercise, you are expected to
complete the remaining questions at home. Please complete the following exercises in
either a .py (Command Line File) or .ipynb (Jupyter) file. For each question, ensure that you
comment on each line of your script, explaining what the line is doing.

Python Lab Exercises

Please complete the following exercises in either a .py (Command Line File) or .ipynb
(Jupyter) file. For each question, ensure that you comment on each line of your script,
explaining what the line is doing.

1. Values and Types


Write a script that defines two variables: x with a value of 7 (integer) and y with a value of 3.5
(float).

Print the type of each variable.

2. Variables
Create a script with two variables, length and width, assigned the values 5 and 10
respectively.

Calculate and print the area of a rectangle using these variables.

3. Variable Names and Keywords


Write a script that defines two variables: value1 and value2. Assign them values 12 and 8
respectively.

Ensure that these names do not conflict with any Python keywords.

4. Statements
Write a script that includes a single print statement to display the message: "Welcome to
Python Programming!".

Ensure that the statement is correctly formatted.

5. Operators and Operands


Create a script that uses addition and subtraction operators. Define variables a as 15 and b
as 5.

Compute and print the result of a + b and a - b.

1|Page
ISYS 480 Lab 2 - Python Basic Syntax/Variables Lab Duquesne University
Adjunct Professor E.I. Levenson
6. Expressions
Write a script to evaluate the following expression: (8 + 4) * 2.

Store the result in a variable named result and print it.

7. Order of Operations
Write a script that calculates and prints the result of the expression: 10 + 6 / 2 - 3 * 4.

Use parentheses to ensure the correct order of operations.

8. Modulus Operator
Create a script that defines a variable number with a value of 29.

Use the modulus operator to determine if number is divisible by 4 and print the result.

Data Analytics/AI Questions (Optional - Extra Credit). 2 Points each.

Go to the official Duquesne CoPilot. Enter these Prompts, show your results.

Enter both prompts. Show your results.

9. “What are continuous data and continuous outcomes in the field of Data Analytics?”

10. “What are business applications of Linear Regression from both an AI and a Data Analytics
standpoint?”

Extra Credit (2 Points Each)

11. String Operations


Write a script that defines a variable text with the value "Hello".

Print the length of the string and the string in uppercase.

12. Asking the User for Input


Write a script that prompts the user to enter their name and age.

Print a message greeting the user and stating their age in the format: "Hello [name], you are
[age] years old."

13. Comments
Write a script that defines a variable ‘temperature’ and assigns it the value 20.

Add comments explaining each step of the script.

2|Page
ISYS 480 Lab 2 - Python Basic Syntax/Variables Lab Duquesne University
Adjunct Professor E.I. Levenson
14. Debugging
Write a script with an intentional syntax error (e.g., missing parentheses in a print
statement).

Fix the error and provide a corrected version of the script.

3|Page

You might also like