Skip to main content

Posts

Showing posts from November, 2022

import in Python

Python allows you to reuse a code using imports. It can be constant values, general functions, formulas and what not. For instance you are writing a code to implement circle circumference formula, instead of hardcoding PI, Import Maths module from Python Standard Library  . This library has a massive list of facilities on offer. Learn about - ' from '

from in Python

While using Import, you can also import a part of the module. " from"  is used for that purpose. Math module for instance has a lot of features but we are bothered about the 'Floor' functionality. In this case we imported floor directly (in line 17th) from math using they keyword 'from'. Math is not required while calling 'floor' in case you directly imported floor.