Basics of Python for Data Science — Part Two

Aditya Daria
3 min readApr 17, 2022

I have covered Python Basics — Part One here so if you have not read it already please do before you go through this article.

Bitwise Operators :

Bitwise Operators

Built-in functions :

  • Python comes loaded with pre-built functions
  • Conversion from hexadecimal to decimal is done by using built-in hex( ), Octal to a decimal using the built-in function oct( ).
  • int( ) can also be used to get only the integer value of a float number or can be used to convert a number which is of type string to integer format. Similarly, the function str( ) can be used to convert the integer back to string format
  • Also note that function bin( ) is used for binary and float( ) for decimal/float values. chr( ) is used for converting ASCII to its alphabet equivalent, ord( ) is used for the other way round.

Simplifying Arithmetic Operations :

  • round( ) function rounds the input value to a specified number of places or to the nearest integer.
  • divmod(x,y) outputs the quotient and the remainder in a tuple(you will be learning about it in the further chapters) in the format (quotient, remainder).
  • isinstance( ) returns True if the first argument is an instance of that class. Multiple classes can also be checked at once.
  • pow(x,y,z) can be used to find the power y over x also the mod of the resulting value with the third specified number can be found i.e. : (xy % z).
  • range( ) function outputs the integers of the specified range. It can also be used to generate a series by specifying the difference between the two numbers within a particular range. The elements are returned in a list (which will be discussed in detail later.)
  • input( ) accepts input and stores it as a string. Hence, if the user inputs an integer, the code should convert the string to an integer and then proceed.
round, divmod, isinstance, pow
range, and accepting user inputs

Next, we will talk about print statements in python. Also, we will begin learning about Lists, Tuples, and sets.

For any suggestions/feedback please comment. If you liked the article please consider the following and subscribe using my link.

--

--