Python 3 exercise with solutions (Set 1)

 1.To convert the given kilometres into metre and feet.


#For this problem the only thing you need to know is the formula to convert km into metre and feet.

Output:


2.To find whether the given year is leap year or ordinary year.

#In this problem we have made use of "and" & "or" functions , so that the problem can be solved in a brief and concise manner.

Output:


3.To find the sum of n terms.

#Here while loop is used over the condition i<=n, so that repeated addition is performed, provided the sum=sum+i, until i falls out of the loop condition.

Output:



4.To find the square of sum of n terms.

#its similar to the previous problem the one thing you are supposed to consider is the square of numbers , that's it you could land on the answer

Output:


5.To print the pattern below,
            *
            * *
            * * *
            * * * *
            * * * * *

#inorder to print the pattern, two variables such as i and j are used to denote row and column respectively. The term SEP is used for printing space inbetween each * .
Output:


Do you have a passion for programming? 
Now it is possible to code simply by using your Android mobile phone, the one step you need to do is to click here to get directed to the app and enjoy coding. 

Comments

Popular posts from this blog

Finding the percentage in python - HackerRank solution

HackerRank challenges with solutions (Rearrangement, Formula, Word sorting, Numbers, Sentence)

What's your name, Tuple - HackerRank solution in python