Week 1 Lab - Overview of Python 2
Week 1 Lab - Overview of Python 2
Objective
The purpose of this lab is to provide hands-on experience with fundamental Python
concepts, as discussed in the lecture. By completing the exercises, students will
strengthen their understanding of Python’s features, syntax, and essential
programming constructs.
Instructions
1. Each task should be coded in a separate .py file. Each file name should be
“Task #.py”, where # is the task number. Eg for task 1, the file name should
be “Task 1.py”.
2. Add comments to explain your code.
3. Collaboration is encouraged, but submissions must be individual. You may
submit the same file as your collaborators.
Lab Tasks
Task 1: Python Features
Objective: Explore Python’s features and interactive mode.
1. Print a message using Python’s interactive mode. Include an example with
formatted strings.
2. Explore the help() function to view details about Python keywords.
Task 7: Functions
Objective: Work with functions, parameters, and return values.
1. Define a function that takes two numbers as parameters and returns their
product.
2. Write a function with default parameters and test it with different arguments.
3. Create a function that accepts a variable-length argument list (*args) and
returns the sum of all arguments.
o author
o price