4-week course syllabus for "Basic Scripting in Python" and Hands-On Exercises

  4-week course syllabus for "Basic Scripting in Python"


Course Title: Basic Scripting in Python (4 Weeks)

Duration: 4 Weeks (5 Days per Week)
Target Audience: Beginners in programming or new to Python scripting
Prerequisites: Basic computer literacy (no prior programming experience required)


🧭 Course Objectives:

By the end of this course, students will be able to:

  • Understand the fundamental syntax and semantics of Python.

  • Write simple to moderately complex scripts for everyday automation tasks.

  • Handle files, directories, and text processing.

  • Use Python to interact with operating system tools and external libraries.

  • Understand how to debug, test, and improve basic scripts.


📚 Course Syllabus (Week-by-Week Breakdown):


🔹 Week 1: Python Fundamentals for Scripting

🎯 Objective: Build a strong foundation in Python syntax, data types, and control structures.

Day 1: Introduction to Python

  • What is scripting?

  • Installing Python (Windows/Mac/Linux)

  • Introduction to Python REPL and IDEs (VS Code, IDLE)

  • First script: print("Hello, world!")

  • Running Python scripts (.py files)

Day 2: Basic Data Types and Variables

  • Numbers (int, float)

  • Strings (declaration, concatenation, formatting)

  • Booleans

  • Variable naming rules and conventions

Day 3: Input, Output, and Type Casting

  • input() function

  • String formatting: .format(), f-strings

  • Type conversion: int(), str(), float()

Day 4: Operators and Expressions

  • Arithmetic operators

  • Comparison operators

  • Logical operators

  • Assignment operators

Day 5: Control Flow – If/Else Statements

  • if, elif, else

  • Nesting conditions

  • Truthy and falsy values

🔁 Weekend Practice (Optional):

  • Mini-project: Write a calculator script

  • Exercises: Variable manipulation, conditionals, user input


🔹 Week 2: Data Structures and Loops

🎯 Objective: Learn how to organize and manipulate collections of data and repeat tasks using loops.

Day 1: Lists and Tuples

  • Creating and accessing lists

  • List methods: .append(), .remove(), .sort(), etc.

  • Tuples and immutability

  • Iterating through lists/tuples

Day 2: Dictionaries and Sets

  • Dictionary syntax and usage

  • Dictionary methods: .get(), .keys(), .values(), .items()

  • Sets and set operations (union, intersection)

Day 3: Loops – for and while

  • Basic for loops

  • range() function

  • Loop control: break, continue, pass

  • Nested loops

Day 4: Comprehensions and String Methods

  • List, dictionary, and set comprehensions

  • String methods: .split(), .join(), .replace(), .strip()

Day 5: Practical Looping and Data Structure Tasks

  • Simple data processing scripts

  • Counting occurrences, filtering data

🔁 Weekend Practice:

  • Mini-project: Contact list manager (add/search/delete using a dictionary)

  • Loop and data structure exercises


🔹 Week 3: Functions, Modules, and File Handling

🎯 Objective: Modularize code using functions and learn to work with external files.

Day 1: Defining and Calling Functions

  • def keyword

  • Parameters and arguments

  • Return values

  • Default and keyword arguments

Day 2: Scope and Built-in Functions

  • Local vs global scope

  • Built-in functions: len(), max(), min(), sum()

  • Using the help() function and documentation

Day 3: Modules and Imports

  • Standard libraries: math, random, time, os

  • Import styles: import, from ... import, as

  • Creating your own module

Day 4: File Input and Output (Text Files)

  • Opening files: open(), modes (r, w, a)

  • Reading and writing: .read(), .readlines(), .write()

  • Using with for safe file handling

Day 5: Working with CSV and Error Handling

  • Introduction to csv module

  • Reading/writing CSV files

  • Exception handling: try, except, finally

🔁 Weekend Practice:

  • Mini-project: CSV log file reader or student gradebook

  • Practice with functions and file handling


🔹 Week 4: Scripting for Automation and Practical Projects

🎯 Objective: Apply knowledge to real-world scripting tasks using Python libraries and the OS.

Day 1: Scripting with the OS

  • Using os and sys modules

  • Navigating directories

  • Creating/deleting folders and files

  • Getting system info

Day 2: Working with Date and Time

  • datetime module basics

  • Formatting and parsing dates

  • Time difference calculations

Day 3: Basic Automation Tasks

  • Automating backups

  • Renaming files in bulk

  • Writing scheduled scripts (with time.sleep())

Day 4: Web and Internet Scripting

  • Making HTTP requests with requests

  • Downloading web pages/files

  • Simple web scraping with BeautifulSoup (intro only)

Day 5: Final Project Workshop

  • Choose a scripting project:

    • File organizer

    • Automated email sender

    • CSV report generator

    • Daily weather notifier

  • Build, test, debug, and document the script

🔁 Weekend Final Assignment:

  • Submit and review the final project

  • Optional peer code review and improvement


📝 Assessment and Evaluation:

  • Quizzes: Weekly quizzes to assess understanding of syntax, structures, and concepts.

  • Mini-projects: Weekly coding projects to apply new concepts.

  • Final project: A practical script demonstrating the use of all major topics learned.


Skills Gained After Completion:

  • Proficient in writing Python scripts for real-world tasks.

  • Able to read, understand, and modify basic Python programs.

  • Able to automate routine tasks using Python.

  • Familiar with standard libraries and documentation.

  • Ready to move on to intermediate topics (APIs, regular expressions, object-oriented design).


-x-


🛠️ Hands-On Exercises: Basic Scripting in Python (4 Weeks)

Each exercise focuses on practical scripting tasks and programming fundamentals. These can be used for practice, assignments, or mini-projects.


🔹 Week 1: Python Fundamentals for Scripting


