This repository contains two Python scripts for the Module 3 assignment of the Tutedude Python course, focusing on control structures:
-
even_odd.py: Checks whether a user-provided integer is even or odd using an if-else statement.
-
sum_integers.py: Calculates the sum of integers from 1 to 50 using a for loop.
- Python 3.x installed (verify with
python --version). - Git installed (verify with
git --version). - Visual Studio Code (VS Code) with Git extension enabled.
- Clone the Repository:
-
Clone this repository to your local machine:
git clone https://github.com/sakshi892001/Module3_Python_Assignment.git
-
Navigate to the Repository Folder:
cd Module3_Python_Assignment -
Run the scripts:
python even_odd.py python sum_integers.py
- File : even_odd.py
- Functionality : Takes an integer input from the user, checks if it's an even or odd using if-else statement, and displays the result. Handles invalid inputs (e.g, non-integer values).
- File : sum_integers.py
- Functionality : Uses a for loop to iterate over numbers from 1 to 50, calculates their sum, and displays the result.
-
Task 1: Catches ValueError for non-integer inputs (e.g., letters, decimals). Provides a clear error message.
-
Task 2 : No user input, so no error handling is required, but the loop is robust for the fixed range.
-
Ensure Python is installed and added to your system's PATH.
-
Test the scripts with various inputs to verify robustness.