Basics in Python
‫إعداد‬:
‫م‬.‫محمد‬ ‫علي‬
What is Python?
• It is a high level programming language, it is simple to write and read.
• It is a human readable
• It use for all thing …. Like (desktop programming – Web Application
programming – Mobile Programming - Artificial Intelligence – computer
hardware …etc.)
• Object oriented programming – open source.
Why Python?
• Easy to learn.
• You can do any thing using it.
• Just when you know the basics you can write any program.
• Simple data types.
• Very simple syntax.
• No semicolons (;)
Data types
• There is no a lot of datatypes in python:
• Int
• Float
• String
• That’s it
• Any variable is in one of this data types.
Print command
• It is used for print
• It’s syntax is ( print(thing I want to print) )
• Just in this simple.
• We can use (‘ ‘) or (“ “) for printing the string
• We just put variable name for printing it’s value
• We can use (,) or (+) to print more than one value.
Print command examples
• print(‘hello world’)
• print(“Hello world”)
• The difference here if we want to print this string (‘My name’s Ali’).
• This will give an error.
• To remove the error we must write like this print(“my name’s Ali”).
Print command example
• We can use print command for some math operators like (+ , - , * ,/)
• So we can simple write: print(3+4)
• Or write: print(4-1)
• Or write: print(4/2)
• Or write: print (4*2)
• Or write: print (4%2)
Variables in Python
• We just put name and value we don’t have to put data type
• Just like this:
x=5
• If we write x or print(x) the result will be: 5
• We can know the type of x if we write: print(type(x))
• The result will be <class ‘int’>
Print command example
• In all programming language we cann’t write command like (“x”*5)
• But in python we can
• If we write: print(“x”*5) the result will be:
• xxxxx
• But we cann’t write (“x”+5) because x is a string and 5 is an int
• We will solve this problem latter.
End of first session
Any Question
Thank you

First session

  • 1.
  • 2.
    What is Python? •It is a high level programming language, it is simple to write and read. • It is a human readable • It use for all thing …. Like (desktop programming – Web Application programming – Mobile Programming - Artificial Intelligence – computer hardware …etc.) • Object oriented programming – open source.
  • 3.
    Why Python? • Easyto learn. • You can do any thing using it. • Just when you know the basics you can write any program. • Simple data types. • Very simple syntax. • No semicolons (;)
  • 4.
    Data types • Thereis no a lot of datatypes in python: • Int • Float • String • That’s it • Any variable is in one of this data types.
  • 5.
    Print command • Itis used for print • It’s syntax is ( print(thing I want to print) ) • Just in this simple. • We can use (‘ ‘) or (“ “) for printing the string • We just put variable name for printing it’s value • We can use (,) or (+) to print more than one value.
  • 6.
    Print command examples •print(‘hello world’) • print(“Hello world”) • The difference here if we want to print this string (‘My name’s Ali’). • This will give an error. • To remove the error we must write like this print(“my name’s Ali”).
  • 7.
    Print command example •We can use print command for some math operators like (+ , - , * ,/) • So we can simple write: print(3+4) • Or write: print(4-1) • Or write: print(4/2) • Or write: print (4*2) • Or write: print (4%2)
  • 8.
    Variables in Python •We just put name and value we don’t have to put data type • Just like this: x=5 • If we write x or print(x) the result will be: 5 • We can know the type of x if we write: print(type(x)) • The result will be <class ‘int’>
  • 9.
    Print command example •In all programming language we cann’t write command like (“x”*5) • But in python we can • If we write: print(“x”*5) the result will be: • xxxxx • But we cann’t write (“x”+5) because x is a string and 5 is an int • We will solve this problem latter.
  • 10.
    End of firstsession Any Question Thank you