Day 1 – Introduction to Python

Exercise 1.1: Write and run your first script that prints:

Welcome to Python Scripting!
This is my first Python script.

Exercise 1.2: Modify the script to:

  • Print your name

  • Print the current year (hardcoded)


Day 2 – Variables & Data Types

Exercise 2.1: Create variables for:

  • Your name (string)

  • Age (int)

  • Height (float)

  • Is_student (bool)

Print them in a single formatted sentence using f-strings.

Exercise 2.2: Convert string "45" to an integer, add 10, and print the result.


Day 3 – Input and Type Casting

Exercise 3.1: Prompt the user to enter:

  • Their name

  • Their age

Print:

Hello <name>, you will be <age + 5> in 5 years!

Exercise 3.2: Ask user to enter the price of two items. Add them and display total cost.


Day 4 – Operators and Expressions

Exercise 4.1: Write a script that calculates:

  • Area of a rectangle (length × width)

  • Perimeter of a rectangle

Exercise 4.2: Create a BMI calculator:

  • Ask for weight (kg) and height (m)

  • Calculate and print BMI = weight / height²


Day 5 – Conditional Statements

Exercise 5.1: Ask for user’s age and:

  • Print whether they are a child, teen, adult, or senior.

Exercise 5.2: Ask for a number. Check and print:

  • Whether it’s even or odd

  • Whether it’s positive, negative, or zero


🔹 Week 2: Data Structures and Loops


Day 6 – Lists and Tuples

Exercise 6.1: Create a list of 5 favorite fruits. Add a new fruit. Remove one.

Exercise 6.2: Create a tuple with 3 different city names. Try to modify one value and observe the result.


Day 7 – Dictionaries and Sets

Exercise 7.1: Create a dictionary for 3 students:

{"Alice": 88, "Bob": 76, "Carol": 93}
  • Add one new student

  • Update Bob’s grade

  • Print average score

Exercise 7.2: Create two sets:

set1 = {1, 2, 3, 4}
set2 = {3, 4, 5, 6}

Print union, intersection, and difference.


Day 8 – Loops

Exercise 8.1: Print the first 10 even numbers using a for loop.

Exercise 8.2: Create a simple password checker:

  • Ask user to enter password

  • Loop until the correct password is entered


Day 9 – Comprehensions and String Methods

Exercise 9.1: Use a list comprehension to:

  • Create a list of squares from 1 to 10

  • Filter out only even numbers from a list

Exercise 9.2: Prompt user for a sentence. Print:

  • Number of words

  • Number of characters

  • Reversed sentence


Day 10 – Practice Task

Mini-Project: Create a “To-Do List” manager:

  • Add tasks to a list

  • Mark tasks as completed

  • Remove tasks

  • Display current tasks


🔹 Week 3: Functions, Modules, File Handling


Day 11 – Functions

Exercise 11.1: Write a function that:

  • Takes two numbers and returns their sum

Exercise 11.2: Create a function to check if a number is prime.


Day 12 – Scope and Built-in Functions

Exercise 12.1: Write a script using:

  • len(), max(), min(), and sum() on a list of numbers

Exercise 12.2: Demonstrate difference between local and global variables using a function.


Day 13 – Modules and Imports

Exercise 13.1: Use the math module to:

  • Calculate square root

  • Find the value of pi

  • Use ceil() and floor()

Exercise 13.2: Create your own module with a greeting function and import it into another script.


Day 14 – File I/O

Exercise 14.1: Write a script that:

  • Opens (or creates) a text file

  • Writes 5 lines of text to it

Exercise 14.2: Read a file line by line and:

  • Count number of lines

  • Print all lines in uppercase


Day 15 – CSV and Exceptions

Exercise 15.1: Write a CSV reader that:

  • Opens a CSV file of students’ names and grades

  • Calculates and prints average grade

Exercise 15.2: Add try/except blocks around file operations to handle:

  • File not found

  • Division by zero


🔹 Week 4: Automation and Real-World Scripting


Day 16 – OS Scripting

Exercise 16.1: Use os module to:

  • List all files in the current directory

  • Create a new directory called backup

  • Move a specific file to backup


Day 17 – Date and Time

Exercise 17.1: Write a script that:

  • Prints today’s date and time

  • Calculates days left until a specific date (e.g., New Year)


Day 18 – Automation Tasks

Exercise 18.1: Write a script to:

  • Rename all .txt files in a folder to file_1.txt, file_2.txt, etc.

Exercise 18.2: Write a Python timer:

  • Ask user to enter number of seconds

  • Countdown and then print “Time’s up!”


Day 19 – Web and Internet Scripting

Exercise 19.1: Use requests to fetch a webpage (e.g., example.com) and print its HTML content.

Exercise 19.2 (Bonus): Use BeautifulSoup to extract all hyperlinks (<a href>) from a webpage.


Day 20 – Final Project Workshop

Choose 1 of the following:

  • File Organizer Script:

    • Sorts files into folders based on extensions.

  • Daily Task Logger:

    • Logs daily notes to a dated .txt file.

  • Weather Notifier:

    • Uses an API to get weather for a city.

  • CSV Report Generator:

    • Reads student grades and generates a summary report.


🎓 Optional Weekly Quizzes & Challenge Tasks

  • Week 1 Quiz: Data types, operators, input/output

  • Week 2 Quiz: Loops, lists, dictionaries

  • Week 3 Quiz: Functions, files, modules

  • Week 4 Quiz: Automation, date/time, API basics



Comments

Popular posts from this blog

Differences Between Ubuntu 24.04.2 LTS and Ubuntu 25.04

Latest 394 scientific research areas and projects as of March 2025, Exploring the Future of Technology and Sustainability

Unmasking Hidden Threats: A Deep Dive into a Suspicious Facebook Ads Link