DEV Community

Benta Okoth
Benta Okoth

Posted on

Python Programming

Introduction To Python

-Python is the most popular programming language used globally for web development, Data Science, Machine Learning and Automation.
-Python codes are normally run using the print() keyword and the string should be in quotation(single or double quote) marks for example
print("Hello World !")
print('Hello World !')

  • Comments in python are denoted by # (harsh symbol).

It is one of the easiest to learning programming language and beginner friendly.

** Use Cases of Python in Data

  1. Automated Data Cleaning with Pandas library Exploratory Data Analysis(EDA) interactive Data Visualization Dashboard matplotlib.pyplot and seaborn. Web Scraping for Data Collection. Automating Model Training with Scikit-learn Pipelines. For Feature Engineering with Feature-engine. Automated hyperparameter Tuning with Optuna. Model Evaluation Report. Automating Dataset Versioning with DVC. Schedulinng and Monitoring Scripts with APScheduler.
  • Python can be accessed in different Programming Tools such as Google Colab VS Code (Virtual Studio Code) Juypter Notebook(On brower) Anaconda Command Line/Prompt.
  • Python Variables
  • A variable is a name that is assigned to a value and it is used to store data/ hold the data.
  • We have two types of variables ie user defined Data Types
  • Data Types - this is a way of classifying data items in python.
  • There are various data types in python namely: (i). Integer - Whole number data type, for example
    num = 20
    print(num)
    type(num) # checking the data type
Enter fullscreen mode Exit fullscreen mode

the word num is the variable used to store the value which is 20. print(num) returns the value of the variable.

(ii) Float - These are numeric data type that contain decimal places.
Example

   num = 20.5
   print(num)
   type(num)
Enter fullscreen mode Exit fullscreen mode

(iii) Boolean - These are True or False. The 1st letter is case sensitive.
For Example

   pen = True
   print(pen)
   type(pen)
Enter fullscreen mode Exit fullscreen mode

(iv) String - This is a word/text data type. Denoted by the quote during print
For example

    print("Hello world")
Enter fullscreen mode Exit fullscreen mode
  • Type Casting is the conversion of a variable from one data type to another. For example
     y = int(num)
Enter fullscreen mode Exit fullscreen mode

and Data Structures

Top comments (0)