The Danger of Overdraft Fees

Using a debit card has a number of advantages for consumers, especially in terms of convenience. For those who can maintain a healthy balance in their checking accounts, debit cards and checks are…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Python Functions Exercise

Simple problem solving using function
Define an empty list then fill it taking the input from user and search the even numbers from that list.

Output:

Define a function that takes a string as parameter and finds out the total number of capital letter and small letter in the string.

Output:

Showing the above program in the alternative way
Define a function that takes a string as parameter and finds out the total number of capital letter and small letter in the string.
# Define a function that takes a string as parameter and finds out the total number of capital letter and small letter in the string.

Output:

Define a function that takes a string and finds out the total number of capital letters and small letters in the string.

Output:

Finding maximum of three numbers using function.

Output:

Finding minimum number of three numbers using function.

Output:

Finding greater number of 3 numbers using function.

Output:

Finding largest number in list using function.

Output:

Finding smallest number in list.

Output:

Multiplying all numbers in a list using function.

Output:

Reverse a list.

Output:

Define a function that receives a list as parameter and gives a unique list.

Output:

Program to reverse a tuple.

Output:

Define a function that takes two numbers as parameter and find GCD or HCF (greatest common divisor or heighest common factor) of 2 numbers.

Output:

Define a function that takes two numbers as parameter and find LCM of them.

Output:

Define a function that takes a number as parameter and tests whether this number belong to a certain range or not ?.

Output:

Definition of perfect number:
We can call a positive integer as a perfect number when it will be equivalent to the summation of the positive numbers those will be proper divisors for the perfect number and the number is not included itself.
In other word when a number will be the summation of all of its positive divisors (the number is included itself), we can call this as perfect number.
Illustration with example:
6 is first perfect number, because it is divided by 1, 2 and 3 properly (without remainder).
We get mathematically, 1+2+3 = 6
Or (1+2+3 + 6 )/2 = 6, according to second definition.
We get 28 as next perfect number, 1+2+4+7+14 = 28.
Other perfect numbers are 496 and 8128.

Define a function that takes a number as parameter and tests whether it is perfect number or not?.

Output:

Palindrome (string).
When we read a string from left to right or in reverse order (right to left), in both cases we get the same result,then this string is called palindrome (string).

Output:

Showing list operations using function.

Output:

Set operations using function.

Output:

Example of dictionary using function.

Output:

Add a comment

Related posts:

Work Is Value

Value is not physical. When you work, you give value, but you can’t see it or measure it. You can only estimate how much value you’ve provided. Value is the importance of work done. And it has the…

One Thousand Views in Just Three Weeks!

Shortly after I started writing for Medium I began to notice that there is a trend towards turning personal writing achievements into articles. Never one to miss out on a good trend, I thought I…

Boost Your Page Ranking With Off Page SEO

The most important reason why you want to get first page rankings is that you want to be visible to everyone that will need your product/service. Google, for example, is the #1 search engine and it…