0% found this document useful (0 votes)
3 views

Slide 1 Introduction

Uploaded by

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

Slide 1 Introduction

Uploaded by

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

GETTING STARTED WITH PYTHON

MICHEAL OGUNDERO
EMAIL – [email protected]
INTRODUCTION
WHY LEARN ENGINEERING COMPUTING?

1. Problem Solving and Analysis


2. Innovation and Design
3. Adaptability to Trending Technologies
4. Career Preparedness
CAREERS WITH PYTHON

1. Web Development
2. Data Science
3. Game Development
4. Scientific Computing
5. Cybersecurity
INTEGRATED DEVELOPMENT ENVIRONMENT

These are software applications that provide tools to programmers for software
development.
Some Examples are:
1. Visual Studio Code
2. PyCharm
3. Atom
4. PyDev
5. SpyDer
Some are also available for use on smart phones.
FEATURES OF PYTHON PROGRAMMING LANGUAGE

1. Simple and Readable Syntax


2. Extensive Standard Library
3. Cross-Platform
4. Large Community
5. Dynamically Typed
INTRODUCTION: DATA TYPES AND FUNCTIONS

Functions…
The general syntax to execute a function is

functionName ( parameters )
Now let’s try out one.

type(10)
the function ‘Type’ returns the data type of the parameter.
Also try

type(‘Hey you’)

type([3, 5,9])
INTRODUCTION: DATA TYPES AND FUNCTIONS

Functions…
• Strings and lists are both sequences of parts (characters or elements).
• We can find the length of that sequence with another function with the abbreviated name len.

len([1, 2, 3])

len('abcd')

• Some functions have no parameters, so nothing goes between the parentheses.

list()

max(5, 11, 2)

• Max is short for maximum


PRINT FUNCTION

• The print function will print as strings everything in a comma-separated sequence of expressions, and it
will separate the results with single blanks, and advance to the next line at the end, by default

x=3
y=5
print('The sum of', x, 'plus', y, 'is', x+y)

• You can also use it with no parameters:

print()
• This takes you to the next line
INTRODUCTION: DATA TYPES AND FUNCTIONS

Functions…
• Some of the names of types serve as conversion functions

str(23)

int('125')
ARITHMETIC OPERATORS

Basic Arithmetic Operators:

1. + Addition
2. - Subtraction
3. * Multiplication
4. / Division
5. % Mod (the remainder after dividing)
6. ** Exponentiation (note that ^ does not do this operation, as you might have seen in other
languages)
7. // Divides and rounds down to the nearest integer

The usual order of mathematical operations holds in Python.


ARITHMETIC OPERATORS

Addition and Subtraction


• We start with the integers and integer arithmetic, not because arithmetic is exciting, but because the
symbolism should be mostly familiar.
• Python understands numbers and standard arithmetic
5+4
• Multiplication, Parentheses and Precedence

2*3
• Python uses the normal precedence of arithmetic operations: Multiplications and divisions are done
before addition and subtraction, unless there are parentheses.
Division and Remainders
• Python uses the doubled division symbol // for the operation that produces just the integer quotient,
and introduces the symbol % for the operation of finding the remainder.

5/2
5//2
5%2
EXERCISE

1. My electricity bills for the last three months have been $23, $32 and $64. What is the average
monthly electricity bill over the three month period? Write an expression to calculate the mean, and
use print() to view the result.
2. Two parts of a floor need tiling. One part is 9 tiles wide by 7 tiles long, the other is 5 tiles wide by 7
tiles long. How many tiles are needed?

You might also like