Python Programing Lab EXERCISE NO : 10(a) EXERCISE - 10(b) EXERCISE - 10(C)

EXERCISE NO : 10(a)

Description:

We need to write a function cumulative_product to find cumulative product of numbers in the list.
A Cumulative product is a sequence of partial products of a given sequence. For example,The cumulative product of sequence [a,b,c,.....] are a,ab,abc,.....

EXERCISE - 10(b)
Description:

We need to write a function reverse to reverse the given elements in a list. Reversing of a list is done by using the feature called slicing.
Python‟s list objects have an interesting feature called slicing. We can view it as anextension of the square brackets indexing syntax. It includes a special case where slicing a list with“[::-1]” produces a reversed copy.
 EXERCISE - 10(C)
Description:


We need to write a functions to compute gcd, lcm of numbers. But here the constraint is each function should not exceed one line. For this, We are using lambda function.
lambda function:

We can use lambda keyword to create small anonymous functions. lambda functions can have any number of arguments but contains only one expression. The expression is evaluated and returned. They cannot contains commands or multiple expressions.
The general form of lambda function is as followes:
lambda arguments : expression

No comments

File Uploading in PHP

  File Uploading in PHP PHP allow you to upload any type of a file i.e. image, binary or text files.etc..,PHP has one in built global variab...