#19 Python Tutorial for Beginners | If Elif Else Statement in Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 พ.ย. 2024

ความคิดเห็น • 1.7K

  • @knucklesandwich8786
    @knucklesandwich8786 3 ปีที่แล้ว +289

    i'm 54 years old with no programming experience. I am constantly searching for good tutorials. This is by far the best python tutorial I have seen so far. Thanks. Keep up the good work.

  • @manavsingla3143
    @manavsingla3143 4 ปีที่แล้ว +215

    The best python teacher on the internet, NO DEBATE!!
    I said it!!! Thank you so much Navin sir for taking your time and contributing to the python community with such a mindblowing course.... Hatts off to you

    • @iamthatiam4496
      @iamthatiam4496 4 ปีที่แล้ว +6

      I agree. Best I have seen

    • @sundari7846
      @sundari7846 3 ปีที่แล้ว +4

      In indo "no debat no kecot" it means "absolutely no debate"

    • @onepersonintheuniverse
      @onepersonintheuniverse 2 ปีที่แล้ว

      I was dying from the inside while listening to him. Ugh…

    • @sharafalip1718
      @sharafalip1718 2 ปีที่แล้ว

      @@sundari7846 😀

    • @boyanghu1222
      @boyanghu1222 ปีที่แล้ว

      @@onepersonintheuniverse If you focus on the content what he had taught us and the effort he had given, you will not think in this way.🙂Plese be thankful all the time.

  • @sudheerreddy874
    @sudheerreddy874 3 ปีที่แล้ว +53

    Nuvvu keka anna... Feeling proud of you... Just yesterday I started ur tutorials.... "Teluskuntune" unna eppati varaku... Not at all boring... I am more addicted to ur videos than any webseries(money heist, game of thrones)

    • @cyno8767
      @cyno8767 3 ปีที่แล้ว +3

      game of thrones ❤️😌

    • @vinaykumarsai1217
      @vinaykumarsai1217 3 ปีที่แล้ว +3

      bro ee tutorial mimmalni strong chesindha python basics and coding lo

    • @mrenergy989
      @mrenergy989 7 หลายเดือนก่อน

      And also you can use float because we can use more values

  • @rohitchauhan7721
    @rohitchauhan7721 4 ปีที่แล้ว +49

    (1).
    a=int(input('enter any integer:'))
    if a>0:
    print('this is positive integer')
    elif a

    • @mrenergy989
      @mrenergy989 7 หลายเดือนก่อน +1

      Bro u can use 0 rather than nor positive nor negative

    • @m_sitso
      @m_sitso 7 หลายเดือนก่อน +1

      this code will give an error:
      line 7 error 'this is neither positive nor negative' not defined

    • @Lolsnni_lakshmi
      @Lolsnni_lakshmi 7 หลายเดือนก่อน +5

      x = int(input("enter a number")
      if x

  • @tejaswibhargava8745
    @tejaswibhargava8745 6 ปีที่แล้ว +54

    At this point i realised i've never binged watch a tutorial for so long but it is this channel at which i've almost completed watching 3/4 of the python tutoring in 2 days! . You are a great teacher i must say. Your efforts are commendable. Thankyou so much . 😇😇☺️

  • @vikasgarg7929
    @vikasgarg7929 4 ปีที่แล้ว +15

    I have purchased many python courses from different sites but i m learning from him haha... great guy :)

  • @dhruvsharma2795
    @dhruvsharma2795 4 ปีที่แล้ว +81

    Thanks !
    The new technique which I described here :
    t,u,v = int(input("Number 1 : ")) , int(input("Number 2 : ")) , int(input("Number 3 : "))
    print("The maximum value is : " , max(t,u,v))

    • @srinivasanv6573
      @srinivasanv6573 4 ปีที่แล้ว

      Super bro thanks

    • @knowledgeweekly9412
      @knowledgeweekly9412 4 ปีที่แล้ว

      where is the question?

    • @vivekpatel1935
      @vivekpatel1935 4 ปีที่แล้ว

      @PUSHKAR SINGH it will convert it into integer

    • @baigantv7372
      @baigantv7372 4 ปีที่แล้ว

      @@knowledgeweekly9412 he made short instead of several lines

    • @Siddharth153
      @Siddharth153 4 ปีที่แล้ว

      @PUSHKAR SINGH he has put int in the code

  • @moumitasaha1172
    @moumitasaha1172 3 ปีที่แล้ว +7

    Bacame a Python lover in 2 hours. You have amazing teaching skills and it must be appreciated. Thankyou so much.

  • @bharathreddy6208
    @bharathreddy6208 5 ปีที่แล้ว +181

    Really awesome class sir. I'm addicted to your teaching

  • @kamatisjuice
    @kamatisjuice 4 ปีที่แล้ว +3

    Now I know why you teach waaaay better than the others. Everytime you finish a video, you challenge us. Now you are really one of the coolest person in the world.

  • @bishwanathpandey2207
    @bishwanathpandey2207 5 ปีที่แล้ว +35

    I am in love with programming just because of you sir.
    Thank you for your strong support

  • @syedamirali3205
    @syedamirali3205 2 ปีที่แล้ว +3

    I have done your given assignments with best of my understanding. So they're:
    1)
    number= 0.0000005
    if number>0:
    print("Positive")
    elif numbery and x>z:
    print(x)
    elif y>z and y>x:
    print(y)
    elif z>y and z>x:
    print(z)
    else:
    print('none')
    Thank you for your classes.

    • @sanseongbi
      @sanseongbi หลายเดือนก่อน

      2nd Code is wrong brother!!!
      I mean think about it, what if the value of x and z are equal?
      That execution of yours will directly skip to the else block and prints nothing even if x and z both have a greater number.

    • @sanseongbi
      @sanseongbi หลายเดือนก่อน

      2nd Code is wrong brother!!!
      I mean think about it, what if the value of x and z are equal?
      That execution of yours will directly skip to the else block and prints "none" even if x and z both have a greater number.

    • @sanseongbi
      @sanseongbi หลายเดือนก่อน

      x = int(input())
      y = int(input())
      z = int(input())
      if x>=y and x>=z:
      print(x)
      elif y>=x and y>=z:
      print(y)
      else:
      print(z)

  • @q2success352
    @q2success352 5 ปีที่แล้ว +12

    2nd Answer:
    n1 = int(input("Enter 1st number: "))
    n2 = int(input("Enter 2nd number: "))
    n3 = int(input("Enter 3rd number: "))
    if n1 > n2 and n2 > n3:
    print (n1 ,"is the highest number among the three")
    elif n1 < n2 and n2 < n3:
    print (n3 , "is the highest number among the three")

    elif n1 < n2 and n2 > n3:
    print (n2 , "is the highest number among the three")

    else:
    print("Enter 3 different numbers")

    • @shivaravuri1913
      @shivaravuri1913 2 ปีที่แล้ว +1

      x = int(input("enter the number:"))
      y = int(input("enter the number:"))
      z = int(input("enter the number:"))
      a = max(x,y,z)
      print(a)

  • @jaganathg3137
    @jaganathg3137 3 ปีที่แล้ว +14

    1.
    x=int (input("enter a number "))
    if x>0:
    print("the number is positive")
    else:
    print("the number is negative")
    2.
    x,y,z = int(input("1st num ")),int(input("2nd num ")),int(input("3rd num "))
    if x>y and x>z :
    print(x)
    elif y>z:
    print(y)
    else :
    print(z)

    • @YashhC
      @YashhC ปีที่แล้ว

      Hello! In 2. you can simply use the max function! Like:
      maximum = max(x,y,z)
      print("Highest number is " + str(maximum))

    • @YashhC
      @YashhC ปีที่แล้ว

      I found something even better. directly use str(max(x,y,z))

    • @mohammad1906
      @mohammad1906 ปีที่แล้ว

      @@YashhC did it work, how can you use string function here

    • @YashhC
      @YashhC ปีที่แล้ว

      @@mohammad1906 I have to use string because I can't add two different data types like string and the number(int).
      Basically, "maximum" gets a value first, then that value is simply printed as a string for this line. After that, maximum type is again int.

    • @gontysivaram2109
      @gontysivaram2109 10 หลายเดือนก่อน

      WhAts happens when the to values are Same but not third one ..

  • @jubairpial9744
    @jubairpial9744 5 ปีที่แล้ว +112

    x,y,z = int(input("1st num")),int(input("2nd num")),int(input("3rd num"))
    if x>y and x>z :
    print(x)
    elif y>z:
    print(y)
    else :
    print(z)

    • @anshul1047
      @anshul1047 4 ปีที่แล้ว +66

      another interesting way to do it without if, elif, else
      a, b, c= int(input('enter first number')), int(input('enter second number')), int(input('enter third number'))
      nums= [a, b, c]
      print(max(nums))

    • @adarshsahani1947
      @adarshsahani1947 3 ปีที่แล้ว +2

      bro its work

    • @mainios126bobeats4
      @mainios126bobeats4 3 ปีที่แล้ว +11

      one line ver of this is
      print(max(map(int, (input('1st number: '), input('2nd number: '), input('3rd number: ')))))

    • @gayatri3899
      @gayatri3899 3 ปีที่แล้ว +1

      @@mainios126bobeats4 I think u should write int as well

    • @PawanKumar-ol5sl
      @PawanKumar-ol5sl 3 ปีที่แล้ว

      You can put is greatest number with x, y, z.

  • @piyushshinde1533
    @piyushshinde1533 ปีที่แล้ว +5

    since 4 days i was confused between nested if and elif, now fully understood the difference between them .
    Thank you so much sir!!🙏

  • @just_a_living_being
    @just_a_living_being 6 ปีที่แล้ว +135

    Sir your lectures are so interactieve and explanations are awesome, I have a suggestion please give us atleast 5 questions(for easy) and 3 questions(for medium) and 2 questions(for hard) because as you know ”practice makes man perfect 😊”

  • @nigampratap2466
    @nigampratap2466 4 ปีที่แล้ว +7

    a= float(input("enter the value"))
    if a>0:
    print("+ve")
    elif ac and b>d:
    print("b is greatest")
    elif c>b and c>d:
    print("c is greatest")
    else:
    print("d is greatest")

  • @samuelkiran5896
    @samuelkiran5896 5 ปีที่แล้ว +8

    Your teachings are “Easy to understand” & you make it so much more fun and interesting. Thank you!

  • @tysondacosta7802
    @tysondacosta7802 2 ปีที่แล้ว +1

    The best thing about your video is that you make programming sound to easy and you communicate so well. Not everyone can teach well as you are able to.

  • @shivajishinde1496
    @shivajishinde1496 6 ปีที่แล้ว +4

    Mr. Navin you are teaching with great energy. You are trying best to make us understand. I have never had such learning experience before. Thank you so much for your efforts to make these things simple!

  • @atheekazmi4574
    @atheekazmi4574 3 ปีที่แล้ว

    x=int(input("enter any plus or minus number"))
    if x

  • @jabuto-farmnigeria8626
    @jabuto-farmnigeria8626 4 ปีที่แล้ว +30

    Q1: First question
    num = int(input("Enter Number: "))
    if num > 0:
    print("positive")
    elif num < 0:
    print("Negative")
    else:
    print("Zero")
    Q2: Second question
    print("You are to insert 3 numbers:")
    a = int(input("Enter First Number: "))
    b = int(input("Enter Second Number: "))
    c = int(input("Enter Third Number: "))
    x = [a,b,c]
    print(max(x))

    • @shreyachavan7460
      @shreyachavan7460 4 ปีที่แล้ว +1

      Your 1 st code is correct bt in second code u should apply if else logic

    • @vinayakkulkarni1303
      @vinayakkulkarni1303 4 ปีที่แล้ว +1

      @@shreyachavan7460 pls can u say how? 🙏🙏

    • @Siddharth153
      @Siddharth153 4 ปีที่แล้ว

      @@shreyachavan7460 first one IndentationError: unexpected indent

    • @n8panther5
      @n8panther5 4 ปีที่แล้ว +3

      second question If elif
      print("You are to insert 3 numbers:")
      x = int(input("enter first number:"))
      y = int(input("enter second number:"))
      z = int(input("enter third number:"))
      if x>=y and x>=z:
      print(x)
      elif y>=x and y>=z:
      print(y)
      elif z>=x and z>=y:
      print(z)

    • @kushalappabe1993
      @kushalappabe1993 2 ปีที่แล้ว

      @@n8panther5 i can't understand what is wrong with this or rather can't understand why this does'nt work:
      a = int(input('enter number a '))
      b = int(input('enter number b '))
      c = int(input('enter number c '))
      if a > (b and c):
      print(a)
      elif b > (a and c):
      print(b)
      elif c > (b and a):
      print(c)

  • @harshanasemasinghe446
    @harshanasemasinghe446 4 ปีที่แล้ว +1

    x = input("enter the 1st number ")
    y = input("enter the 2nd number ")
    z = input("enter the 3rd number ")
    if x>y and x>z:
    print( x +" is the greatest number")
    elif y>x and y>z:
    print( y +" is the greatest number")
    else:
    print( z +" is the greatest number")

  • @hasibkhan8600
    @hasibkhan8600 5 ปีที่แล้ว +5

    1st question answer:
    num = int(input("Enter a number: "))
    if num > 0:
    print("positive.")
    else:
    print("Negative.")

  • @ajithshetty1684
    @ajithshetty1684 4 ปีที่แล้ว +1

    print("enter 3 no")
    a=int(input())
    b=int(input())
    c=int(input())
    if a>b:
    if a>c:
    lar=a
    else:
    lar=c
    else:
    if b>c:
    lar=b
    else:
    lar=c
    print("The largest is",lar)

  • @praneethpydimarry6032
    @praneethpydimarry6032 2 ปีที่แล้ว +1

    question 2 ans
    a=int(input())
    b=int(input())
    c=int(input())
    if(a>b and a>c):
    print(a,"max")
    print("max")
    elif(ac):
    print(b,"max")
    print("max")
    else:
    print(c,"max")
    print("max")

  • @sabarishsudhan9345
    @sabarishsudhan9345 3 ปีที่แล้ว +5

    I have gone through tons of tutorials in my career... and I find this the best I have come across for "BEGINNERS"! love the way you portray Python in the big picture and then zoom in on details for learning !

  • @LOKESHMC-wg1sd
    @LOKESHMC-wg1sd ปีที่แล้ว +1

    Learning in 2023 it's just awesome u are making me to interest to learn

  • @YashhC
    @YashhC ปีที่แล้ว +3

    You made it so easy! I could do the quiz questions in just 10 mins!
    1. print("Let's check if a number is +ve or -ve.")
    print()
    x = int(input("Enter a number: "))
    if x > 0:
    print("You entered a positive number")
    else:
    print("You entered a negative number")
    print("See you later!")
    2. print("Let's check the highest of 3 numbers you give.")
    print()
    first_num = int(input("Enter the first number: "))
    second_num = int(input("Enter the second number: "))
    third_num = int(input("Enter the third number: "))
    maximum = max(first_num, second_num, third_num)
    print("Highest number is " + str(maximum))

  • @hallo-xp2wh
    @hallo-xp2wh 3 ปีที่แล้ว +1

    a=int(input("enter any number"))
    if a>0 :
    print(a," is +tive")
    elif a==0 :
    print("neither positive nor negative")
    elif a

  • @kaviyar4814
    @kaviyar4814 4 ปีที่แล้ว +6

    Ur way of teaching is so awesome.... and as a fresher , I learned more and become craze on python😁

  • @shankargope2475
    @shankargope2475 ปีที่แล้ว

    Things always get crystal clear when I follow your course videos and practice the concepts.
    Today's video has completely cleared the differences in usability of different condition checking methods👍. Thank you so very much love the way you teach❤‍🔥
    quiz 1-->
    x = int(input("Enter the number: "))
    if x > 0:
    print("+ve number")
    else:
    print("-ve number")
    quiz 2-->
    p = int(input("Enter the number: "))
    q = int(input("Enter the number: "))
    r = int(input("Enter the number: "))
    if p > q and p > r:
    print("p is the greatest")
    elif q > p and q > r:
    print("q is the greatest")
    elif r > p and r > q:
    print("r is the greatest")

  • @andymyung1132
    @andymyung1132 4 ปีที่แล้ว +8

    I am SO ADDICTED TO PYTHON! Thank you Navine. Pls also if you have time make a tutorial on Python Shell and turtle.

    • @shiken69420
      @shiken69420 2 ปีที่แล้ว

      lmao dude same..before the day of my exam im doing stuff outside the portions

  • @sankargoud7063
    @sankargoud7063 3 ปีที่แล้ว

    This is one of the best tutorial for python i have seen so far. I am not exaggerating but the fact is a normal human being can concentrate for 15 mins in shot and i am seeing all the topics are covered within 15 mins max. It is superbly accommodated all the required strength to cover the topics.
    So I made 5 of my friends to watch this channel videos not necessarily python but for others too... A big thanks to Navin Reddy garu and his team who is invisible to us on the screen of course for their effort in making such valuable information online.

  • @gouthamu5424
    @gouthamu5424 4 ปีที่แล้ว +5

    Your Videos are really helpful!! I let all the ads run completely so that I can contribute something to you.

  • @mrlokeshkumar76
    @mrlokeshkumar76 4 ปีที่แล้ว +2

    a = 4
    b = 6
    c = 7
    if a > b and a > c:
    print(a)
    elif b > c and b > a:
    print(b)
    else:
    print(c)

    • @anshul1047
      @anshul1047 4 ปีที่แล้ว

      this is wrong
      this is the correct one
      print ('give three numbers and i will give you the highest of them')
      d, e, f= int(input('enter first number')), int(input('enter second number')), int(input('enter third number'))
      if d> e and d> f:
      print(str(d) + ' is the greatest' )
      elif e> f and e> d:
      print( str(e) +' is the greatest')
      elif f> e and f> d:
      print(str(f) + ' is the greatest')

  • @prynka1803
    @prynka1803 4 ปีที่แล้ว +3

    Really osm explanation
    I am often confused with if,elif,else
    Now all my doubts is clear
    Thank you so much sir...

  • @mrlokeshkumar76
    @mrlokeshkumar76 4 ปีที่แล้ว +17

    x = -5
    if x > 0:
    print("positive")
    else:
    print("negative")

  • @josephnduati4344
    @josephnduati4344 4 ปีที่แล้ว +23

    I guess this was the correct solution according to the lesson for question 2:
    x=int(input('Enter the first number: '))
    y=int(input('Enter the second number: '))
    z=int(input('Enter the third number: '))
    if x>y and x>z:
    print('X is the largest with value: ', x)
    elif y>x and y>z:
    print('Y is the largest with value: ', y)
    elif z>x and z>y:
    print('Z is the largest no with value: ', z)
    else:
    print('there are two or more equal nos.')

    • @mdc9602
      @mdc9602 4 ปีที่แล้ว +2

      No need to use y > x in 1st elif & no need to use 2nd elif, use else directly.

    • @anamaysingh8490
      @anamaysingh8490 4 ปีที่แล้ว

      @PUSHKAR SINGH that doesn't change anything it will still give you the greatest value

    • @Realthonie
      @Realthonie 2 ปีที่แล้ว

      This was nice, but it doesn’t work for float numbers

    • @imfrommars7362
      @imfrommars7362 ปีที่แล้ว

      @@Realthonie then do float(input("Enter a number: ")) very simple solution

  • @asmitabagchi6886
    @asmitabagchi6886 3 ปีที่แล้ว +6

    The only thing i wonder is how can such videos have dislikes? the button itself should be disabled.. awesome learning exp with you! lots of love and best wishes

  • @soumyaranjanpanda585
    @soumyaranjanpanda585 4 ปีที่แล้ว +29

    x= int(input("enter 1st no."))
    y= int(input("enter 2nd no."))
    z= int(input("enter 3rd no."))
    if (x>y and x>z):
    print ("x is greater")
    elif (y>x and y>z):
    print ("y is greater")
    else:
    print("z is greater")

    • @jabuto-farmnigeria8626
      @jabuto-farmnigeria8626 4 ปีที่แล้ว +12

      Hi SR Panda: try
      a = int(input("Enter First Number: "))
      b = int(input("Enter Second Number: "))
      c = int(input("Enter Third Number: "))
      x = [a,b,c]
      print(max(x))

    • @soumyaranjanpanda585
      @soumyaranjanpanda585 4 ปีที่แล้ว

      @@jabuto-farmnigeria8626 done that also. Thanks

    • @madhutoshniwal9429
      @madhutoshniwal9429 4 ปีที่แล้ว

      If i want to print that which among x,y,z is greatest than how to that along with max function

    • @anshukumari6616
      @anshukumari6616 4 ปีที่แล้ว +2

      import sys
      x = sys.argv[1]
      y = sys.argv[2]
      z = sys.argv[3]
      if(x>y):
      if(x>z):
      print("x")
      elif(z>y):
      print("z")
      else:
      if(y>z):
      print("y")
      else:
      print("z")

    • @tipanshugoel7954
      @tipanshugoel7954 4 ปีที่แล้ว

      nice boyy.....

  • @divyag7854
    @divyag7854 4 ปีที่แล้ว +10

    x=-7
    if x>0:
    print("positive number:")
    elif x==0:
    print("its zero")
    else:
    print("negative number")
    print("its done")

    • @npavankumarpavan6147
      @npavankumarpavan6147 4 ปีที่แล้ว

      Bro I can't go to the next line when I debug the first line ,in options also it will not showing

  • @gayathribabu1772
    @gayathribabu1772 4 ปีที่แล้ว +11

    1.
    x=int(input("Enter the value:"))
    if xy) and (x>z):
    print("X is Biggest")
    elif(y>z):
    print("Y is Biggest")
    else:
    print("Z is Biggest")

  • @akshathaacharya9639
    @akshathaacharya9639 ปีที่แล้ว

    The best tutor found on the internet for programming skills....

  • @flickzz0p756
    @flickzz0p756 5 ปีที่แล้ว +8

    I cant even explain what you have done.... Awesome🔥

  • @GowthamChandmanikanta
    @GowthamChandmanikanta ปีที่แล้ว +1

    For quiz question 1)
    Num= int(input('enter a number:'))
    if Num>0:
    print("positive")
    if Num

  • @cristaldominguez1834
    @cristaldominguez1834 5 ปีที่แล้ว +9

    OMG you are great at explaining things and your energy is perfect and exciting for teaching

    • @prynka1803
      @prynka1803 4 ปีที่แล้ว

      Where are you from

    • @vishalmane3139
      @vishalmane3139 11 หลายเดือนก่อน

      latina@@prynka1803

  • @thetechpower35
    @thetechpower35 3 ปีที่แล้ว +2

    1)
    x=int(input ('Enter a number'))
    If x>0:
    Print("Number is positive ")
    Else :
    Print("Number is negative ")
    ----------------------------------------------------
    2)
    x =int(input ("Enter 1st values"))
    y =int(input ("Enter 2nd values"))
    z =int(input ("Enter 3rd values"))
    If x>y & x>z:
    print("Greater value is x")
    elseif y>x & y>z:
    Print("Greater number is y")
    elseif z>x & z>y :
    Print("Greater number is z")

  • @YesubabuAttili-jk7sj
    @YesubabuAttili-jk7sj 3 หลายเดือนก่อน +18

    Who is watching in 2024👇

  • @23_sid73
    @23_sid73 4 ปีที่แล้ว +2

    Actually ,I started learning python from here only and I'm feeling very lucky I got this wonderful series on python and learning python from such a great tutor the explanation is really great .. thank you sir

  • @luckyprathyusha7135
    @luckyprathyusha7135 5 ปีที่แล้ว +13

    n=int(input("enter a no:"))
    if n>=0:
    print("n is a positive no")
    else:
    print("n is a negative no")

    • @prasanthm4161
      @prasanthm4161 3 ปีที่แล้ว

      What is the use of elif and why we use

  • @yashikagupta644
    @yashikagupta644 4 ปีที่แล้ว +1

    1)
    a= int (input ("enter number"))
    if a ==0:
    print ("zero")
    elif a>0:
    print (" postive number")
    elif a

  • @srinithi7757
    @srinithi7757 4 ปีที่แล้ว +2

    Sir u r great 🙏
    I'm in class 12 since I don't have any good teachers .......
    U r good 😊
    THANK YOU TELUSKO

  • @pisthaoct03
    @pisthaoct03 4 ปีที่แล้ว +8

    To get all 3 input in one line:
    x,y,z = int(input('Enter first number: ')), int(input('Enter second number: ')), int(input('Enter third number: '))

    • @sajalgpt8
      @sajalgpt8 3 ปีที่แล้ว

      x,y,z=int(input("1st Number")),int(input("2nd Number")),int(input("3rd Number"))
      if(x>y&x>z):
      print(x)
      elif(y>z):
      print(y)
      else:
      print(z)

    • @prasanthm4161
      @prasanthm4161 3 ปีที่แล้ว

      @@sajalgpt8 what is the use of elif and why we use elif

  • @harikrishna8060
    @harikrishna8060 ปีที่แล้ว +1

    1.
    a= values
    if a>0:
    print('positive')
    else:
    print("negative').
    2.
    a,b,c=5,8,11
    if a>b and a>c:
    print('a is highest')
    if a

  • @Pavankumar-su4hl
    @Pavankumar-su4hl 4 ปีที่แล้ว +3

    Sir jst few months got a software job in infosys, now learning python 😍

  • @zakiasmaa6834
    @zakiasmaa6834 2 หลายเดือนก่อน

    Your teachings are “Easy to understand” & you make it so much more fun and interesting. Thank you so much

  • @ranitde463
    @ranitde463 4 ปีที่แล้ว +2

    You are the one who helps in programming a lot.Thanks a lot sir😀☺☺☺☺😮

  • @NaveenKumar-ov7pd
    @NaveenKumar-ov7pd 3 ปีที่แล้ว

    Solution for Q1:
    ----------------
    x = int(input("Enter the value for x: "))
    if x > 0:
    print("This is Positive Number")
    else:
    print("This is Negative Number")
    Solution for Q2:
    -----------------
    a = int(input("Enter the a value: "))
    b = int(input("Enter the b value: "))
    c = int(input("Enter the c value: "))
    if a>b and a>c:
    print("a is greater")
    elif b>c and b>a:
    print("b is greater")
    else:
    print("c is greater")
    Awesome Navin Garu...your just sharing your valuable knowledge to soceity ...Great Service......Thank you so much

  • @ishanthmishra7658
    @ishanthmishra7658 4 ปีที่แล้ว +20

    . Solution to question in the end
    l=int(input ("v1"))
    m=int(input ("v2"))
    n=int( input ("v3"))
    set=[l,m,n]
    print( max(set))

    • @appurvaagarwal5567
      @appurvaagarwal5567 4 ปีที่แล้ว +2

      While this is correct, I think the purpose of the assignment was to use if and elif operators as well.

    • @erz_mafia
      @erz_mafia 4 ปีที่แล้ว +1

      @@appurvaagarwal5567 x =float(input('enter the 1st value:'))
      y =float(input('enter the 2nd value:'))
      z =float(input('enter the 3rd value:'))
      if x>y and x>z:
      print (""+str(x)+"" ' is the greatest value')
      elif y>x and y>z:
      print(""+str(y)+"" ' is the greatest value')
      elif z>x and z>y:
      print(""+str(z)+ "" ' is the greatest value')

    • @aromala.j3938
      @aromala.j3938 4 ปีที่แล้ว +2

      @@appurvaagarwal5567 yeah true

  • @MrObadebella
    @MrObadebella 3 หลายเดือนก่อน

    1st q:
    x = 34
    if(x>0):
    print("positive")
    else:
    print("negative")
    second q:
    a = int(input("enter n1 input"))
    b = int(input("enter n2 input"))
    c = int(input("enter n3 input"))
    if a>b and b>c:
    print("a is the largest number")
    elif ac:
    print("b is the largest number")
    elif a

  • @RAMAKRISHNA-iu3ow
    @RAMAKRISHNA-iu3ow 6 ปีที่แล้ว +35

    x = -10
    if x

    • @manchikatlavamshi1220
      @manchikatlavamshi1220 4 ปีที่แล้ว

      It prints NEGATIVE

    • @vasusharma413
      @vasusharma413 4 ปีที่แล้ว +3

      @@manchikatlavamshi1220 Use this code
      a = int(input('enter a number')
      If a >= 0:
      Print ('positive')
      Else :
      Print ('negative')

    • @kushagrarai7799
      @kushagrarai7799 4 ปีที่แล้ว +3

      what if user enters 0?? must havr condition for zero

  • @anmol3457
    @anmol3457 4 ปีที่แล้ว

    Programme to find out the greatest among three numbers
    num1=int(input("enter the first number:"))
    num2=int(input("enter the seond number:"))
    num3=int(input("enter the third number:"))
    x=max(num1,num2,num3)
    print(x, "is the largest number")
    Thanks for the video!

  • @abhinavverma5859
    @abhinavverma5859 5 ปีที่แล้ว +5

    x = int(input("1st number: "))
    y = int(input("2nd number: "))
    z = int(input("3rd number: "))
    a = [x,y,z]
    print("The greatest number is",max(a))

    • @vineetsingh4318
      @vineetsingh4318 5 ปีที่แล้ว +1

      easy way to do this:-
      a.sort()
      print(a[2])

    • @bodalasagarika3539
      @bodalasagarika3539 5 ปีที่แล้ว

      y dont we write as x=int(input('enter 3 nums'))[2]

    • @dharaniimmareddy4489
      @dharaniimmareddy4489 4 ปีที่แล้ว

      @@bodalasagarika3539 only index of 2 value assigns to x

  • @arutlarahul338
    @arutlarahul338 6 หลายเดือนก่อน

    Best tutor ever in my software learning. Thank you Navin Reddy.

  • @harshvora1922
    @harshvora1922 5 ปีที่แล้ว +12

    Greater in three numbers:
    x = int(input("Enter 1st number: "))
    y = int(input("Enter 2nd number: "))
    z = int(input("Enter 3rd number: "))
    result = (x, y, z)
    print(max(result))

    • @ashiqmohamed6675
      @ashiqmohamed6675 5 ปีที่แล้ว

      how it works
      result=(x,y,z)
      can you explain this line

    • @DrowsyElephant
      @DrowsyElephant 5 ปีที่แล้ว +1

      @@ashiqmohamed6675 you can use print(max(x,y,z)) works the same way

    • @ashiqmohamed6675
      @ashiqmohamed6675 5 ปีที่แล้ว

      @@DrowsyElephant thank you

    • @chandsujoy
      @chandsujoy 5 ปีที่แล้ว +2

      Thanks Harsh this works well , but any suggestion on how to handle this using the if , elif , else loop

    • @harshal1611
      @harshal1611 4 ปีที่แล้ว

      It is wrong

  • @im_tori1
    @im_tori1 ปีที่แล้ว

    I started learning python with udemy last month, got so confused that I had to use other methods, you have a great style of teaching and it has helped improved my knowledge of python❤

  • @sahilprasantachoudhury911
    @sahilprasantachoudhury911 4 ปีที่แล้ว +3

    Code for 2nd question:
    a=int(input ('enter first number'))
    b=int(input ('enter second number'))
    c=int(input ('enter third number'))
    num=max(a,b,c)
    print(num)

  • @arikhehelol
    @arikhehelol 4 หลายเดือนก่อน +1

    Assignment #2:
    import math
    x = int(input("Please enter a number: "))
    y = int(input("Please enter a number: "))
    z = int(input("Please enter a number: "))
    a = max(x,y,z)
    print(str(a) + " this is the largest number")

  • @jaybahadurthapa1492
    @jaybahadurthapa1492 4 ปีที่แล้ว +4

    151 thumbs down are the people who doesn't know to appreciate someone's effort to educate people.. Doing selfless services.. For us this teacher is great.. naveen Sir.. U Rock 😎

  • @yogeshkumarshankariya642
    @yogeshkumarshankariya642 3 ปีที่แล้ว +2

    num = []
    for i in range(1,4):
    num.append(int(input(f"Enter the {i} value ")))
    print(max(num))

  • @amit8932
    @amit8932 6 ปีที่แล้ว +7

    x=int(input('enter a number1'))
    y=int(input('enter a number2'))
    if x > y:
    print('x is the greater number')
    else:
    print('y is the greater number')

    • @anuragchauhan2577
      @anuragchauhan2577 6 ปีที่แล้ว +3

      y=int(input())
      z=int(input())
      a=int(input())
      x=[int(y),int(z),int(a)]
      print(max(x),"is largest")

    • @luckyprathyusha7135
      @luckyprathyusha7135 5 ปีที่แล้ว

      @@anuragchauhan2577 here we want to use if else and elif and write the program

  • @awesomelist5812
    @awesomelist5812 2 ปีที่แล้ว

    This is the best python teacher I've ever seen

  • @samarthsaxena3998
    @samarthsaxena3998 5 ปีที่แล้ว +6

    value1 = float(input("Please enter three numbers"))
    value2 = float(input("Please enter three numbers"))
    value3 = float(input("Please enter three numbers"))
    arr = [value1,value2,value3]
    arr.sort()
    print("The higest value is ", arr[2])

  • @adityaroy6901
    @adityaroy6901 4 ปีที่แล้ว

    x=input("Enter 1st value")
    y=input("Enter 2nd value")
    z=input("Enter 3rd value")
    if zy:
    print("1st value is Greatest")
    elif xz:
    print("2nd value is Greatest")
    elif yx:
    print("3rd value is Greatest")

  • @FLASHBOING
    @FLASHBOING 4 ปีที่แล้ว +81

    *before watching*
    me : i hate python
    *after watching some of the vids *
    also me : oh shit im addicted

  • @ScholarStream_25
    @ScholarStream_25 4 ปีที่แล้ว +1

    I just completed a code . Watching you sir . Thanks a lot for your work!!

  • @ramkrishnasen4574
    @ramkrishnasen4574 4 ปีที่แล้ว +4

    Sir,Thank you very much
    because of you I am feeling so confident and enthusiastic in the coding domain inspite of being a mechanical engineering student.
    Love from West bengal

    • @avashpuitandy549
      @avashpuitandy549 4 ปีที่แล้ว +1

      Amazing stuff Sir, You are the best You-tuber for learning Python :)

  • @tanvisolat2819
    @tanvisolat2819 3 ปีที่แล้ว

    This is the most basic one which i hope everyone can understand, i found it easy to type.
    # Find the greatest value.
    x, y, z=(input('enter x: '), input("enter y: "), input("enter z: "))
    float(x), float(y), float(z)
    if x > y and x > z:
    print("The greatest value is", x)
    elif y > x and y > z:
    print('The greatest value is ', y)
    else:
    print('The greatest value is ', z)

  • @FactsDiscoveryyoutube
    @FactsDiscoveryyoutube 5 ปีที่แล้ว +9

    number1 = int(input("Enter the First Number"))
    number2 =int(input("Enter Thee second Number"))
    number3 =int(input("Enter the Third Number"))
    if (number1>number2) and (number1>number3):
    print("Number1 is the grater number")
    elif number2>number1 and number2>number3:
    print("NUmber2 is the greatest Number")

    else:
    print("wow,Number3 is the grater then other")

    • @adarsh6750
      @adarsh6750 5 ปีที่แล้ว

      where is the question LOL

    • @FactsDiscoveryyoutube
      @FactsDiscoveryyoutube 5 ปีที่แล้ว

      @@adarsh6750 kahena kya chate ho?

    • @raGPT
      @raGPT 4 ปีที่แล้ว

      Outstanding bro...

    • @tanmaysingh3882
      @tanmaysingh3882 4 ปีที่แล้ว

      what if num 1< num 2 but num1 is greater than num3? then number 2 is greatest.

    • @matthewmccabe3411
      @matthewmccabe3411 4 ปีที่แล้ว

      yor spaleng iz veri bed

  • @thejunaveen8739
    @thejunaveen8739 3 ปีที่แล้ว

    now a days am addicted to python. thats coz of you sir.thank you so much sir..
    n=int(input("enter an integer"))
    if ny)and(y>z):
    print("'x'is biggest")
    elif (y>x)and(y>z):
    print("'y is biggest")
    else:
    print("'z' is biggest")

  • @superhumanformula3481
    @superhumanformula3481 5 ปีที่แล้ว +4

    x = int(input("int 1 : "))
    y = int(input("int 2 : "))
    z = int(input("int 3 : "))
    highest = max(x, y, z)
    print(highest)

    • @er.waseem8695
      @er.waseem8695 5 ปีที่แล้ว +1

      You can also write it like this as a beginner::
      a=int(input('Enter the 1st no.: '))
      b=int(input('Enter the 2nd no.: '))
      c=int(input('Enter the 3rd no.: '))
      if(a>b and a>c):
      print('the greatet no is',a))
      elif(a>c):
      print('{} is largest'.format(b))
      else:
      print('{} Is largest'.format(c))

    • @shubhrajit2117
      @shubhrajit2117 5 ปีที่แล้ว

      Why only integer?

  • @GowthamChandmanikanta
    @GowthamChandmanikanta ปีที่แล้ว +1

    For quiz question 2.)
    num1=int(input('enter a number :'))
    num2=int(input('enter a number :'))
    num3=int(input('enter a number :'))
    If num1>num2>num3:
    print(num1)
    If num1

  • @mbisur1
    @mbisur1 4 ปีที่แล้ว +7

    Here are the codes:
    Positive/Negative:
    x = int(input("Enter any integer value: "))
    if (x >= 0):
    print(" Positive")
    else:
    print("Negative")
    Maximum number:
    x = int(input("Enter the value of x: "))
    y = int(input("Enter the value of y: "))
    z = int(input("Enter the value of z: "))
    if max(x,y,z) == x :
    print(x)
    elif max(x,y,z) == y :
    print(y)
    elif max(x,y,z) == z :
    print(z)

    • @dishantgupta7130
      @dishantgupta7130 4 ปีที่แล้ว

      Enter input values as x = 10
      y = 9
      Z = 9
      U will get 9 Y is greatest
      Idk why

  • @hallo-xp2wh
    @hallo-xp2wh 3 ปีที่แล้ว +1

    print("enter 3 numbers")
    numbers=[input(),input(),input()]
    x=max(numbers)
    print(x, "is greatest of all")

  • @rohankiratsata1161
    @rohankiratsata1161 5 ปีที่แล้ว +31

    a=int(input("1st no"))
    b=int(input("2nd"))
    c=int(input("3rd"))
    num=[a,b,c]
    num.sort()
    #IT WILL SORT NO. IN ASCENDING ORDER
    print(num[2])

    • @vineetsingh4318
      @vineetsingh4318 5 ปีที่แล้ว +2

      i think the sort list will be print like this "print(num)"

    • @rohankiratsata1161
      @rohankiratsata1161 5 ปีที่แล้ว

      @@vineetsingh4318 no

    • @MaulikSrivastava
      @MaulikSrivastava 5 ปีที่แล้ว +4

      You can also use max(num). This will directly give the greatest no.

    • @MaulikSrivastava
      @MaulikSrivastava 5 ปีที่แล้ว +1

      @@vineetsingh4318 it doesn't really matter, the list will be stored in the computer anyway

    • @scripttag9235
      @scripttag9235 5 ปีที่แล้ว

      a = int(input("1st no"))
      b = int(input("2nd"))
      c = int(input("3rd"))
      li = [a,b,c]
      li.sort()
      print(li)
      Like this?

  • @sankellapavan5361
    @sankellapavan5361 4 ปีที่แล้ว +1

    one of best tutor i have seen!!!!!

  • @parthvats4209
    @parthvats4209 5 ปีที่แล้ว +9

    ir this is your answer
    x = int(input("enter the number - "))
    if x > 0 :
    print("positive integer")
    else :
    print("negative integer ")
    hope it is correct

    • @MaulikSrivastava
      @MaulikSrivastava 5 ปีที่แล้ว +1

      This is kinda correct. You should put an elif statement just in case x=0

  • @shabad_ae_safar
    @shabad_ae_safar 3 ปีที่แล้ว

    You r great teacher not only for giving such a great knowledge only also because u makes coding so intresting. I love the way of your teaching❤.
    Thanku so much..

  • @sonalparashar1576
    @sonalparashar1576 4 ปีที่แล้ว +4

    His programming teaching skills are on another level😁😀

  • @owenkosimontekhumalo5653
    @owenkosimontekhumalo5653 4 ปีที่แล้ว +1

    1.
    x=2.995
    if x >=0:
    print("Positive Value")
    else:
    print("Negative Value")
    2.
    print("Welcome to the greatest value calculator, enter three values to begin")
    x= int(input('Enter First Number'))
    y= int(input('Enter Second Number'))
    z= int(input('Enter Last Number'))
    if x>y and x>z:
    print(x)
    elif y>x and y>z:
    print(y)
    elif z>y and z>x:
    print(z)
    else:
    print("Values are Equal or Wrong Input")

  • @olivekuchri
    @olivekuchri 4 ปีที่แล้ว +7

    set=[2,1,4,5]
    set.sort()
    print(set)
    print(max(set))

    • @milanbariya4914
      @milanbariya4914 4 ปีที่แล้ว +5

      You don't need to sort that list...

  • @akshaysingh2237
    @akshaysingh2237 4 ปีที่แล้ว +3

    First Answer=
    x=int(input('write the number')
    if x

  • @om7289
    @om7289 5 ปีที่แล้ว +1

    x = int(input("no."))
    If x < 0 :
    print ('Negative')
    Elif (x > 0) :
    print ('Positive')
    Elif (x == 0) :
    print ('Zero')
    HW done
    Enjoying it!!!

  • @sachintak9600
    @sachintak9600 4 ปีที่แล้ว +3

    Really interesting and fun to watch ❤

  • @nagashreebhat6113
    @nagashreebhat6113 4 ปีที่แล้ว

    sir, you are too good at teaching. and your edits makes easy to learn. you explain every simple thing ,, so that we will understand completly.

  • @mycreations3452
    @mycreations3452 6 ปีที่แล้ว +37

    I observed that something different in this channel...

    • @harshavardhandsh5190
      @harshavardhandsh5190 5 ปีที่แล้ว +2

      Perhaps I am unable to concatenate Ex. z=min(a,b,c) print("Min number is " + z) OR print("Min number is ") & z

    • @parthd4677
      @parthd4677 5 ปีที่แล้ว +3

      @@harshavardhandsh5190 try this:- print("Min number is " , z)

    • @Sivanandiniganji
      @Sivanandiniganji 5 ปีที่แล้ว

      I dnt understand

    • @CultOfJ
      @CultOfJ 4 ปีที่แล้ว +2

      @@harshavardhandsh5190 else:- print( "Min number is" + str(z) )
      as because z is an integer so we need to convert it to string either by writing str(your integer) or print("Your statement" , your integer)

  • @adityatanwar1561
    @adityatanwar1561 3 ปีที่แล้ว

    x, y, z = input("Enter a three value: ").split()
    if x>y and x>z :
    print ('x is largest')
    elif y>z and y>x :
    print('y is largest')
    else :
    print('z is largest')

  • @sanjeevpandey2753
    @sanjeevpandey2753 5 ปีที่แล้ว +5

    Sir, colon is missed at the end :-) I tried running