Perfect Plan B
Learn, grow and become leaders of tomorrow
Problem 1 : Python Program to add two numbers
Example:
Input: num1 = 5, num2 = 3
Output: 8
Input: num1 = 13, num2 = 6
Output: 19
Solution 1 : Python Program to add two numbers
# Python3 program to add two numbers
num1 = 15
num2 = 12
# Adding two nos
sum = num1 + num2
# printing values
print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))
Solution 2 : Python Program to add two numbers
# Python3 program to add two numbers
number1 = input("First number: ")
number2 = input("\nSecond number: ")
# Adding two numbers
# User might also enter float numbers
sum = float(number1) + float(number2)
# Display the sum
# will print value in float
print("The sum of {0} and {1} is {2}" .format(number1, number2, sum))
Problem 2 : Python Program for factorial of a number
Problem 3 : Python Program for simple interest
Simple interest formula is given by:
EXAMPLE1:
Input : P = 10000
Simple Interest = (P x T x R)/100
R = 5
T = 5
Where, Output :2500
We need to find simple interest on
P is the principle amount Rs. 10,000 at the rate of 5% for 5
units of time.
T is the time and
EXAMPLE2:
R is the rate Input : P = 3000
R = 7
T = 1
Output :210
Problem 4 : Python Program for compound interest
Formula to calculate compound
Input : Principle (amount): 1200
interest annually is given by: Time: 2
Rate: 5.4
Output : Compound Interest =
Compound Interest = P(1 + R/100) t 1333.099243
Where,
P is principle amount
R is the rate and
T is the time span
Problem 5 : Python Program to check Armstrong
Number
Input : 153
Output : Yes
153 is an Armstrong number.
1*1*1 + 5*5*5 + 3*3*3 = 153
Input : 120
Output : No
120 is not a Armstrong number.
1*1*1 + 2*2*2 + 0*0*0 = 9
Input : 1253
Output : No
1253 is not a Armstrong Number
1*1*1*1 + 2*2*2*2 + 5*5*5*5 + 3*3*3*3 =
723
Input : 1634
Output : Yes
1*1*1*1 + 6*6*6*6 + 3*3*3*3 + 4*4*4*4 =
1634
Problem 6 : Python Program for Program to find area
of a circle
Area = pi * r2
where r is radius of circle
Problem 7 : Python program to print all Prime
numbers in an Interval
Given two positive integer start and end. The task is
to write a Python program to print all Prime numbers
in an Interval.
Definition: A prime number is a natural number
greater than 1 that has no positive divisors other than
1 and itself. The first few prime numbers are {2, 3, 5, 7,
11, ….}.
Problem 8 : Python program to check whether a
number is Prime or not
Definition: A prime number is a natural number greater than 1 that has no
positive divisors other than 1 and itself. The first few prime numbers are {2, 3,
5, 7, 11, ….}.
Input: n = 11
Output: true
Input: n = 15
Output: false
Problem 9 : Python Program for n-th Fibonacci
number
In mathematical terms, the sequence Fn of Fibonacci numbers is
defined by the recurrence relation
Fn = Fn-1 + Fn-2
with seed values
F0 = 0 and F1 = 1.
Hint : Recursion
Problem 10 : Python Program for printing Fibonacci
numbers
In mathematical terms, the sequence Fn of Fibonacci numbers is
defined by the recurrence relation
Fn = Fn-1 + Fn-2
with seed values
F0 = 0 and F1 = 1.
Hint : Recursion
Problem 11 : Python Program for How to check if a
given number is Fibonacci number?
Input : 8
Output : Yes
Input : 34
Output : Yes
Input : 41
Output : No
Problem 12 : Program to print ASCII Value of a
character
Input : a
Output : 97
Input : D
Output : 68
Problem 13 : Python Program for Sum of squares of
first n natural numbers
Input : N = 4
Output : 30
= 1 + 4 + 9 + 16
= 30
Input : N = 5
Output : 55
Problem 14 : Python Program for cube sum of first n
natural numbers
Input : n = 5
Output : 225
13 + 23 + 33 + 43 + 53 = 225
Input : n = 7
Output : 784
13 + 23 + 33 + 43 + 53 +
63 + 73 = 784
Slack Invite Link
[Link]
ared_invite/zt-eqkkziyb-fc8MNTRVqyu
d7QAUhQzQ~w#/
Social Media Links
Facebook: [Link]
Twitter: [Link]
Linkedin: [Link]
Instagram: [Link]
Quora:
[Link]
R3y0
Youtube: [Link]