Skip to content

Commit 7cd30a8

Browse files
Added basic python programs in Beginner_Level_Python_programs
1 parent 7bff512 commit 7cd30a8

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def compound_interest(principle, rate, time):
2+
3+
# Calculates compound interest
4+
Amount = principle * (pow((1 + rate / 100), time))
5+
CI = Amount - principle
6+
print('The principal is', principle)
7+
print('The time period is', rate)
8+
print('The rate of interest is',time)
9+
print("Compound interest is", CI)
10+
11+
compound_interest(10000, 10.25, 5)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def factorial(n):
2+
3+
return 1 if (n==1 or n==0) else n * factorial(n - 1)
4+
5+
6+
num=input("Please enter number to calculate factorial:")
7+
8+
print ("Factorial of",num,"is",factorial(int(num)))
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def simple_interest(principle,time,rate):
2+
print('The principal is', principle)
3+
print('The time period is', time)
4+
print('The rate of interest is',rate)
5+
6+
si = (principal * time * rate)/100
7+
8+
print('The Simple Interest is', si)
9+
return si
10+
11+
12+
simple_interest(8, 6, 8)

0 commit comments

Comments
 (0)