Python :- Control Statement in hindi

Control Statements in hindi

पाइथन प्रोग्रामिंग लैंग्वेज मे तीन प्रकार के control Statement होते है |

  1. if statement
  2. if_else statement
  3. if_elif_else statement

control statement का अर्थ होता है की जब तक प्रोग्राम मे दिया गया कोई condition सत्य ( true ) नहीं होगा तब तक ये अपने statement को execute नहीं करता |

1. if Statement

if statement का प्रयोग बहुत सारी प्रोग्रामिंग लैंग्वेज जैसे की c, c++, java आदि के साथ साथ पाइथन मे भी किया जाता है|

if statement मे जब कोई condition true होगा तो ही statement execute होगा अथवा नहीं |

# SYNTAX
if condition:
    statement(s)
age =  int(input("enter age ------- "))
if age >= 15:
    print ("you are above 15 ")

output 1 :- 
enter age ------- 16      # condition is true 
you are above 15 

output 2 :- 
enter age ------- 12      #condition is not true

ऊपर दिए गए प्रोग्राम मे जब condition true हुई तो हमे output मिला जबकि condition true न होने पे हमे कोई भी आऊट्पुट नहीं मिला |

2. if_else Statement

if_else statement मे जब कोई condition true होगा तो if block का  statement execute होगा | और जब कोई condition false होगा तो else block का statement execute होगा |

#SYNTAX
if condition :
    statement (s)
else :
    statement (s)
email = "abc@gmail.com"
passwd = "123456"
em = input ("enter email------  ")
pa = input ("enter your passwd ---- ")
if email==em and passwd ==pa :
    print (" log in. ")
else :
    print ("wrong email id ..")

# output 1 :- 
enter email------  abc@gmail.com
enter your passwd ---- 123456
 log in. 

# output 2 :- 
enter email------ cba@gmail.com
enter your passwd ---- 123456
wrong email id ..

ऊपर दिए गए प्रोग्राम मे अगर दोनों condition true होगी तो ही if block का statement प्रिंट होगा | यदि दोनों कंडीशन मे से कोई भी एक condition या दोनों condition false होगी तो else block का statement प्रिंट होगा

3. if_elif_else Statement

if_elif_else statement मे अगर if block का condition true होगा तो if block का स्टेटमेंट प्रिंट होगा अगर | if ब्लॉक का कंडीशन false होगा तो फिर elif ब्लॉक check होगा elif true होने पे elif block का statement प्रिंट होगा | अगर if और elif दोनों false होंगे तो else block का statement प्रिंट होगा |

# SYNTAX

if condition :
    statement (s)
elif condition :
    statement (s)
else :
    statement (s)
a = int (input ("enter the no :----  "))
if 0<= a <100:
    print ("java")
elif 100<=a < 150:
    print ("python")
else :
    print ("c++")

output 1:- 
enter any no :---- 111
python

output 2:- 
enter any no :---- 30
java

output 3:-
enter any no :---- 210
c++
इसे  भी पढ़े - python loops in hindi 

4 Replies to “Python :- Control Statement in hindi”

  1. This website is so informative for me thank you so much you also fill about computer sofware

Comments are closed.