Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
83 views

Python Assignments

The document contains 44 problems involving writing Python programs to perform various calculations and print patterns. The problems cover topics such as calculating area and volume, determining positive/negative/zero, checking divisibility, calculating future investment values, distance between points, BMI calculation, palindrome checking, Fibonacci series, and nested loop patterns.

Uploaded by

adeel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Python Assignments

The document contains 44 problems involving writing Python programs to perform various calculations and print patterns. The problems cover topics such as calculating area and volume, determining positive/negative/zero, checking divisibility, calculating future investment values, distance between points, BMI calculation, palindrome checking, Fibonacci series, and nested loop patterns.

Uploaded by

adeel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Write a Python program which accepts the radius of a circle from the user and compute the
area
2. Write a Python program to check if a number is positive, negative or zero
3. Write a Python function to check whether a number is completely divisible by another
number. Accept two integer values form the user
4. Write a Python program that accepts an integer (n) and computes the value of (n + nn + nnn)
5. Write a Python program to calculate number of days between two dates
6. Write a Python program to get the volume of a sphere, please take the radius as input from
user. V=4 / 3 πr3
7. Write a Python program to get the difference between a given number and 17, difference
cannot be negative
8. Write a Python program to get a new string from a given string where "Is" has been added to
the front. If the given string already begins with "Is" then return the string unchanged
9. Write a Python program to get a string which is n (non-negative integer) copies of a given
string
10. Write a Python program to find whether a given number (accept from the user) is even or
odd, print out an appropriate message to the user.
11. Write a Python program to test whether a passed letter is a vowel or not
12. Write a Python program that will accept the base and height of a triangle and compute the
area (https://www.khanacademy.org/math/basic-geo/basic-geo-area-and-perimeter/area-
triangle/a/area-of-triangle)
13. Write a Python program that will return true if the two given integer values are equal or
their sum or difference is 5.
14. Write a Python program to solve (x + y) * (x + y)
15. Write a Python program to compute the future value of a specified principal amount, rate of
interest, and a number of years.
16. Write a Python program to compute the distance between the points (x1, y1) and (x2, y2).
https://en.wikipedia.org/wiki/Euclidean_distance
17. Write a Python program to convert height (in feet and inches) to centimetres.
18. Write a Python program to calculate the hypotenuse of a right angled triangle
19. Write a Python program to convert the distance (in feet) to inches, yards, and miles. 1 feet =
12 inches, 3 feet = 1 yard, 5280 feet = 1 mile
20. Write a Python program to convert all units of time into seconds.
21. Write a Python program to convert seconds to day, hour, minutes and seconds.
22. Write a Python program to calculate body mass index.
(https://www.thecalculatorsite.com/articles/health/bmi-formula-for-bmi-calculations.php)
23. Write a Python program to convert temperatures to and from Celsius, Fahrenheit

(Practice After Loops have been discussed)

24. Write a python program to sum of the first n positive integers


25. Write a Python program to calculate the sum of the digits in an integer
26. Write a Python program to convert an integer to Binary, Octal and Hexadecimal numbers
27. Write a program to convert binary number to Decimal number
28. Write a program to convert Octal number to Decimal number
29. Write a program to convert Hexadecimal number to Decimal number
30. Write a Python program to count the number occurrence of a specific character in a string
31. Write a Python program to compute the greatest common divisor (GCD) of two positive
integers. (https://en.wikipedia.org/wiki/Euclidean_algorithm)
32. Write a Python program to get the least common multiple (LCM) of two positive integers
(https://en.wikipedia.org/wiki/Least_common_multiple)
33. Write a Python program which accepts the user's first and last name and print them in
reverse order with a space between them (Practice After Loops has been discussed)
34. Input a text and count the occurrences of vowels and consonant
35. Write a Python program to find the number of notes (Sample of notes: 10, 20, 50, 100, 500,
and 1000 ) against an given amount
36. Write a program to check whether given input is palindrome or not
37. Write a Python program to reverse the digits of a given number and add it to the original, If
the sum is not a palindrome repeat this procedure
38. Write a Python program to get the Fibonacci series between 0 to 50
39. Write a Python program to create the multiplication table (from 1 to 10) of a number
40. Write a Python program that accepts a string and calculate the number of digits and letters
Sample Data : Python 3.2, Expected Output : Letters 6, Digits 2
41. Write a Python program to construct the following pattern, using a nested for loop

**

***

****

*****

****

***

**

42. Write a Python program to construct the following pattern, using a nested for loop

12

123

1234

12345

1234

123

12

43. Write a Python program to construct the following pattern, using a nested loop number.
1

22

333

4444

55555

666666

7777777

88888888

999999999

44.

You might also like