0% found this document useful (0 votes)
3 views

Achyut 13490 Assignment 2 Sec Programming Using Python

The document outlines a programming assignment for Python, consisting of 71 tasks that require writing various programs. Tasks include printing messages, performing arithmetic operations, checking number properties, and manipulating strings and lists. Each task specifies input and output requirements, guiding students in their programming exercises.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Achyut 13490 Assignment 2 Sec Programming Using Python

The document outlines a programming assignment for Python, consisting of 71 tasks that require writing various programs. Tasks include printing messages, performing arithmetic operations, checking number properties, and manipulating strings and lists. Each task specifies input and output requirements, guiding students in their programming exercises.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Assignment -2 (Programming using Python)

Achyut Kumar Agarwal,13490,B.A.(Hon's) History


1.Write A Program to print Hello-World!!

— INPUT

OUTPUT

2. Write A Program to swap values among two variables

— INPUT

OUTPUT

3. Write A Program to swap values using an extra variable.

—INPUT
OUTPUT

4. Write A Program to do various arithmetical operations {add, sub, mul, div }

—INPUT

OUTPUT
5. Write A Program to check if a no is positive, negative or zero.

—INPUT

OUTPUT
6. Write A Program to find ASCII values of a character.

—INPUT

OUTPUT
7. Write A Program to find the area of a square, triangle, rectangle and circle.

— INPUT

OUTPUT
8. Write A Program to check if it’s a leap year or not.

— INPUT

OUTPUT

9. Write A Program to check whether a no is odd/even.

— INPUT
OUTPUT

10. Write A Program to check whether a no is prime or not.

— INPUT

OUTPUT
11. Write A Program to find all prime numbers within a range.

— INPUT

OUTPUT

12. Write A Program to take a single digit number from the keyboard and print its value in English word?

— INPUT

OUTPUT
13. Write A Program to check for the Armstrong number {407,157} 407= 4^3+0^3+7^3=
64+0+349=407}

— INPUT

OUTPUT

14. Write A Program to check for the Disarium number. {175= 1^1 + 7^2+ 5^3= 1+49+125=175}

— INPUT
OUTPUT

15. Write A Program to find LCM and HCF of a given no.

— INPUT

OUTPUT
16. Write A Program to use break, continue and pass statements.

— INPUT

OUTPUT
17. Write A Program to check greatest/smallest of the three numbers.

— INPUT

OUTPUT
18. Write A Program to check 2nd greatest/smallest of the three numbers.

— INPUT

OUTPUT

19. Write A Program to get the factorial of a number.

— INPUT
OUTPUT

20. Write A Program for Fibonacci series.

— INPUT

OUTPUT

21. Write A Program to check if a no is palindrome or not.

— INPUT
OUTPUT

22. Write A Program to find the sum of natural no/ odd no/ even no.

— INPUT

OUTPUT
23. Write A Program to get the cube of sum of n natural no’s.

— INPUT

OUTPUT

24. Write A Program to sum any given number {123=>1+2+3=>6}.

— INPUT

OUTPUT

25. Write A Program to reverse any given number {123=>321}.

— INPUT
OUTPUT

26. Write A Program to print all Possible Combinations from any three digit number.

— INPUT

OUTPUT

27. Write A Program to check the length of a string.


— INPUT

OUTPUT

28. Write A Program to reverse a string.

— INPUT

OUTPUT

29. Write A Program to sort alphabets in a string. {dcabe will become abcde}

— INPUT

OUTPUT
30. Write A Program to sort elements in a list.

— INPUT

OUTPUT

31. Write A Program to swap adjacent letters in a string. {Eg: string will become tsirgn}

— INPUT

OUTPUT

32. Write A Program to check for a specific letter in a string.

— INPUT
OUTPUT

33. Write A Program to check and count any given specific letter in a string.

— INPUT

OUTPUT

34. Write A Program to accept any string which contains any of the vowels {a, e, I, o, u}.

— INPUT
OUTPUT

35. Write A Program to check for a number in a list.

— INPUT

OUTPUT

36. Write A Program to find the largest/smallest no in a list.

— INPUT
OUTPUT

37. Write A Program to find the second largest/smallest no in a list.

— INPUT

OUTPUT

38. Write A Program to add, subtract and multiply two matrices of a no.

— INPUT
OUTPUT
39. Write a Python program to count the number of strings where the string length is 2 or more and the
first and last character are the same from a given list of strings.
[ 'abc', 'xyz', 'aba', '1221' ] => 2

— INPUT

OUTPUT

40. Write a Python program to remove duplicates from a list


[1,2,3,7,2,1,5,6,4,8,5,4] => [1,2,3,4,5,6,7,8]
— INPUT

OUTPUT

41. Write a Program that gets two lists as input and check if they have at least one common member.
[1, 2, 3, 4, 5] & [5, 6, 7, 8, 9] => {both have one no in common which is 5}
— INPUT

OUTPUT
42. Write A Program to Find the n-th term of series 1, 3, 6, 10, 15, 21…
— INPUT

OUTPUT

43. Write A Program to Find the N-th term of the Series 0, 2, 4, 8, 12, 18…

— INPUT

OUTPUT

44. Write A Program to print the table of any no in the below format
2*1=2
2*2=4
.
.
.
2 * 10 = 20

— INPUT
OUTPUT

45. Write A Program to Find the Sum of Series 1!+2!+3!+...+n!

— INPUT

OUTPUT

46.
*
**
***
****
— INPUT

OUTPUT
47.
****
***
**
*
— INPUT

OUTPUT

48.
––––*
–––**
––***
–****
*****
— INPUT

OUTPUT
49.
*
***
*****
*******
— INPUT

OUTPUT

50.
1
23
456
7 8 9 10
— INPUT

OUTPUT

51.
1
22
333
4444
55555
— INPUT

OUTPUT
52.
1
12
123
1234
12345
— INPUT

OUTPUT

53.
12345
1234
123
12
1
— INPUT

OUTPUT

54.
55555
4444
333
22
1
— INPUT

OUTPUT

55.
11111
2222
333
44
5
— INPUT

OUTPUT

56.
54321
5432
543
54
5
— INPUT

OUTPUT
57.
12345
–1234
––123
–––12
––––1
— INPUT

OUTPUT

58.
1
21
321
4321
54321
— INPUT
OUTPUT

59.
1
121
12321
1234321
— INPUT

OUTPUT

60.
0
12
234
3456
45678
— INPUT

OUTPUT

61.
––––1
–––12
––123
–1234
12345
— INPUT

OUTPUT
62.
12345
23456
34567
45678
56789
— INPUT

OUTPUT

63.
12345
12345
12345
12345
12345
— INPUT
OUTPUT

64.
54321
54321
54321
54321
54321
— INPUT

OUTPUT

65.
11111
22222
33333
44444
55555
— INPUT

OUTPUT

66.
55555
44444
33333
22222
11111
— INPUT

OUTPUT
67.
A
BB
CCC
DDDD
EEEEE
— INPUT

OUTPUT

68.
A
AB
ABC
ABCD
ABCDE
— INPUT
OUTPUT

69.
A
BC
DEF
GHIJ
KLMNO
— INPUT

OUTPUT

70.
ABCDE
ABCD
ABC
AB
A
— INPUT

OUTPUT

71.
EDCBA
EDCB
EDC
ED
E
— INPUT

OUTPUT

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy