Skip to content

Added basic python programs #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Beginner_Level_Python_programs/compound_interest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def compound_interest(principle, rate, time):

# Calculates compound interest
Amount = principle * (pow((1 + rate / 100), time))
CI = Amount - principle
print('The principal is', principle)
print('The time period is', rate)
print('The rate of interest is',time)
print("Compound interest is", CI)

compound_interest(10000, 10.25, 5)
8 changes: 8 additions & 0 deletions Beginner_Level_Python_programs/factorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def factorial(n):

return 1 if (n==1 or n==0) else n * factorial(n - 1)


num=input("Please enter number to calculate factorial:")

print ("Factorial of",num,"is",factorial(int(num)))
12 changes: 12 additions & 0 deletions Beginner_Level_Python_programs/simple_interest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def simple_interest(principle,time,rate):
print('The principal is', principle)
print('The time period is', time)
print('The rate of interest is',rate)

si = (principal * time * rate)/100

print('The Simple Interest is', si)
return si


simple_interest(8, 6, 8)