Skip to content
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 Python/Program43/Program43.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terms = 10

# Uncomment code below to take input from the user
# terms = int(input("How many terms? "))

# use anonymous function
result = list(map(lambda x: 2 ** x, range(terms)))

print("The total terms are:",terms)
for i in range(terms):
print("2 raised to power",i,"is",result[i])
6 changes: 6 additions & 0 deletions Python/Program44/Program44.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dec = 344

print("The decimal value of", dec, "is:")
print(bin(dec), "in binary.")
print(oct(dec), "in octal.")
print(hex(dec), "in hexadecimal.")
15 changes: 15 additions & 0 deletions Python/Program45/Program45.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def recur_fibo(n):
if n <= 1:
return n
else:
return(recur_fibo(n-1) + recur_fibo(n-2))

nterms = 10

# check if the number of terms is valid
if nterms <= 0:
print("Plese enter a positive integer")
else:
print("Fibonacci sequence:")
for i in range(nterms):
print(recur_fibo(i))
1 change: 1 addition & 0 deletions Python/Program45/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Python program to display the Fibonacci sequence