This repository contains two basic Python programs based on control structures using if-else
and for
loops.
Write a Python program that:
- Takes an integer input from the user.
- Checks whether the number is even or odd using an
if-else
statement. - Displays the result accordingly.
Enter a numbar: 5 5 is an odd number.
Enter a numbar: 6 6 is an even number.
Write a Python program that:
- Uses a
for
loop to iterate from 1 to 50. - Calculates the sum of all integers in this range.
- Displays the final sum.
The sum of numbers from 1 to 50 is: 1275