Assignment 1
1. Simple Calculator
Write a Python program that takes two numbers and an operator as input from the
user and performs the corresponding arithmetic operation (+, -, *, /).
Use conditional statements (if, elif, else) to check which operation to perform.
2. Check Prime Number
Write a Python program that checks if a given number is prime.
Use a loop to check divisibility and if conditions to decide if the number is prime or
not.
3. Multiplication Table
Write a program that asks the user for a number and then prints the multiplication
table for that number up to 10.
Use a for loop to generate the table.
4. FizzBuzz Problem
Write a program that prints numbers from 1 to 50.
For multiples of 3, print "Fizz" instead of the number.
For multiples of 5, print "Buzz".
For numbers which are multiples of both 3 and 5, print "FizzBuzz".
5. Factorial Calculation
Write a program to calculate the factorial of a given number using a while or for
loop.
6. Palindrome Checker
Write a program to check if a given string or number is a palindrome (reads the same
forward and backward).
Use conditions and loops to reverse the input and compare it with the original.
7. Fibonacci Sequence Generator
Write a program that generates the Fibonacci sequence up to a given number of terms.
Use a loop to compute each term by adding the two previous terms in the sequence.
8. Grade Calculator
Ask the user for their marks in different subjects.
Calculate the total and percentage, and assign a grade based on their percentage:
o Above 90%: A
o 80-89%: B
o 70-79%: C
o Below 70%: D
Use conditional statements to assign the grade.
9. Find Factors of a Number
Write a program that finds all the factors of a given number.
Use a for loop to iterate from 1 to the number itself and check if each value divides
the number without a remainder.
10. Pattern Printing
Ask the user for the number of rows and print a right-aligned triangle pattern using
asterisks (*).
Example for 5 rows:
*
**
***
****
*****