Python/C3/Basic-datatypes-and-operators/Tamil

From Script | Spoken-Tutorial
Revision as of 02:17, 21 April 2013 by Sanmugam (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
0:01 Hello friends! tutorial க்கு நல்வரவு! 'Basic Data types மற்றும் operators' in Python.
0:07 இந்த டுடோரியலின் முடிவில் உங்களால் பின் வருவனவற்றை செய்ய முடியும்.
  1. Python இல் Datatype களை அறிவது
      • Numbers
      • Boolean
      • Sequence
  1. Python இல் Operators களை அறிவது
      • Arithmetic Operators
      • Boolean Operators
  1. Python Sequence Data type களை அறிவது
      • list
      • string
      • tuple
0:28 முதலில் நாம் domain of number களில் python data structure களை காண்போம்.
0:34 python இல் மூன்று built-in data type கள் number களை represent செய்ய உள்ளன.
0:38 அவை:
  • int
  • float
  • complex
0:43 நாம் முதலில் நம் ipython interpreter ஐ invoke செய்யலாம்.
0:48 ஆகவே terminal லில் type செய்க: ipython ; பின் என்டர் செய்க
0:52 முதலில் int பற்றி பேசலாம்.
0:54 ஆகவே type செய்க: a=13
0:59 பின் type செய்க: a மற்றும் நீங்கள் output காணலாம்.
1:03 இப்போது, நாம் நம் முதல் int variable a ஐ வைத்துள்ளோம்.
1:07 நாம் இப்போது பார்க்கலாம்...
1:08 command இல் type செய்க: type ..within brackets a .. பின் நாம் output int ஐ பார்க்கலாம்.
1:17 இதன் பொருள் 'a' என்பது int இன் ஒரு வகை.
1:22 வித்தியாசமான வழிகளில் கையாள, int datatype உடன் தொடர்புள்ள நிறைய functionகள் உள்ளன.
1:30 இவற்றை காண நாம் செய்ய வேண்டியது, a dot tab
1:40 int datatype எந்த size integers ஐயும் வைத்திருக்க முடியும். இதை ஒரு உதாரணத்தால் பார்க்கலாம்.
1:48 ஆகவே type செய்க: b= சில ஒன்பதுகள்.... அல்லது ஏதோ data, பின் type செய்க: b ...பின் output ஐ பாருங்கள்.
2:02 நீங்கள் பார்ப்பது போல, நாம் 20 முறை 9 என மதிப்பு இட்டாலும் python புகார் செய்யவில்லை.
2:12 இது ஏனெனில் python இன் int data-type எந்த அளவு integers ஐயும் வைத்துக்கொள்ளும்.
2:17 நாம் இப்போது float data வகையை பார்க்கலாம்.
2:21 python இல் Decimal numberகள் float data வகையால் represent செய்யப்படுகின்றன.
2:25 type செய்க: p = 3 point 141592, பின் type செய்க: p.
2:41 நீங்கள் p இன் output value p ஆகவே இல்லை.
2:48 இது ஏனெனில் computer floating point value க்களை ஒரு குறிப்பிட்ட format இல் வைத்துக்கொள்ளும்.
2:54 எப்போதுமே ஒரு approximation இருக்கும்.
2:57 இதனால்தான் நாம் ஒரு program இல் floating point number களின் equality ஐ நம்பக்கூடாது.
3:05 list இல் கடைசி data type .. complex number
3:09 type செய்க: c = 3 point 2 plus 4 point 6j
3:18 இது இரண்டு floats களின் combination, imaginary part ஐ j notation define செய்கிறது, i அல்ல.
3:25 Complex numbers க்கு specific ஆன functions நிறைய உள்ளன.
3:29 நாம் அவற்றை பார்க்கலாம்.
3:31 type செய்க: c dot tab, ஆகவே output கிடைக்கிறது.
3:37 சிலவற்றை முயற்சி செய்யலாம், c.real ; பின் c.img
3:49 c.real தருவது number இன் real part மற்றும் c.imag தருவது imaginary.
3:56 நாம் absolute value ஐ function abs within bracket c ஆல் பெறலாம்.
4:06 video வை இங்கே நிறுத்தி பயிற்சியை செய்து முடித்து பின் தொடரவும்.
4:15 3+4j இன் absolute value ஐ கண்டுபிடிக்கவும். <pause> solution க்கு terminal க்கு போகலாம்.
4:27 type செய்க: abs within bracket 3+4j
4:34 இப்படியாக நாம் expression இன் absolute value ஐ பெறுகிறோம்.
4:37 நாம் அதே போன்ற இன்னொரு exercise ஐ செய்வோம்.
4:39 video வை இங்கே நிறுத்தி பயிற்சியை செய்து முடித்து பின் தொடரவும்.
4:45 number 999999999999999999 இன் datatype என்ன? அது int இல்லை?
5:00 solution உங்கள் screen இல் உள்ளது
5:02 இந்த data type ஒரு integer ஆனாலும் அது மிக நீளமாக இருக்கிறது.
5:07 மிக நீள integer கள் பைதனில் Long datatype ஆகவே உள்ளே சேமிக்கப்படும்.
5:13 Python இல் Boolean built-in type உம் உள்ளது.
5:18 அதை முயற்சி செய்ய, terminal லில் type செய்க: t=True.
5:28 T என்பது true இல் capital எழுத்து என்பதை கவனிக்க.
5:34 நீங்கள் இப்போது t மீது வெவ்வேறு Boolean operations களை apply செய்யலாம். உதாரணமாக ....
5:40 இதை முயல்க. f = not t .... enter செய்க.

f f or t f and t

5:59 results தானே விளக்குகின்றன.
6:01 நீங்கள் ஒரு operator ஐ இன்னொன்றின் முன் apply செய்ய நினைத்தால்?
6:05 சரி , நீங்கள் அதற்கு - precedenceக்கு - parenthesis ஐ பயன்படுத்தலாம்.
6:10 கொஞ்சம் code எழுதி இதை சோதிக்கலாம்.
6:13 ஆகவே type செய்க: a =False

b=True c=True

6:24 parenthesis எப்படி precedence ஐ மாற்றும் என காண, நாம் இரண்டு expressions ஐயும் மற்றும் அவற்றின் evaluation ஐயும் பார்க்கலாம்.
6:35 முதலாவது, within bracket a and b .... or c பின் என்டர் செய்க
6:44 இந்த expression தரும் value True ; ஆனால், a and within bracket b or c expression தரும் value False.
7:04 இப்போது Python இல் data type களை கையாள கிடைக்கும் சில operator களை பார்க்கலாம்.
7:09 Python கூட்டலுக்கு 'plus' sign ஐ பயன்படுத்துகிறது.
7:13 type செய்க: 23 + 74 நீங்கள் கூடிய value வை பார்க்கலாம்.
7:19 'minus' sign கழித்தலுக்கு.
7:24 23 - 56
7:27 '*' (star) sign பெருக்கலுக்கு
7:36 '/'(back slash) வகுப்பதற்கு
7:37 உதாரணமாக நாம் எழுதலாம்... 384 by 16

8 by 3 8 point 0 by3

7:57 கவனிக்க! நாம் முதலில் 8/3 என செய்த போது, integer output கிடைத்தது; ஏனெனில் இரண்டு operands உம் integer. ஆனால் 8 point 0/3 என்று எழுதிய போது answer float ஆக கிடைத்தது; ஏனெனில் ஒரு operand float ஆக இருந்தது.
8:15 நாம் மேலே operators க்கு போகலாம். '%' (percentage) sign modulo operation க்கு.
8:23 type செய்க: 87 modulo 6 ... பின் என்டர் செய்க
8:29 மற்றும் ஒரு exponent க்கு இரண்டு stars
8:32 ஆகவே type செய்க: 7 star star 8 பின் என்டர் செய்க
8:39 expression இல் store செய்திருக்கும் variable இன் நடப்பு value ஐ பயன்படுத்த வேண்டுமென ஒரு வேளை யாரும் விரும்பினால் equal to க்கு முன்னால் அந்த operator ஐ இட வேண்டும்.
8:49 ஆகவே நீங்கள் சொல்லலாம்: a=73

a star=34

8:59 மேற்சொன்ன expression பின் வருவதேதான், நீங்கள் டைப் செய்து முயற்சி செய்யலாம் a=a star 34 என்டர் செய்க
9:12 மற்றும் a backslash =23
9:21 video வை இங்கே நிறுத்தி பயிற்சியை செய்து முடித்து பின் தொடரவும்.
9:25 3இன் sqaure root ஐ python ஐ பயன்படுத்தி காணலாம்.
9:29 solution உங்கள் screen இல் உள்ளது
9:33 3 star star 0.5 .... 3 இன் square root தருகிறது
9:42 இப்போது, 3 star star 1 slash 2 உம் மற்றும் 3 star star 0 point 5 ஒன்றேவா? <Pause>
9:54 solution க்கு terminal க்கு போகலாம்
9:57 நாம் அதன் இரண்டு operation களையுமே பார்க்கலாம்.
10:00 ஆகவே type செய்க: 3 star star 0 point 5 enter செய்க;

3 star star 1 slash 2 enter செய்க;

10:15 நீங்கள் காணபது போல முதல் operation integer ஐ தருகிறது, இரண்டாவது ஒரு float ஐ தருகிறது.
10:19 ஆகவே, இரண்டும் ஒன்றையே சொன்னாலும் அவை வெவ்வேறு output களை தருகின்றன.
10:24 நாம் இப்போது Python இன் sequence data type களை பார்க்கலாம்.
10:27 Sequence data types என்பனவற்றில் elements ஒரு sequential order இல் வைக்கப்பட்டிருக்கும். எல்லா element களும் index number களை பயன்படுத்தி access செய்யப்படுகின்றன.
10:38 Python இல் sequence datatype கள் வருவன.
  • list
  • string
  • tuple
10:43 list வகை ஒரு container, அது பல மற்ற object களை order இல் வைத்திருக்கும்.
10:50 நம் முதல் list ஐ typeசெய்து உருவாக்கலாம்.
10:54 ஆகவே type செய்க: num underscore list = within square bracket 1 comma 2 comma 3 comma 4

num underscore list

11:08 square brackets இல் enclose செய்த Items comma க்களால் பிரிக்கப்பட்டால் அது ஒரு list ஆகிவிடும்.
11:14 Lists எந்த வகை data வையும் வைத்துக்கொள்ளும்.
11:18 நாம் இப்படி ஒரு list வைத்திருக்கலாம்: var underscore list = within square bracket 1 comma 1 point 2 comma பின் மீண்டும் within square bracket 1 comma 2

var underscore list

11:45 இன்னொரு sequence data வகையை பார்க்கலாம் - strings
11:49 type செய்க: greeting underscore string= within double quotes hello
12:01 greeting_string இப்போது ஒரு string variable ஐ கொண்டுள்ளது. அதன் value "hello"
12:07 Python string களை உண்மையில் வெவ்வேறு வழிகளில் define செய்யலாம்.
12:12 k=within single qoute Single quote என எழுதுக.

l =within double quotes - Let's see how to include a single quote m=within three single quotes and double qoutes Let's see how to include both

12:33 நீங்கள் பார்ப்பது போல, single quotes ஐ வழக்கமாக delimiter ஆக பயன்படுத்துகிறோம்.
12:39 ஒரு string இல் ஒரு single quote இருக்கும்போது, double quotes delimiters ஆக பயனாகும்.
12:45 ஒரு string quote இல் single மற்றும் double quotes இரண்டும் இருக்கும். triple quotes aவழக்கமாக delimiter ஆக பயன்படும்.
12:54 sequence data list இல் கடைசி வகை tuple.
12:59 ஒரு tuple ஐ உருவாக்க நாம் சாதாரண bracket ஐ பயன்படுத்துகிறோம். '(' list க்கு பயனாகும் square bracket ஐ அல்ல '[' .
13:06 type செய்க: num underscore tuple = within bracket 1 to 8 separated by comma
13:18 அவற்றுக்கு sequential property இருப்பதால் சில functions மற்றும் operation களை நாம் அவை எல்லாவற்றுக்கும் apply செய்ய முடியும்.
13:25 முதலாவது accessing.
13:28 index numbers ஐ பயன்படுத்தி அவற்றை access செய்யலாம்.
13:31 ஆகவே type செய்க: num underscore list within square bracket 2

num underscore list within square bracket -1 greeting underscore string within square bracket 1 greeting underscore string within square bracket 3 greeting underscore string within square bracket -2 num underscore tuple within square bracket 2 num underscore tuple within square bracket -3

14:08 Indexing 0 வில் இடமிருந்து வலமாக ஆரம்பிக்கிறது. பின் பக்கமாக அணுகினால் அது -1 இல் ஆரம்பிக்கிறது. |- | 14:14 | இப்படியாக num underscore list[2] என்பது மூன்றாவது element 3 ஐ குறிக்கிறது. மற்றும் greetings [-2] என்பது கடைசியிலிருந்து இரண்டாவது element அதாவது 'எல்'.
14:26 Addition தருவது இரண்டு sequences ஐயும் கொண்ட புதிய sequence.
14:30 ஆகவே terminal லில் type செய்க:

num underscore list + var underscore list

a underscore string= within double quote another string greeting underscore string+a underscore string t2= 3 4 5 6 separated by commas in the bracket num underscore tuple+t2

15:17 len function length ஐ தருகிறது.
15:20 ஆகவே type செய்க: len within bracket num underscore list

len within bracket greeting underscore string len within beacket num underscore tuple

15:43 நாம் 'in' keyword ஐ கொண்டு ஒரு element இன் containership ஐ காணலாம்.

ஆகவே terminal லில் type செய்க: 3 in num underscore list H within single quote in greeting underscore string 2 in num underscore tuple

16:15 நாம் அது தகுந்தவாறு True மற்றும் False ஐ தருவதை காணலாம்.
16:18 max function ஆல் maximum உம் மற்றும் min ஆல் minimum உம் கண்டுபிடிக்கவும்.
16:23 terminal லில் type செய்து சோதிக்கவும்:

max within bracket num underscore tuple min within bracket greeting underscore string

16:39 ஒரு sorted list ஐ பெறவும்.
16:42 ஆகவே type செய்க: sorted within bracket num underscore list
16:50 order இன் தன்மையால் , நாம் sequence ஆக உள்ள ஒரு group of elements ஐ ஒன்றாக அணுகலாம்
16:57 இதற்கு slicing மற்றும் striding என்று பெயர்.
17:00 முதலில் Slicing ஐ பார்க்கலாம்.
17:02 கொடுக்கப்பட்டது listcj= 1 to 6
17:09 நமக்கு 2 இல் துவங்கி 5 இல் முடியும் elements வேண்டுமென்று கொள்வோம்.
17:14 இதற்கு நாம் செய்ய வேண்டியது j witin square bracket 1 colon 4
17:24 slicing செய்ய syntax , sequence variable name, square bracket, முதல் element index, colon, இரண்டாவது element index.
17:36 ஆனால் முதல் element கிடைக்கும் list இல் சேர்க்கப்பட மாட்டாது.
17:39 ஆகவே type செய்க: j within square bracket colon 4
17:49 முதல் element blank ஆக விடப்பட்டால் default ஆரம்பத்தில் இருந்து; கடைசி element blank ஆக விடப்பட்டால் கடைசி வரை என்று பொருள்.
18:14 ஆகவே terminal லில் type செய்க:

j within square bracket 1 colon j within square bracket colon

18:30 இது முழு லிஸ்டேதான்.
18:33 Striding என்பது slicing போலவேதான், வித்தியாசம் step size இங்கே செய்யப்படுவதில்லை.
18:39 ஆகவே நாம் ஒரு example ஐ பார்க்கலாம்.
18:41 ஆகவே type செய்க: new underscore num underscore list=1 to 10 within square bracket separated by commas

new underscore num underscore list within square bracket 1 colon 8 colon 2 பின் அடுத்த line இல்... 2 4 6 8 within square bracket separated by commas .. இதுவே output.

19:07 colon 2 என கடைசியில் சேர்த்தது ஒன்றூ விட்டு ஒரு element எனக்குறிக்கிறது.
19:15 அதனால்தான் நாம் இந்த concept ஐ striding என்கிறோம்; அதாவது நாம் list இன் ஊடே நடக்கிறோம். (stride அல்லது step.)
19:23 step இந்த example இல் 2.
19:25 நாம் இதே போன்ற பல features of lists ஐ strings மற்றும் tuples இல் கண்டிருக்கிறோம்.
19:32 ஆனால் பல முக்கிய features list இல் உள்ளன. அவை strings மற்றும் tuples இல் இல்லை.
19:37 ஒரு example ஐ பார்க்கலாம்.
19:40 type செய்க: new underscore num underscore list within square bracket[1]=9

greeting underscore string within squre bracket 1 =within single quote k

19:59 ஒரு error ஐ பார்க்கிறோம்.
20:03 நீங்கள் காண்பது போல முதல் command problem இல்லாமல் இயங்குகிறது; இரண்டாவதில் error வருகிறது.
20:10 இப்போது முயற்சி செய்வோம்: new underscore tuple within square bracket 1=5
20:19 அதே error.
20:23 இது ஏனெனில் strings மற்றும் tuples இரண்டுமே immutable.
20:28 நாம் குறிப்பிட்ட index இல் புதிய value ஐ assign செய்து value ஐ மாற்ற முடியாது.
20:34 நாம் பல்வேறு வகைகளை பார்த்தோம்; ஆனால் நாம் ஒன்றிலிருந்து இன்னொரு வகையாக மாற்ற வேண்டும்.
20:39 ஒன்றிலிருந்து இன்னொரு வகையாக மாற்ற கிடைக்கும் methods by which களை நாம் ஒவ்வொன்றாக பார்க்கலாம்.
20:45 ஆகவே type செய்க: i=34

d=float within bracket i d

21:00 nt, float மற்றும் complex ஆகியவற்றை ஒரு data structure இலிருந்து இன்னொரு வகையாக மாற்ற Python இல் in functions உள்ளன.
21:08 ஆகவே type செய்க: dec=2.34

dec underscore con=int(dec) dec underscore con

21:29 நீங்கள் காண்பது போல number இன் decimal பகுதி நீக்கப்பட்டு integer பெறப்பட்டது.
21:35 ஆகவே type செய்க: com=2.3+4.2j

floatwithin bracket com

21:56 ஆகவே இங்கே நாம் இன்னொரு error ஐ பெறுகிறோம்.
22:05 இந்த error ஐ உங்கள் பக்கத்தில் இருந்து solve செய்யலாம்.
22:10 அதே போல நாம் list ஐ tuple ஆக்கலாம்; tuple ஐ list ஆக்கலாம்.
22:15 அதற்கு type செய்க: lst= 3 4 5 6 separated by comma

tup=tuple within bracket lst lst tupl=3 comma 23 comma 4 comma 56 in bracket lst=list within bracket tupl tupl

22:54 ஒரு string ஐ list ஆக்குவதும், ஒரு list ஐ string ஆக்குவதும் சுவாரசியமான பிரச்சினை.
22:59 நம்மிடம் ஒரு string இருப்பதாக கொள்வோம். somestring= within double quote Is there a way to split on these spaces.

somestring.split() function, ஆகவே அடு spilt ஆகும்.

23:28 இது whitespace இல் string split ஆன list ஐ தரும்.
23:33 அதே போல நாம் வேறு character இலும் split செய்யலாம்.
22:37 ஆகவே type செய்க: otherstring=within double quote Tim comma Amy comma Stewy comma Boss
23:48 இப்போது நாம் comma வில் split செய்வது எப்படி? அதை ஒரு argument ஆக pass செய்க.
23:56 ஆகவே terminal லில் type செய்க: otherstring.split within bracket comma in single quote பின் என்டர் செய்க
24:06 join function இதற்கு எதிரானதை செய்கிறது.
24:10 ஒரு list ஐ சேர்த்து அதை ஒரு string ஆக்குகிறது.
24:14 ஆகவே type செய்க: எல் 1=within square bracket List comma joined comma on comma commas,all within single quote

பின் type செய்க: , in single quote.join within bracket எல் 1

25:02 இப்படியாக நாம் list joined on commas ஐ பெற்றோம்.
25:05 அதே போல நாம் spaces ஐ செய்யலாம்..
25:07 ஆகவே type செய்க: எல் 2=Now comma on comma spaces in square bracket

பின் type செய்க: space in single quote.join within bracket l2, ஆகவே out put கிடைக்கிறது.

25:27 இந்த join operation list இல் ஒரு list of strings - apply செய்ய இருந்தால்தான் வேலை செய்யும்.
25:32 video வை இங்கே நிறுத்தி பயிற்சியை செய்து முடித்து பின் தொடரவும்.
25:38 3 list இல் ஒரு element ஆ என சோதிக்கவும் [1 comma 7 comma 5 comma 3 comma 4]. அப்படி இருந்தால் அதை 21 என மாற்றவும்.
25:56 solution க்கு terminal க்கு போகலாம்.
26:00 type செய்க: எல்=[1 comma 7 comma 5 comma 3 comma 4

3 in எல் எல் in square bracket 3=21 எல்

26:22 நாம் இன்னும் ஒரு exercise ஐ solve செய்யலாம்.
26:24 video வை இங்கே நிறுத்தி பயிற்சியை செய்து முடித்து பின் தொடரவும்..
26:31 string "Elizabeth is queen of england" ஐ "Elizabeth is queen" என மாற்றவும்.
26:39 solution க்கு terminal க்கு போகலாம்.
26:43 ஆகவே s=Elizabeth is queen of england in double quotes

stemp=s.split() within single quote space.join within bracket stemp within square bracket colon 3 பின் என்டர் செய்க

27:07 நீங்கள் பார்ப்பது போல, நாம் சுலபமாக தேவ்வையில்லாத சொற்களை நீக்கிவிட்டோம்.
27:11 இத்துடன் இந்த டுடோரியல் முடிகிறது.
27:14 இந்த டுடோரியலில், நாம் கற்றவை, 1. number Datatype களை புரிந்து கொள்ளுதல் -- integer, float மற்றும் complex.
27:21 2. boolean datatype மற்றும் operators ஐ புரிந்து கொள்ளுதல் +, backslash, percent that is modulo மற்றும் * for multiplication .
27:33 3.equence data types பயன்படுத்துதல்-- List,String மற்றும் Tuple.
27:36 4. row மற்றும் column numbers ஐ பயன்படுத்தி sequence களை Slice செய்தல்.
27:41 5. split() மற்றும் join() function களை முறையே பயன்படுத்தி ஒரு list ஐ Split மற்றும் join செய்தல்.
27:49 6. string ஐ tuple ஆகவும் மற்றும் vice-versa வாகவும் செய்தல்.
27:54 நீங்கள் தீர்வு காண இதோ சில self assessment கேள்விகள்
27:58 1. tuples மற்றும் list கள் இடையே உள்ள பெரிய வேறுபாடு என்ன?
28:02 2. இந்த string ஐ whitespace களில் Split செய்க.
28:05 string="Split this string on whitespaces"
28:09 விடைகள் இதோ
28:12 1. tuples மற்றும் list கள் இடையே உள்ள பெரிய வேறுபாடு Tuples immutable - மாற்ற முடியாதவை - ஆகும். lists அப்படி இல்லை.
28:20 2. whitespace களில் string ஐ Split செய்ய, நாம் function
`` split`` ஐ argument இல்லாமல் பயன்படுத்தலாம்.
28:26 string.split() function
28:29 நீங்கள் இந்த tutorial ஐ ரசித்திருப்பீர்கள் மற்றும் பயனுள்ளதாகவும் இருந்திருக்கும் என நம்புகிறேன்.
28:34 நன்றி!

Contributors and Content Editors

Sanmugam