Friday, 30 January 2015

Python 3.4.2 part 2.1 printing hello tutorial

  1. cmd

       

cd /python34
python helloworld.py



  1. Notepad

       
       

print("helloworld")
  1. cmd

       
       
       

python helloworld.py








Sunday, 25 January 2015

Python 3.4.2 Part 5 Using input tutorial

>>> x=input("Enter a string")
Enter a string ayman
>>> x
' ayman'
>>> y=input("Enter your name: ")
Enter your name: Ayman
>>> x
' ayman'
>>> y
'Ayman'
>>> x=input("Enter a string")
Enter a string5
>>> x
'5'
>>> y=int(input("Enter a number"))
Enter a number8
>>> y
8
>>> y+int(x)
13



Now why we got an error in y+x??
please comment the reason

Python 3.4.2 Part 4 Using Variables tutorial

Storing a number to x


       

x=10
        
    


       

x+20
        
    


Storing string

       

x="mams"
        
    


       

x+" "+"Python"
        
    


Now adding a number with string variable must type cast to int
eg
x=100
y="10"
to add x and y we should convert y to a number

type casting (Converting string to number)

       

x+int(y)
        
    



python 3.4.2 Part 3 maths tutorial

To Add two number simply type

       

5+8
        
    

To Subtract
       

5-9
        
    
To Divide
       

8/3
        
    


To Mutiplication

       
8*9
        
    


To get power of X^n
eg: 2^50
       

2**50
        
    

or
       

pow(2,50)
        
    


Now check these examples

1.8/3

2.8//3 (check the decimals)

3.3+4+5*9+8/4 (order is PEMDAS, if you dont know this check it google)

Python 3.4.2 part2 printing hello tutorial

Goto start menu then click python command line
or 
Goto start menu then click python GUI


now type
       

print ("hello")
        
    

press enter


out put

Python 3.4.2 part1 installation tutorial

1.Goto this https://www.python.org/downloads/ site and download python 3.4.2 or for windows click this

https://www.python.org/ftp/python/3.4.2/python-3.4.2.msi





2.Install it