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

Python Introduction

Uploaded by

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

Python Introduction

Uploaded by

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

HOUSE RULES

NO FOOD OR DRINKS NEAR THE COMPUTERS.

HANDLE ALL EQUIPMENT WITH CARE.

SAVE YOUR WORK REGULARLY.

ASK FOR HELP IF YOU ENCOUNTER ANY ISSUES.


LESSON RECAP

What is a programming language?

What is the difference between high-level and


low-level languages?
PYTHON
PROGRAMMING
OBJECTIVES
1. UNDERSTAND THE HISTORY AND FEATURES OF PYTHON
2. UNDERSTAND AND USE PYTHON'S BASIC SYNTAX
3. DECLARE AND INITIALIZE VARIABLES
4. UNDERSTAND PYTHON DATATYPES AND IT’S USES
PYTHON
a versatile, high-level programming language known
for its simplicity and readability, making it ideal for
beginners and experienced programmers alike.
Created by Guido Python's name was inspired by
van Rossum and first the British comedy series
released in 1991. "Monty Python's Flying Circus."
FEATURES OF PYTHON
Computer programs
that provide a visual
means for users to
interact with an
underlying
Easy for humans to application or
read and write system.

EASY TO GUI
HIGH-LEVEL
LEARN & PROGRAMMING
LANGUAGE
DEBUG SUPPORT
FREE AND OPEN SIMPLE OBJECT
SOURCE SYNTAX ORIENTED

Refers to software Refers to the set of A programming


that is both free to rules and method based on the
use, modify, and conventions that concept of objects,
distribute, and whose dictate how a code which can contain
source code is should be written. data and code.
openly available for
anyone to inspect,
enhance, and share.
HOW TO INSTALL
PYTHON IN WINDOWS?
1. Visit this website https://www.jetbrains.com/pycharm/download/?section=windows and browse
for PYCHARM COMMUNITY EDITION IDE or Integrated Development Environment .
2. Once you have downloaded the installer, open the pycharm-community-2024.1.3.exe file, by
double-clicking it to launch the installer. Click next, select the version you want to install by
checking the checkbox.
3. Run the installer and follow the wizard steps.
4. Mind the following options in the installation wizard:
64-bit launcher: Adds a launching icon to the Desktop.
Open Folder as Project: Adds an option to the folder context menu that will allow opening the
selected directory as a PyCharm project.
.py: Establishes an association with Python files to open them in Alvarado
Lorna PyCharm.
Add launchers dir to the PATH: Allows running this PyCharm instance from the Console without
specifying the path to it.
5. To run PyCharm, find it in the Windows Start menu or use the desktop shortcut.
PYTHON BASIC
SYNTAX
print(“Hello, World!”)
print(): print is a built-in Python function used to display output
to the console or terminal.
"Hello, World!": This is a string literal enclosed in double quotes.
It's the content that print() will display.
PYTHON BASIC
SYNTAX
x = input(“Enter your name: ”)
input(): This is a built-in Python function that waits for the user to type
something and press Enter. The function then returns the text that the user
typed as a string.
"Enter your name: ": This is a string passed to the input() function as an
argument. It's displayed as a prompt to the user, letting them know what kind
of input is expected.
x =: This is the assignment operator. It assigns the value returned by input()
to the variable x.
PYTHON VARIABLES
variables are nothing but simple containers to
store data of different types like numbers,
strings, boolean, chars, lists, tuples, ranges, etc.

RULES FOR PYTHON VARIABLES


Here are some of the rules mentioned that you
must consider before naming a Python variable:

A Python variable name must start with a letter or the


underscore character.
A Python variable name cannot start with a number.
A Python variable name can only contain alpha-numeric
characters and underscores (A-z, 0-9, and _ ).
Variable names in Python are case-sensitive (name,
Name, and NAME are three different variables).
The reserved words (keywords) in Python cannot be
used to name the variable in Python.
PYTHON DATATYPES

Data Type Code

Integer (int) represents whole numbers without decimals. x = 20

Float (float) represents numbers with decimal points.


x = 20.1
It can be used to represent measurements.
String (str) represents a sequence of characters or
x = “Hello World!”
alphabets. It can be used to store text-based information.
Boolean (bool) represents two possible values: True or
x = True
False. It deals with only true or false.
PYTHON DATATYPES
Data Type Code
List is an ordered collection of items. It can be used to store multiple
values of different data types. It can contain different things, such as x = ["apple", "banana", "cherry"]
numbers, words, or even other lists.

Tuple is similar to a list but is immutable, meaning its elements


x = ("apple", "banana", "cherry")
cannot be changed once defined.

Dictionary is an unordered collection of key-value pairs. It is useful


x = {"name" : "John", "age" : 36}
for storing and retrieving data using specific keys.

Set is an unordered collection of unique elements. It is a data type


that allows storing multiple values but automatically eliminates x = {"apple", "banana", "cherry"}
duplicates.
ACTIVITY: BASIC PYTHON VARIABLES
AND PRINT
Write the following code:
my_name = “Your Name”
my_age = 20

print(“Hello, my name is”, my_name)


print(“I am”, my_age, “years old”)

Create a small script that takes user input


for name, age, and favorite color, then prints
a message using the input values.
THANK YOU

You might also like