0% found this document useful (0 votes)
2 views1 page

Tutorial

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Tutorial

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.​ Write a Program to Check Leap Year.

A leap year has 366 days instead of 365. To correctly identify a leap year, Python follows
these rules:
Leap Year Rules:
If the year is divisible by 400, it is a leap year.
If the year is divisible by 4 but NOT divisible by 100, it is a leap year.
All other years are not leap years.

2.​ Write a Program to Check Prime Numbers.


A prime number is a number that:
Is greater than 1
Has only two factors: 1 and itself

3.​ Write a Program to Print all Prime Numbers in an Interval of 1-100.

4.​ Write a Program to Find the Factorial of a Number.

5.​ Write a Program to Print the Fibonacci sequence


Fibonacci sequence: The Fibonacci sequence is a series of numbers where each number is
the sum of the two preceding ones, typically starting with 0 and 1. So, the sequence
begins with 0 and 1, and the next number is obtained by adding the previous two
numbers. This pattern continues indefinitely, generating a sequence that looks like this: 0,
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, and so on.
Mathematically, the Fibonacci sequence can be defined using the following recurrence
relation: 𝐹(0) = 0 𝐹(1) = 1 𝐹(𝑛) = 𝐹(𝑛−1)+𝐹(𝑛−2)𝑓𝑜𝑟m > 1

6.​ Write a Program to Check Armstrong Number


Armstrong Number:
It is a number that is equal to the sum of its own digits, each raised to a power equal to
the number of digits in the number. For example, let's consider the number 153:
●​ It has three digits (1, 5, and 3).
●​ If we calculate 13 + 53 + 33 , we get 1 +125+27 , which is equal to 153 .
So, 153 is an Armstrong number because it equals the sum of its digits raised to the
power of the number of digits in the number.
Another example is 9474:
●​ It has four digits (9, 4, 7, and 4).
●​ If we calculate 94 + 44 + 74 + 44 equal to 9474 .

7.​ Write a Program to Find Armstrong Number in an Interval

You might also like