Posts

Showing posts from September, 2021

Assignment-package

Do the programs in colab. Rename the note book file with  youname-rollno.ipynb  . Convert the file into pdf. Follow the link below to learn how to convert your ipynb file to pdf. https://saturncloud.io/blog/convert-google-colab-notebook-to-pdf-html/ share the pdf file in group  1.Read a number in decimal and convert it into different bases. 2.Read a binary number (Eg: 0b101010) and convert it into different bases.( use eval,oct,hex functions) 3.Find the number of digits in the factorial of a given number.(i/p rollno+1000) 4. What will be the result of the following expressions in Python? i) (50 %-4 - 5 * *6) // 4 ii) not (10 < 5) or (5 = = 5) iii) True and 5 5.Read a Year and month and print the calendar of the specified month.( Use your date of birth and mention the day name you are born) 6.Print a random number between 1 and 100 ( use random module) 7.Print the python version you are using ( use sys module) 8.Print the files in the current directory ( use os module) ...

Interfaces in Python

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...