Skip to main content

Posts

Showing posts with the label integers

Diving into Modules - Math Module

 >Math Module - Overall explanation Source:  freepik Introduction Other than Python built-in functions, there are numerous functions which can be found in some packages which need to be imported when needed which are called modules .  Such a module in python is the math module. Python's standard library provides a module viz. math for math functions that work with all number types except complex numbers. The Math module in Python is enriched with plenty of functions. Note!: To use the math module one must import it first into the Python compiler one has been working with. The syntax to do so is given below: import math FUNCTIONS IN MATH MODULE ceil(): This function returns the closest just above integer when a value has been passed. Syntax: x = math.ceil(2.4) print(x) floor():  This function returns the closest just below integer when a value has been passed. Syntax: y = math.floor(2.4) print(y) fabs():  This function returns the absolute number in flo...

For Loops

 The for loop By  polygraphus  on  shutterstock Def: The for loop is also known as the counting loop and is designed to process the items of any sequence, such as a list or a string, one by one. General form of for loop: The general form of the for loop is given below:      for <variable> in <sequence>:          statements to repeat

Basics of Python - 1

 Data types in Python Datatypes are the attributes or  group of specific characters in computer science which tells the compiler or the interpreter about the type of data in which the user want a specific character to be used. Whenever a specific datatype is mentioned by the user, the compiler or the interpreter converts the data to the specific type to be read by the computer. It plays a very vital role in the conversation between the computer and the programmer and without having sufficient types of data it would be really confusing to program any code at all.   The built-in core datatypes provided in Python are: String Numbers List Tuple Dictionary String A string datatype literally holds the actual string data (which may be letters, numbers or special symbols) inside "" or inside '' ,i.e. inside double or single quotation marks. For example: All the following strings are legal and acceptable in Python: "Hello","Holla",'I am great.'...