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

Python Introduction

This document discusses Python programming language. It explains what Python is, its features, how to install and set up the Python IDLE environment. It also demonstrates the use of print function to display output and discusses interactive and script modes of Python IDLE. The document contains examples of writing simple Python programs to print messages and patterns.

Uploaded by

bunnik3nma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Python Introduction

This document discusses Python programming language. It explains what Python is, its features, how to install and set up the Python IDLE environment. It also demonstrates the use of print function to display output and discusses interactive and script modes of Python IDLE. The document contains examples of writing simple Python programs to print messages and patterns.

Uploaded by

bunnik3nma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Python - Introduction

Diagnostic Test
1. Python is a ________ level programming language.
a) Low-level b) Assembly c)High-level
2. What is the name of the environment in Python that write your programs
and then test them out.
a) Shell b) IDLE c) Window
3. ___________ function in python show output on screen.
a) input b) print c) put
4. _________ data type is used to store and represent text-based
information.
a) int b) float c) string
5. ___________ are used to store data in the memory.
a) variables b)keywords c)identifiers
Python - Introduction
Diagnostic Test(Answers)
1. Python is a ________ level programming language.
a) Low-level b) Assembly c)High-level
2. What is the name of the environment in Python that write your programs
and then test them out.
a) Shell b) IDLE c) Window
3. ___________ function in python show output on screen.
a) input b) print c) put
4. _________ data type is used to store and represent text-based
information.
a) int b) float c) string
5. ___________ are used to store data in the memory.
a) variables b)keywords c)identifiers
Python, IDLE and your first program
Learning Objective:
Understand about programming language and Python

Understand how to setup Python IDLE.

Use the print function successfully.


KWL CHART

I know program is writing instructions for the computer.


K I know there are many different types of languages.
Python is a programming language

W I want to learn how to write a program in Python IDLE

L
Python-
Keywords: Introduction
1. Programming language
2. IDLE
3. Python Shell
4. Interactive mode
5. Script mode
6. print()
7. Syntax error
8. Prompt - >>>
What Is Python?

Python is a programming language.

It was created by Guido van Rossum and was first

released on February 20,1991.

It was named after comedy group ‘Monty Python’.


Features of Python
Python is a high-level programming language.
It is an open source language.
It runs well on different platforms(Windows, Linux
and Macintosh). So, it is a portable language.
Python is a case-sensitive language.
It is an interpreted language (i.e) it executes the
code line-by-line.
The python program is saved as .py extension.
Downloading/Installing
Python
• Visit the link https://www.python.org/downloads/ to download the
latest release of Python.

Step - 1: Select the Python's version to download.


Downloading/Installing
Python
Step - 2: Click on the Install Now

Step - 3 Installation in Process


Getting Started With
Python
IDLE - Integrated Development Environment.
o Python IDLE is the most popular graphics-based development
environment for Python.
o It is used to create and run our Python programs.
Python Shell
Getting Started With
Python
• The window that first appears when you start Python IDLE
is called the Interactive mode window.
• It has three greater-than signs (>>>) called the prompt.
Interactive mode and Script mode
• From the Interactive mode window, we can click on
the File menu item, and then select New File.
• This opens a new Script mode window.

Interactive Script
Interactive mode vs Script
Interactive modemode Script mode
Suitable for small programs and for Suitable for large programs and for
beginners experts
Code cannot be saved and used in Code can be saved and can be used
the future. in the future.
We get output for every single line Entire program is first compiled and
of code  then executed.
Print()
 Print() function is used to display information to the
user, you must use the print command.
 You must ALWAYS open and close the PARANTHESIS.
Syntax error
Syntax Error: When you break the rules of the
programming language.

Identify the syntax error for the below code:

• Print(“Welcome Tom”)

• print(“Football”

• print(Dancing)
Incorrect code Correct code

• Print(“Welcome Tom”) print(“Welcome Tom”)

• print(“Football” print(“Football”)

• print(Dancing) print(“Dancing”)
My first Program
Program 1: The computer must display the words

HELLO WORLD
The code for this is:

The print() function prints information onto the screen.


My first Program
Program 1: The computer must display the words

HELLO WORLD
The code for this is:

Interactive Script

The print() function prints information onto the screen.


Things to Remember
Some important things to notice:
• Always remember to use the (brackets) with print.
• We also used “quotes” because we were printing text.

• print is purple because IDLE recognises print as a Python command.


• “Hello World” is green because it is a string of text (more on this later).
• The printed output is usually blue.
Self-Assessment
1. Which of the following four pieces of code has the correct
SYNTAX?
1. Print (“Hello world!”)
2. print (“Hello world!”)
3. Print (Hello world!)
4. Print “Hello world!”
2. Python is an __________language that executes the code line-by-
line at a time.
3. The python program is saved in ____________ extension.
4. The python program is written in ___________ environment.
5. >>> is called as __________
LAB ACTIVITY
1. Write a short message to your friend.
2. Display your name, your age and your gender on 3 separate
lines.
3. Print the following pattern using python(script mode).
Self Assessment-Answers
1. Which of the following four pieces of code has the correct
SYNTAX?
1. Print (“Hello world!”)
2. print (“Hello world!”)
3. print (Hello world!)
4. Print “Hello world!”
2. Python is an interpreted language that executes the code line-by-
line at a time.
3. The python program is saved in .py extension.
4. The python program is written in IDLE environment.
5. >>> is called as Prompt

You might also like