Python for Beginner

in #python9 years ago

0x01:Ultimate Python ( Printing,Data type,Operation,Variable)

Welcome to First Charater of Ultimate Python လို႔ဘဲ ​ေခၚလိုက္​ၾကရ​ေအာင္​......

အရင္​ဆံုး ဒီသင္​ခန္​းစာကို မစခင္​မွာ ကြၽန္​​ေတာ္​တို႔

  1. Python Script ​ေတြ ဘယ္​လို Run ၾကရမလဲ.... Ok သြားၾကရ​ေအာင္​.. 😁😁

ဒီ​ေတာ့ U want to write a program hun? ...ၾကည္​့ၾကရ​ေအာင္​..... အရင္​ဆံုး program တစ္​ခုကို ​ေရး​ေတာ့မယ္​ဆိုရင္​

1.Gets input from the user
2.Processes the input with some magic
3.Displays output....

ဆိုတာ ဂို သိထားရမယ္​....
ဟုတ္​ၿပီ ဒါဆို ကြၽန္​​ေတာ္​က ​ေနာကိဆံုး ျဖစ္​တဲ့ Display Output ဆိုတဲ့ အခနိးက​ေန စသြားရ​ေအာင္​ 😉

Display Output

စ​ေရးလိုက္​ၾကရ​ေအာင္​ pytgon is cool ဆိုတဲ့ စာသားကို... ဘယ္​လို​ေရးရမလဲဆို​ေတာ့

print 'python is cool'

ဒီ Code ဟာဆို python is cool ဆိုတဲ့ စာသားကို print ထုတ္​​ေပးတယ္​ ဆိုတာ သိရလိ္​မ္​့မယ္​..... So Right? ဟုတ္​ရဲ႕လား... ​ေမးခြန္​းထုတ္​စရာဘဲ....
Right! ထုတ္​​ေပးတယ္​ ဆိုတာ ​ေတြ႔ရလိမ္​့မယ္​..... ဒီ​ေနရာမွာ ​ေျပာခ်င္​တာက ကြၽန္​​ေတာိတို႔ ဟာ print ထုတ္​ခ်င္​တယ္​ ဆိုရင္​ စာ​ေတြဟာ string ​ေတြ ျဖစ္​တာ​ေၾကာင္​့ ‘ (single quotes) ႏွင္​့ ” (double quotes) ကို အဖြငိ့အပိတ္​မွာ သံုး​ေပးရလိမ့္​မယ္​...

ဟုတ္​ၿပီ ဒါဆို print 2 ​ေၾကာင္​း ​ေရးၾကည္​့လိုက္​ရ​ေအာင္​ ဗ်ာ...

print 'Python is cool'
print 'and its easy too'

ဒါဆို print 2 ​ေၾကာင္​းထုတ္​​ေပးတာ ​ေတြ႔ရလိမ္​့မယ္​... ဟုတ္​ၿပီ ဒါဆို ဒီ ၂ ​ေၾကာင္​းကို တစ္​​ေၾကာင္​းတည္​းဘဲ ​ေရးလို႔ မရဘူးလားဆို​ေတာ့ ​ေရးလို႔ရပါတယ္​ ဘာလိုလဲဆို​ေတာ့ \n ဆိုတာ​ေလးနဲ႔ တြဲ​ေရး​ေပးရလိမ္​့မယ္​....

print 'Python is cool\nand its easy too'

ဒါဆို print တစ္​​ေၾကာင္​းတည္​း နဲ႔ ​ေရးလိုရတယ္​ ဆိုတာ သ​ေဘာ​ေပါက္​မယ္​ လို႔ထင္​ပါတယ္​... တခုခု ကို ​ေနာက္​တစ္​​ေၾကာင္​း ဆင္​း​ေရးခ်ငိတယ္​ ဆိုရင္​ \n ​ေလးကို အသံုးျပဳ​ေပးလိုက္​ရပါတယ္​...ဒိမွာ ​ေျပာခ်င္​တာက \n ဆိုတာကို Computer က ဘယ္​လို သိတာလဲ? ...ဘာလို႔ \n ​ေလးကို ​ေရးဖို႔လိုတာလဲ... ဟုတ္​ၿပီ ဒါကို ဆက္​႐ွင္​းျပမယ္​​ေနာ္​...

Python is interpreter Language ျဖစိလို႔ဘဲ.... ဆိုလိုတာ က ကြၽန္​​ေတာိတို႔က ကြၽန္​​ေတာိတို႔ Program ကို ဘာ further process မွာ မလိုဘဲ Run လို႔ရလို႔ဘဲ... Interpreter ဆိုတာကလည္​း program ကို ဖတ္​ခ်င္​တာဘဲ ျဖစ္​ျဖစ္​ ​ေျဖခ်ခ်င္​တာဘဲျဖစ္​ျဖစ္​ အကုန္​လံုးကို ဒီထဲမွာဘဲ ​ေရးလို႔ရတယ္​ ဆိုတာပါဘဲ...

