Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 93 - Math_Genius_1 2
P. 93

    print("Your name is:", name)
                     print("You have scored", marks, "marks in maths")
                     print( ) iaQD'ku Lopkfyr :i ls çnku dh xbZ oLrqvksa dks fLaVªx esa ifjofrZr djrk gS] Hkys gh ge ,d la[;kRed eku ;k
                     ,d vfHkO;fÙkQ çnku djrs gksaA ;g igys vfHkO;fÙkQ dk ewY;kadu djrk gS vkSj fiQj ifj.kke dks fLaVªx esa ifjofrZr djrk gSA

                       vkvks tkusa!

                       print( ) fcuk fdlh ewY; ;k vfHkO;fÙkQ osQ ,d fjDr js•k dks fçaV djrk gSA

                           a
                         dfM'kuy LVsVesaV~l ( Conditional Statements)
                     vkius vc rd tks çksxzke fy•s gSa] os buiqV( ) vkSj ¯izV( ) iaQD'kal dk mi;ksx djosQ ,d osQ ckn ,d Åij ls uhps rd
                     LVsVesaV }kjk fu"ikfnr fd, x, FksA ysfdu] vxj gesa fdlh çksxzke osQ fMiQkWYV Ýyks esa oqQN cnyko djus dh t:jr
                     gS] rks gesa oaQfM'kuy LVsVesaV~l dk bLrseky djuk gksxk] ftUgsa fMlhtu esfoaQx LVsVesaV~l Hkh dgk tkrk gSA ik;Fku esa
                     rhu fu.kZ; ysus okys c;ku gSaA

                            if LVsVesaV                 if…else LVsVesaV               if…elif…else LVsVesaV

                     biQ LVsVesaV (The if Statement)
                     biQ LVsVesaV ik;Fku esa lcls vk/kjHkwr oaQfM'kuy LVsVesaV gSa tks vkidks LVsVesaV~l dks
                     fu"ikfnr (execute) djus ls igys ,d oaQfM'ku dk ijh{k.k djus dh vuqefr nsrk gSA

                     biQ LVsVesaV dk flaVSDl gS%                                                  oaQfM'kuy       vlR;
                                                                                                   ,Dlizs'ku
                     if < conditional expression> :
                            [statements]
                     mnkgj.k osQ fy,%
                                                                                                         lR;

                                                                                                    +
                                                                                                   bIkQ ckWMh

                                                                                                      +
                                                                                                    bIkQ LVsVesaV dk ÝykspkVZ
                                                                                                 (Flowchart of if statement)
                                      biQ LVsVesaV dk mi;ksx djuk (Using if statement)
                     Øe'k% 22 vkSj 7 osQ eku osQ fy, çksxzke dks nks ckj pyk,¡A
                     tc vki 22 ntZ djrs gSa] rks oaQMh'ku (22» 2 ¾¾ 0) lR;

                     (true) ykSVkrk gSA rks] if LVsVesaV osQ vanj LVsVesaV fu"ikfnr
                     gks tkrk gS vkSj vkmViqV bl çdkj fn•k;k tkrk gS%
                     The number is even

                     Thank You!
                     tc vki eku 7 ntZ djrs gSa] rks fn•k;k x;k vkmViqV gS%

                     Thank You!
                     D;ksafd 'krZ (7» 2 ¾¾ 0) vlR; (False) okilh djrh gSA                  vkmViqV (Output)
                     vr,o LVsVesaV ckWMh osQ vanj LVsVesaV dks fu"ikfnr ugha fd;k tkrk gS vkSj osQoy print( ) LVsVesaV dks ckgj fu"ikfnr
                     fd;k tkrk gSA

                                                                              ikbFku esa oaQfM'kuy vkSj ywfiax LVsVesaV~l  91

| 88 89 90 91 92 93 94 95 96 97 98 |