Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python Program to Display Powers of 2 Using Anonymous Function

# Display the powers of 2 using anonymous function

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])
Comment

PREVIOUS NEXT
Code Example
Python :: if else ifadesi 
Python :: jax.numpy 
Python :: Using CGI with Python and HTML forms 
Python :: how to run another python file in python 
Python :: list box tkinter 
Python :: python sort_values 
Python :: frequency domain parameter of speech 
Python :: when i press tab it shows ipynb_checkpoints/ in jupyter notebook 
Python :: how to input a string character into a numpy zeros imatrix n python 
Python :: machine earning to predict sentimentanalysis python 
Python :: python bill 
Python :: flask extends two base.html 
Python :: data parsing app python 
Python :: rotate an image python keras 
Python :: matlab index last element 
Python :: iterating over the two ranges simultaneously 
Python :: numpy print full array to srdout 
Python :: even number list generator 
Python :: Reading from a file way03 
Python :: Python Module Search Path 
Python :: flask make_response render_template 
Python :: pie plot chance size python 
Python :: lists example in python 
Python :: token validation in flask socket 
Python :: python string count complexity 
Python :: python datediff days 
Python :: NMF cosine similarities 
Python :: how to produce txt file from list python 
Python :: Como hacer mayusculas un string 
Python :: biopython parse fasta 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =