Skip to content

This repository contains basic Python programs based on Module 3: Control Structures. It includes examples using if-else statements and for loops to solve simple problems like checking even/odd and calculating the sum of numbers from 1 to 50.

Notifications You must be signed in to change notification settings

CodeWithBarsa/Python_Assignment_module3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Python_Assignment_module3

Module3: Control Structures in Python

This repository contains two basic Python programs based on control structures using if-else and for loops.

Task 1: Check if a Number is Even or Odd

Problem Statement:

Write a Python program that:

  1. Takes an integer input from the user.
  2. Checks whether the number is even or odd using an if-else statement.
  3. Displays the result accordingly.

TASK1-OUTPUT

Enter a numbar: 5 5 is an odd number.

Enter a numbar: 6 6 is an even number.

Task 2: Sum of Integers from 1 to 50 Using a Loop

Problem Statement:

Write a Python program that:

  1. Uses a for loop to iterate from 1 to 50.
  2. Calculates the sum of all integers in this range.
  3. Displays the final sum.

TASK2-OUTPUT

The sum of numbers from 1 to 50 is: 1275

About

This repository contains basic Python programs based on Module 3: Control Structures. It includes examples using if-else statements and for loops to solve simple problems like checking even/odd and calculating the sum of numbers from 1 to 50.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages