Posts
Assignment
- Get link
- X
- Other Apps

Programming in Python CST 362 Assignment -1 Date of submission:3-Feb-2025 before 1:30pm Note: Create a pdf file with program and output. Submit the printout control statements (if , for , while ) 1. Print the sin series x-x^3/3!+x^5/5!....x^n/n! ( read n.) 2. In the above program read the value x and find the sum of the series.(Use factorial function from math) 3.Print the following patterns * * * * * * * * * * 1 1 2 1 2 3 1 2 3 4 The pyramid is given for n=4 do this for any n 4. Find the position of the largest digit in a number.( consider unique digits) Eg: i/p : 546 largest digit=6 position =3 5.Positive integer is called an Armstrong number of order n if abcd….x= a^n + b^n + c^n + d^n + …+x^n where n is the length of the number Eg: 153 = 1^3 + 5^3+ 3^3 #153 is an Armstrong Number. Eg:1634= 1^4+6^4+3^4+4^4#1634 is an Armstrong Number. Write a Python program to check whether the given number is an Armstrong Number. 6. Find t...
Interfaces in Python
- Get link
- X
- Other Apps
An abstract class and interface appear similar in Python. The only difference in two is that the abstract class may have some non-abstract methods, while all methods in interface must be abstract, and the implementing class must override all the abstract methods. Rules for implementing Python Interfaces We need to consider the following points while creating and implementing interfaces in Python Methods defined inside an interface must be abstract. Creating object of an interface is not allowed. A class implementing an interface needs to define all the methods of that interface. In case, a class is not implementing all the methods defined inside the interface, the class must be declared abstract. Ways to implement Interfaces in Python We can create and implement interfaces in two ways − Formal Interface Informal Interface Formal Interface Formal interfaces in Python are implemented using abstract base class (ABC). To use this class, you need to import it from the abc module. Examp...