Posts

if condition python in hindi | If python

  If condition -  python में if condition का उपयोग हमारे द्वारा दी गयी condition के हिसाब से निर्णय लेने में होता है |   Let’s master it step by step:- ✱लॉजिकल condition जिसका use if में होता है      x==y  equal to      x!=y   not equal to      x<y    less than      x>y greater than      x<=y   less than equal to      x>=y   greater than equal to  1.हम नंबर के साथ if condition लगाते है  x= 10 y= 20 if x<y : print( 'x is less than y' ) x=10 x की value  y=20  y की value if x<y : यदि x<y ,:=indent (4 spaces or 1 Tab)      print('x is less than y')  प्रिंट करो - जो भी आप करवाना चाहते हो  2.यदि पहली condition सही नहीं होती है तो 2nd,3rd,4th  condition के लिए elif  और अंतिम condition के लिए else का भी use कर सकते है  x= 10 y= 20 if x>y ...

python for loop | for loop python in hindi

  Python for loop                                                                             For loop का use हम तब करते हैं  जब हमें किसी list (या sequence) के हर item को एक-एक करके process (जैसे print, calculate, check) करना होता है।   Let’s master it step by step:- 1. each object को प्रिंट करना bag = [ 'pen' , 'pencil' , 'book' ] for each_item in bag: print(each_item) bag = ['pen','pencil','book'] for each_item in bag: लो each_item , में से , बैग , := indent 4 spaces     print(each_item) हम यह भी कर सकते है - bag = [[ 'pen' ],[ 'pencil' ],[ 'book' ]] for each_item in bag[ 1 ]: print(each_item) bag = [['pen'],['pencil'],['book']]     य...

python while loop | while loop in hindi

  while loop - लूप तब तक चलता है  जब तक कोई condition (शर्त)  सही (True) होती है। Let’s master it step by step:- 1.नंबर तक लूप चलाना- count = 1 while count <= 5 : print(count) count = count + 1  Explanation-- count = 1   (बनाओ एक variable count जिसकी value 1 है) while count <= 5:   (जब तक count की value 5 से छोटी या बराबर है, तब तक ये loop चलेगा)     print(count)       (count को print करो)     count = count + 1       (count में 1 जोड़ दो, ताकि अगली बार नई value के साथ check हो) 2. User से input लेना जब तक वो सही जवाब न दे- password = "" while password != "1234" : password = input( "Enter password: " ) print( "Access granted." )  Explanation- password = ""   (शुरू में password खाली है) जब तक password "1234" नहीं होता:       user से password मांगो       (हर बार नया input लो) जब password सही हो गया, loop रुक गया  ...