Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
29 views

Python - Final - Intern

The document provides an overview of the basics of Python programming language. It discusses that Python is an interpreted, high-level and object-oriented scripting language created by Guido van Rossum. It then covers some key features of Python like being easy to learn, cross-platform, free and open-source. The document also demonstrates a simple Python program and explains concepts like variables, data types, strings, comments, and functions in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Python - Final - Intern

The document provides an overview of the basics of Python programming language. It discusses that Python is an interpreted, high-level and object-oriented scripting language created by Guido van Rossum. It then covers some key features of Python like being easy to learn, cross-platform, free and open-source. The document also demonstrates a simple Python program and explains concepts like variables, data types, strings, comments, and functions in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

BASICS OF PYTHON

PRESENTED BY:
CHRISSI K PEREIRA
WHAT IS PYTHON?
Python is a simple, general purpose, high level, and object-oriented
programming language.

Python is an interpreted scripting language also. Guido Van Rossum is


known as the founder of Python programming.

It is used for:


web development,
software development,
mathematics,
system scripting.
FEATURES OF PYTHON
1) Easy to Learn and Use
2) Expressive Language
3) Interpreted Language
4) Cross-platform Language
5) Free and Open Source
6) Object-Oriented Language
PYTHON APPLICATION
MY FIRST PYTHON PROGRAM
PYTHON COMMENTS
Comments can be used to explain Python code.
Comments can be used to make the code more readable.

TWO TYPES OF COMMENTS: EXAMPLE


SINGLE LINE COMMENT MULTILINE COMMENT
PYTHON VARIABLES
Variables are containers for storing data values.
RULES FOR PYTHON VARIABLES
A variable name must start with a letter or the underscore character

A variable name cannot start with a number

A variable name can only contain alpha-numeric characters and


underscores (A-z, 0-9, and _ )

Variable names are case-sensitive (age, Age and AGE are three different
variables)

A variable name cannot be any of the Python Keywords.


RULES FOR PYTHON VARIABLES
PYTHON VARIABLES -ASSIGN MULTIPLE
VALUES
1. Many Values to Multiple Variables
Python allows you to assign values to multiple variables in one line:
PYTHON VARIABLES -ASSIGN MULTIPLE
VALUES
2. One Value to Multiple Variables
And you can assign same value to multiple variables in one line:
PYTHON-OUTPUT VARIABLES
The Python print() function is often used to output variables.

In the print() function, output multiple variables, separated by a


comma:
PYTHON-GLOBAL VARIABLES
Variables that are created outside of a function are known as global variables.

A function is a block of code which only runs when it is called.


PYTHON DATA TYPES
PYTHON NUMBERS
Number stores numeric values. The integer, float, and complex values
belong to a Python Numbers data-type.

Python provides the type() function to know the data-type of the


variable.
STRING
A “string” is a data type in Python, composed of a collection of
characters.
Strings in python are surrounded by either single quotation marks, or
double quotation marks.
'hello' is the same as "hello".
PYTHON SLICING
Specify the start index and the end index, separated by a colon, to return
a part of the string.

1. Slice From the Start


• By leaving out the start index, the range will start at the first character:
PYTHON SLICING STRINGS
2. Slice To the End
By leaving out the end index, the range will go to the end:

3. Negative Indexing
Use negative indexes to start the slice from the end of the string:
PYTHON MODIFY STRINGS
1. Upper Case : The upper() method returns the string in upper case.

2. Lower Case : The lower() method returns the string in lower case.


PYTHON MODIFY STRINGS
3. Remove Whitespace : The strip() method removes any whitespace from
the beginning or the end.
PYTHON STRING CONCATENATION

To concatenate, or combine, two strings you can use the + operator.
FORMAT STRINGS
Use the format() method to insert numbers into strings:
THANK YOU

You might also like