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

Python Programming Lab

The document contains Python programs to solve various exercises involving basic concepts like loops, functions, strings, lists, tuples, dictionaries and more. It includes programs to check scores and leap years, find averages, factorials, prime numbers, calculate areas, series, palindromes and more.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python Programming Lab

The document contains Python programs to solve various exercises involving basic concepts like loops, functions, strings, lists, tuples, dictionaries and more. It includes programs to check scores and leap years, find averages, factorials, prime numbers, calculate areas, series, palindromes and more.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Exercise-1:

1. Implement a Python Program to Prompt for a Score between 0.0 and 1.0. If the Score Is Out of
Range, Print an Error. If the Score Is between 0.0
and 1.0, Print a Grade Using the Following Table.
Score Grade
>= 0.9 A
>= 0.8 B
>= 0.7 C
>= 0.6 D
< 0.6 F

2. Implement a Python Program to Check If a Given Year Is a Leap Year.

Exercise-2:
3. Implement a Python Program to Display First 10 Numbers Using
while Loop Starting from 0 to 9.
4. Implement a Program to Find the Average of n Natural Numbers Where n Is the Input
from the User.

Exercise-3:
5. Implement a Python Program to Find the GCD of Two Positive Numbers.
6. Implement a Program to Find the Sum of All Odd and Even Numbers up to a Number Specified by the
User.

Exercise-4:
7. Implement a Python Program to Find the Factorial of a Number.

8. Implement a Python Program to Check Whether a Number Is Prime or Not.

Exercise-5:
9. Implement a Python Program to Demonstrate continue Statement.
10. Implement a Python Program to Demonstrate a Function with and without Arguments.
Exercise-6:
11. Implement a Python Program to Find the Area of Trapezium Using the Formula Area
= (1/2) * (a + b) * h Where a and b Are the 2 Bases of Trapezium and h Is the Height.
12. Implement a Python Program to Demonstrate the Return of Multiple Values from a
Function Definition

Exercise-7:
13. Implement a Python Program to calculate the value of sin(x) up to n Terms Using the Series
3 x5 x7
sin (x) x x ⋯ Where x Is in Degrees 1! 3!
5! 7!
14. Implement a Python Program to Check If a 3 Digit Number Is Armstrong Number or Not.

Exercise-8:
15. Implement a Python Program to calculate and Add the Surface Area of Two
Cubes. Use Nested Functions

16. Implement a Python Program to Demonstrate the Use of *args and **kwargs.

Exercise-9:
17. Implement a Python Code to Determine Whether the Given String Is a Palindrome or Not Using
Slicing.
18. Implement a Python Program to Demonstrate String Traversing Using the for Loop.
Exercise-10:
19. Implement a Python Program to Count the Total Number of Vowels, Consonants and Blanks in a
String.
20. Implement a Python Program to Calculate the Length of a String Without Using Built-In
len() Function.

Exercise-11:
21. Implement a Python Program That Accepts a Sentence and Calculate the Number of Words,
Digits, Uppercase Letters and Lowercase Letters.
22. Implement a Python Program to Convert Uppercase Letters to Lowercase and Vice
Versa.
23. Implement a Python Program to Convert Uppercase Letters to Lowercase and Vice
Versa.

Exercise-12:
24. Implement a Python Program to Find Mean, Variance and Standard Deviation of List Numbers.
25. Implement a Program to Find the Transpose of a Matrix.
26. Implement a Program to Find the Transpose of a Matrix.
27. Implement a Program to Dynamically Build User Input as a List.
Exercise-13:
28. Implement a Python Program to Count the Number of Times Each Word Appears in a Sentence.
29. Implement a Python Program to Generate a Dictionary That Contains (i: i*i) Such that i Is a
Number Ranging from 1 to n.

Exercise-14:

30. Implement a Python Program to Populate Tuple with User-Entered Items


31.Implement a Python Program to Sort Words in a Sentence in Decreasing Order of Their Length.
Display the Sorted Words along with Their Length.

You might also like