What is Python and Python Functions.?

Python is open source, case sensitive language, support for other libraries, portable.

Python is an interpreted (Python does not need to be compiled before it is run), dynamically typed (like a=222 and then a="I'm a QA").

Python does not have access specifiers in class & Class is first object (It can be assigned to variables, returned from other functions, and passed into functions).

PEP stands for Python Enhancement Proposal with Its rule.

Python has 4 namespace (Built In, Global, Local & Enclosing). & Build in Data type like Set, List & tuple. Tuple is faster than List & list is mutable and Tuple is immutable.

.PY and .PYC File: The .py files are the python source code files. While the .pyc files contain the bytecode of the python files.

functions in Python:

Function 1: Function without datatype

def Function():

print(“Welcome to Geeksfortesting”)

Function(); #calling the function

Output: Welcome to Geeksfortesting

Function 2: Function with defined datatype

def Function(var):

  print(var)

Function(“Geeks”)

Function 3: Function with defined datatype & value

def Function(var):

  print(var)

Function(var=“Geeks”)

Function 4: Function with undefined datatype

def Function(*var):

  print(var)

Function(“Geeks”,”Testing”)

Function 5: Function with datatype as List

def Function(var):

 for n in var:

 print(n)

  city= [“A”,”B”,”C”]

Function(city)

Share on

There are no comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Start typing and press Enter to search

Shopping Cart

No products in the cart.