ကဗ်ာ/ရသ/နည္းပညာ

Python Programming notes(Basic)

Feb 15, 2016

အခုေနာက္ပိုင္း ကြ်န္ေတာ့္အေနနဲ့ စဥ္းစားမိတာက programming tutorials ကိုသင္ျပေပးခ်င္ရင္
VDO အေနနဲ့သင္ေပးတာက ပိုထိေရာက္တယ္လို့စဥ္းစားမိလာတာ ..
စာအေနနဲ့အမ်ားျကီးရွင္းျပရေပမယ့္ တကယ္ေလ့လာတဲ့သူက နားမရွင္းတတ္ဘူး ..
ေပးတဲ့သူကလညး္နားလည္ေအာင္အမ်ိုးမ်ိုးရွင္းျပရင္းနဲ့ပဲ စာရွည္ျပီး ဘေလာ့ေနာက္တစ္ပုဒ္ျဖစ္သြားေရာ
ျပီးေတာ့ တခ်ို့အပိုင္းေတြမွာစာအေနနဲ့ေတာ္ေတာ္လက္ေပါက္ကပ္ပါတယ္ .
ဒါေျကာင့္ ေနာက္ပိုင္း ကြ်န္ေတာ္ေလ့လာတဲ့ Note  ကုိပဲျပပါမယ္ ... မရွင္းရင္ ေမးလို့ရပါတယ္ ..
facebook မွာဆိုရင္ Philip Macque ကုိအက္ထားလို့ရပါတယ္..

Python programming note ,
g=input("Please type any number here:")
Please type any number here: 3
g**3
27

pow(g,3)
27

import math
math.sqrt(9)
3.0

aungaung=math.sqrt
aungaung(9)
3.0

aungaung=math.floor
aungaung(9.9)
9.0

x=raw_input("Enter name:")
print "Hay" + x
raw_input("press<enter>")

num=str(18)
print "Bucky is "+ num
Bucky is 18

num2=18
print "Bucky is "+ `num2`
Bucky is 18

//input is only for numbers.
//raw_input is multy way data accept by string .
----------------------------------------------------
//Python called array , 'sequences'
family=['mon','dad','bro','sis','dog']
family[3]
'sis'
faimly[-2]
'sis'
'bucky'[3]
'k'
family[1:4:2]
['mon','sis']
---------------------------------------------------
>>> [7,4,5]+[4,5,6]
[7, 4, 5, 4, 5, 6]

>>> 'bucky ' * 10
'bucky bucky bucky bucky bucky bucky bucky bucky bucky bucky '

>>> 21*10
210
>>> [21]*10
[21, 21, 21, 21, 21, 21, 21, 21, 21, 21]

>>> name='roastbeef'
>>> 'x' in name
False
>>> 'r' in name
True

>>> number=[8,1,4,17,28,165,7]
>>> len(number)
7
>>> max(number)
165
>>> min(number)
1

>>> list('bucky')
['b', 'u', 'c', 'k', 'y']
>>> number[3]=77
>>> number
[8, 1, 4, 77, 28, 165, 7]
>>> del number[3]
>>> number
[8, 1, 4, 28, 165, 7]
>>>

>>> example=list('easyhoss')
>>> example[4:]=list('baby')
>>> example
['e', 'a', 's', 'y', 'b', 'a', 'b', 'y']

>>> example[1:1]=[3,3,3]
>>> example
['e', 3, 3, 3, 'a', 's', 'y', 'b', 'a', 'b', 'y']
>>> example[1:5]=[]
>>> example
['e', 's', 'y', 'b', 'a', 'b', 'y']
>>>
-------------------------------------(movie14)
//about the built-in functions/methods.........
>>> aung=[1,2,3,4]
>>> aung.append(5)
>>> aung
[1, 2, 3, 4, 5]

>>> aung.count(5)
1
>>> aung.append(5)//become [1, 2, 3, 4, 5, 5]
>>> aung.count(5)//result must two
2
>>>
>>> aung.count('a')//there haven't 'a' character
>>>

>>> philip=[1,2,3,4,5]
>>> macque=[6,7,8,9,0]
>>> philip.extend(macque)
>>> philip
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
>>>
-------------------------------------(movie15)
>>> say=['koko','bobo','dodo','momo']
>>> say
['koko', 'bobo', 'dodo', 'momo']
>>> say.index('bobo')
1
>>> say.insert(2,'MinMin')
>>> say
['koko', 'bobo', 'MinMin', 'dodo', 'momo']
>>> say.pop(1) //first "print-out the value" and then remove
'bobo'
>>> say
['koko', 'MinMin', 'dodo', 'momo']
>>> say.remove('dodo') //just remove form list
>>> say // if you want to show result you need to type again
['koko', 'MinMin', 'momo']
>>> say.reverse()
>>> say
['momo', 'MinMin', 'koko']
>>> 

No comments:

Post a Comment