DEV Community

Mathu varshtih
Mathu varshtih

Posted on Edited on

Python Introduction: Data types, Function,Loop

Python Introduction

1. Basic Data Types

  • int – Integer numbers (10, 20)
  • float – Decimal numbers (10.5, 20.5)
  • str – String ("Hello")
  • bool – Boolean values (True, False)

2. Functions

  • A function is a reusable block of code.
  • def keyword is used to create a function.
  • Parameters are used to pass values into a function.
  • return is used to return a value from a function.

3. Loops

  • for loop – Used to iterate over a sequence.
  • while loop – Executes repeatedly as long as the condition is True.

Top comments (0)