​ေနာက္​တခုက Interger, interger ဆိုတာ အ​ေျခခံအားျဖင္​့ Number ​ေတြ​ေပါ့ ဥပမာ... 1,2,3,44,22 ဆိုတာ​ေတြက interger ​ေတြ​ေပါ့... decimal number ​ေတြက်​ေတာ့ float လို႔​ေခၚျပန္​​ေရာ..ဥပမာ....22.45,33.55 လိုမ်ိဳး​ေပါ့ ဒႆမ ဂဏန္​း​ေတြ​ေပါ့..... interger နဲ႔ float ​ေတြကိုက်​ေတာ့ single query, double query ​ေတြ မပါဘဲrun လို႔ရတာဘဲ....

print 1234

ဟုတ္​ၿပီ ဒါဆို data type ​ေတြ ျဖစ္​တဲ့ string,interger,float ​ေတြကို သိရၿပီ​ေပါ့... ဆက္​​ေလ့လာရ​ေအာင္​...

ဒီတခါ​ေတာ့ number နစ္​ခုကို ​ေပါင္​းမယ္​ interger 2 ခုကို ​ေပါင္​းမယ္​​ေပါ့....(13,34)

print 13+34

ဒိလိုဘဲ ​ေပါင္​း​ေပးလိုက္​ရံုဘဲ လြယ္​လြယ္​​ေလး​ေပါ့
Operation 4 ခု ႐ွိတယ္​ ဒါ​ေတြက

  • = add (​ေပါင္​းျခင္​း)
  • = subtration (ႏႈတ္​ျခင္​း)
  • = multiplation (​ေျမာက္​ျခင္​း)
    / = division (စားျခင္​း)

ဟုတ္​ၿပီ​ေနာ္​ ကဲ့ ဒါဆို i am best ကို ငါ​း​ေၾကာင္​း​ေရးၾကည္​့မယ္​ဆိုရင္​​ေရာ ဘယ္​လို​ေရးမလဲ.... very easy!

print 'i am beat\n' *5

i am best ဆိုၿပီး ငါး​ေၾကာင္​းျဖစ္​​ေနတာ ​ေတြ႔ရလိမ္​့မယ္​... ဟုတ္​ၿပီ ဘာ​ေၾကာင္​့ \n သံုးရလဲဆိုတာ သ​ေဘာ​ေပါက္​မွာပါ​ေနာ္​ အ​ေပၚမွာ ႐ွင္​းျပထားပါတယ္​ နားမလည္​ရင္​ ျပန္​ဖတ္​​ေပးပါ..

1.firat program ​ေအာက္​က စာမ်ိဳး​ေပၚ​ေအာင္​ဘယ္​လို​ေရးမလဲ..

I am the best person.
You are the worst person.
I am the best person.
You are the worst person.
I am the best person.
You are the worst person.

ဒီလိုမ်ိဳးဆိုရင္​ ကြၽန္​​ေတာ္​တို႔က variable ​ေတြကို အသံုးျပဳရပါ​ေတာ့မယ္​ ခင္​ဗ်ာ..
ဘယ္​လိုလဲဆို​ေတာ့..

me = 'I am the best person'
you = 'You are the worst person'
print me
print you
print me
print you
print me
print you

ဒီလိုမ်ိဳး​ေရးရပါ​ေတာ့တယ္​.... me = I am the best person ဆိုၿပီ me ကို variable သတ္​မွတ္​​ေပးရပါ​ေတာ့တယ္​ ​ေနာက္​တခု​ေလ့လာၾကည္​့ရ​ေအာင္​.
Interger ​ေတြ သံုးၿပီး​ေတာ့​ေပါ့..

a = 30
b = 50
print a+b

ဆို​ေတ့ာ print ထုတ္​​ေပးမွာသည္​ 80 ​ေပါ့ ဒါ variable ကို ဘယ္​လိ ုသံုးရတယ္​ ဆုိတာ သ​ေဘာ​ေပါက္​မွာပါ..
Basic အ​ေနနဲ႔ ဒီ​ေလာက္​ဆို သ​ေဘာ​ေပါက္​နားလည္​ႏိူင္​မယ္​လို႔ ထင္​ပါတယ္​.... ​ေနာက္​ သင္​ခန္​းစာ​ေတြ ဆက္​​ေလ့လာၾကရ​ေအာင္​
Author #Bl03K_C0D3R
10.12.2017

Sort:  

Congratulations @omicronjohn! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.077
BTC 65909.61
ETH 1720.47
USDT 1.00
SBD 0.42