Posts

Showing posts with the label Simple problem in python

Python 3 exercise with solutions (Set 1)

Image
  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 res