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

  Рет қаралды 1,363,094

Telusko

Telusko

Күн бұрын

Check out our courses:
Spring Framework 8 Full-Day Course Live: go.telusko.com...
Coupon: TELUSKO10 (10% Discount)
Enterprise Java Spring Microservices: go.telusko.com...
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com...
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
Spring: go.telusko.com...
Java:- go.telusko.com...
Java Spring:- go.telusko.com...
Java For Programmers:- go.telusko.com...
Python : go.telusko.com...
Git : go.telusko.com...
Docker : go.telusko.com...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusk...
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
In this lecture we will learn:
- Different units of a CPU
- Conditional statements in Python
- If and Else statements
- Execution of conditional blocks
- What is Indentation in Python?
- Nested if and else statements
- if, elif and else statements
#1
- CPU has three parts: CU (Control Unit), ALU ( Arithmetic Logic Unit) and MU ( Memory unit).
- MU is used to store variables and data.
- ALU has two parts:
1. AU - Arithmetic Unit ( it performs mathematical calculations)
2. LU - Logical Unit ( it makes a computer think something)
#2
If statement:-
- In programming, we have to apply conditions as per the logic of the code. In python, conditions can be applied through the if keyword.
- Use of the if keyword specifies the flow of execution of the code.
- Based on the condition of the problem statement, if keyword helps to decide which set of statements should be executed.
Syntax:-
if (condition):
statement;
- The statements of the if block will be executed only when the condition of the if statement is true. If the condition is false then it will skip the execution of statements present inside the if block.
- If consists of a block where you can write multiple statements. In python, it is also known as Suite.
#2
Indentation:-
- In Python, we have to follow certain indentations that specify the conditions that are present inside a certain block.
- Indentation simply means a certain number of spaces at the beginning of a code line.
- Indentation increases the readability of the code.
#3
Else block:-
- We can also use multiple if blocks in a code.
- Multiple uses of the if block decrease the efficiency of a code as the condition will be checked again and again in each if block.
- To make the code efficient, we use the else block.
- If the condition of the if block is true then the else block will be skipped. And if the condition of the if block is false then the else block will be checked and executed.
#4
Nested if and else statements:-
- Nested if and else statements are also allowed in Python.
- if statement can also be checked inside other if statement. This conditional statement is called a nested if statement.
- In nested, the inner if condition will be checked only if the outer if condition is true and that helps to see multiple conditions to be satisfied.
- Round brackets for putting a condition in the if statement is optional.
#5
if, elif and else statements:-
- elif stands for if-else.
- The if-elif statement is a shortcut of if..else chain.
- If the if condition s false, then the condition inside the elif will be checked and executed.
- While using if-elif statement at the end else block is added that will be executed when none of the above if-elif statements is true.
Github :- github.com/nav...
Python for Beginners :- bit.ly/3JOLQhl
Editing Monitors :
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Java:- bit.ly/JavaUde...
Spring:- bit.ly/SpringU...
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com

Пікірлер: 1 700
@knucklesandwich8786
@knucklesandwich8786 2 жыл бұрын
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.
@mrboat3749
@mrboat3749 Жыл бұрын
Same
@rohitchauhan7721
@rohitchauhan7721 3 жыл бұрын
(1). a=int(input('enter any integer:')) if a>0: print('this is positive integer') elif a
@mrenergy989
@mrenergy989 6 ай бұрын
Bro u can use 0 rather than nor positive nor negative
@m_sitso
@m_sitso 6 ай бұрын
this code will give an error: line 7 error 'this is neither positive nor negative' not defined
@Lolsnni_lakshmi
@Lolsnni_lakshmi 5 ай бұрын
x = int(input("enter a number") if x
@dhruvsharma2795
@dhruvsharma2795 4 жыл бұрын
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
@manavsingla3143
@manavsingla3143 4 жыл бұрын
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 3 жыл бұрын
I agree. Best I have seen
@sundari7846
@sundari7846 3 жыл бұрын
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.
@FLASHBOING
@FLASHBOING 4 жыл бұрын
*before watching* me : i hate python *after watching some of the vids * also me : oh shit im addicted
@unknownme7177
@unknownme7177 3 жыл бұрын
Achaa
@dhyeythetechmaster8840
@dhyeythetechmaster8840 3 жыл бұрын
true
@pratyushranjanbal5824
@pratyushranjanbal5824 3 жыл бұрын
Yeah
@sudheerreddy874
@sudheerreddy874 3 жыл бұрын
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 жыл бұрын
game of thrones ❤️😌
@vinaykumarsai1217
@vinaykumarsai1217 3 жыл бұрын
bro ee tutorial mimmalni strong chesindha python basics and coding lo
@mrenergy989
@mrenergy989 6 ай бұрын
And also you can use float because we can use more values
@bharathreddy6208
@bharathreddy6208 5 жыл бұрын
Really awesome class sir. I'm addicted to your teaching
@sundari7846
@sundari7846 3 жыл бұрын
Me too
@thetechtimes
@thetechtimes 3 жыл бұрын
@@sundari7846 I'm also
@dailysiva2582
@dailysiva2582 3 жыл бұрын
*Yeah... it's 💯 correct*
@satyanarayanavempali8511
@satyanarayanavempali8511 3 жыл бұрын
Me also
@saimeghana6371
@saimeghana6371 3 жыл бұрын
Me too
@jaganathg3137
@jaganathg3137 3 жыл бұрын
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 9 ай бұрын
WhAts happens when the to values are Same but not third one ..
@q2success352
@q2success352 5 жыл бұрын
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 жыл бұрын
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)
@vikasgarg7929
@vikasgarg7929 4 жыл бұрын
I have purchased many python courses from different sites but i m learning from him haha... great guy :)
@tejaswibhargava8745
@tejaswibhargava8745 6 жыл бұрын
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 . 😇😇☺️
@divyag7854
@divyag7854 4 жыл бұрын
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
@mrlokeshkumar76
@mrlokeshkumar76 3 жыл бұрын
x = -5 if x > 0: print("positive") else: print("negative")
@mdrashidnazir7520
@mdrashidnazir7520 3 жыл бұрын
print("Welldone")
@mrajesh9763
@mrajesh9763 3 жыл бұрын
x=int(input("enter the value: ")
@BalaganeshPichuka
@BalaganeshPichuka 21 күн бұрын
😂​@@mdrashidnazir7520
@GurjeetSingh-gy1xo
@GurjeetSingh-gy1xo 2 жыл бұрын
Imagine getting a heart from Navin Sir
@sanketthakre309
@sanketthakre309 4 жыл бұрын
Others : 1.25x Telusko : 0.75x
@mohithalder3169
@mohithalder3169 3 жыл бұрын
I use 1.75x
@sumittiwari5836
@sumittiwari5836 3 жыл бұрын
I also...
@Limmeno
@Limmeno 3 жыл бұрын
its bcz not everyone is at same position :) lol
@YesubabuAttili-jk7sj
@YesubabuAttili-jk7sj 2 ай бұрын
Who is watching in 2024👇
@bishwanathpandey2207
@bishwanathpandey2207 5 жыл бұрын
I am in love with programming just because of you sir. Thank you for your strong support
@josephnduati4344
@josephnduati4344 4 жыл бұрын
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 жыл бұрын
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
@jubairpial9744
@jubairpial9744 5 жыл бұрын
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 3 жыл бұрын
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 жыл бұрын
bro its work
@mainios126bobeats4
@mainios126bobeats4 3 жыл бұрын
one line ver of this is print(max(map(int, (input('1st number: '), input('2nd number: '), input('3rd number: ')))))
@gayatri3899
@gayatri3899 3 жыл бұрын
@@mainios126bobeats4 I think u should write int as well
@PawanKumar-ol5sl
@PawanKumar-ol5sl 3 жыл бұрын
You can put is greatest number with x, y, z.
@jabuto-farmnigeria8626
@jabuto-farmnigeria8626 4 жыл бұрын
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 жыл бұрын
Your 1 st code is correct bt in second code u should apply if else logic
@vinayakkulkarni1303
@vinayakkulkarni1303 4 жыл бұрын
@@shreyachavan7460 pls can u say how? 🙏🙏
@Siddharth153
@Siddharth153 4 жыл бұрын
@@shreyachavan7460 first one IndentationError: unexpected indent
@n8panther5
@n8panther5 4 жыл бұрын
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)
@just_a_living_being
@just_a_living_being 6 жыл бұрын
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 😊”
@sandhya9544
@sandhya9544 4 жыл бұрын
S .... sir
@vinodkashyap4962
@vinodkashyap4962 4 жыл бұрын
Right bro
@friendlycreeper1045
@friendlycreeper1045 4 жыл бұрын
Correct
@awesomebrotherhood7698
@awesomebrotherhood7698 4 жыл бұрын
its like a sandbox game, have fun making mistakes
@sitakumari35y38
@sitakumari35y38 3 жыл бұрын
Yes sir
@nigampratap2466
@nigampratap2466 4 жыл бұрын
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")
@rituwadhwa22
@rituwadhwa22 4 жыл бұрын
Thanks alot
@nigampratap2466
@nigampratap2466 4 жыл бұрын
@@rituwadhwa22 ok..😊
@rachitkumar1497
@rachitkumar1497 6 жыл бұрын
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') elif y>x and y>z: print('Y is the largest') else: print('Z is the largest')
@Vasudev_R
@Vasudev_R 6 жыл бұрын
What if both two numbers are same....
@varshithreddy5104
@varshithreddy5104 6 жыл бұрын
RAJU in the above program instead of x>y put x>=y
@anuragchauhan2577
@anuragchauhan2577 5 жыл бұрын
y=int(input()) z=int(input()) a=int(input()) x=[int(y),int(z),int(a)] print(max(x),"is largest")
@shyamaraji8196
@shyamaraji8196 5 жыл бұрын
@@anuragchauhan2577 ..why do u want to use int(y), Int(z),int(a)..you have converted already and stored in y,z,a ..why don't we use it directly in list.
@suchitramitra418
@suchitramitra418 5 жыл бұрын
can this be done using single input??
@andymyung1132
@andymyung1132 3 жыл бұрын
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
@varunkhatri6639
@varunkhatri6639 5 жыл бұрын
Stop calling us aliens I don't wanna end up being locked at area 51 😂😂
@itz_patrickb.l5785
@itz_patrickb.l5785 4 жыл бұрын
hahahahahaah true
@theai2020
@theai2020 4 жыл бұрын
And it's if not ef
@nishagupta3847
@nishagupta3847 4 жыл бұрын
Sometimes I also think to write this 🤭🤭🤣🤣🤣 but.....
@kartikvishwakarma4875
@kartikvishwakarma4875 4 жыл бұрын
hahaahahahahaah
@gayathribabu1772
@gayathribabu1772 4 жыл бұрын
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")
@lyricsbooth802
@lyricsbooth802 2 жыл бұрын
Thank you so much
@hasibkhan8600
@hasibkhan8600 5 жыл бұрын
1st question answer: num = int(input("Enter a number: ")) if num > 0: print("positive.") else: print("Negative.")
@soumyaranjanpanda585
@soumyaranjanpanda585 4 жыл бұрын
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 жыл бұрын
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 жыл бұрын
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.....
@mycreations3452
@mycreations3452 6 жыл бұрын
I observed that something different in this channel...
@harshavardhandsh5190
@harshavardhandsh5190 5 жыл бұрын
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 жыл бұрын
@@harshavardhandsh5190 try this:- print("Min number is " , z)
@Sivanandiniganji
@Sivanandiniganji 5 жыл бұрын
I dnt understand
@CultOfJ
@CultOfJ 4 жыл бұрын
@@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)
@moumitasaha1172
@moumitasaha1172 3 жыл бұрын
Bacame a Python lover in 2 hours. You have amazing teaching skills and it must be appreciated. Thankyou so much.
@abhinavverma5859
@abhinavverma5859 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 жыл бұрын
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
@RahulBarodiaBCS
@RahulBarodiaBCS 3 жыл бұрын
n1=int(input()) n2=int(input()) n3=int(input()) if n1>n2 and n2>n3: print('n1 is maximum') elif n1n3: print('n2 is maximum') else: print('n3 is maximum')
@RAMAKRISHNA-iu3ow
@RAMAKRISHNA-iu3ow 5 жыл бұрын
x = -10 if x
@manchikatlavamshi1220
@manchikatlavamshi1220 4 жыл бұрын
It prints NEGATIVE
@vasusharma413
@vasusharma413 4 жыл бұрын
@@manchikatlavamshi1220 Use this code a = int(input('enter a number') If a >= 0: Print ('positive') Else : Print ('negative')
@kushagrarai7799
@kushagrarai7799 4 жыл бұрын
what if user enters 0?? must havr condition for zero
@mbisur1
@mbisur1 4 жыл бұрын
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
@samarthsaxena3998
@samarthsaxena3998 5 жыл бұрын
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])
@shubhrajit2117
@shubhrajit2117 5 жыл бұрын
What if all 3 are equal?
@damansharma6737
@damansharma6737 5 жыл бұрын
@@shubhrajit2117 lol
@aryanranajind7698
@aryanranajind7698 3 жыл бұрын
How many of are from 11 th as well as 12 th 🙋🙋🙋‍♀️
@ishanthmishra7658
@ishanthmishra7658 4 жыл бұрын
. 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 жыл бұрын
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 жыл бұрын
@@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 жыл бұрын
@@appurvaagarwal5567 yeah true
@siddhantdahale2056
@siddhantdahale2056 4 жыл бұрын
x = int(input("enter a number = ")) if x>0: print("positive") else: print("negative")
@shalinipandit938
@shalinipandit938 4 жыл бұрын
Bt what if number is 0
@siddhantdahale2056
@siddhantdahale2056 4 жыл бұрын
Check thus then, x = int(input("enter a number = ")) if x>=0: print("positive") else: print("negative")
@flickzz0p756
@flickzz0p756 5 жыл бұрын
I cant even explain what you have done.... Awesome🔥
@thetechpower35
@thetechpower35 3 жыл бұрын
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")
@bilalrehman989
@bilalrehman989 3 жыл бұрын
great man
@cristaldominguez1834
@cristaldominguez1834 5 жыл бұрын
OMG you are great at explaining things and your energy is perfect and exciting for teaching
@prynka1803
@prynka1803 3 жыл бұрын
Where are you from
@vishalmane3139
@vishalmane3139 10 ай бұрын
latina@@prynka1803
@pisthaoct03
@pisthaoct03 4 жыл бұрын
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
@gouthamu5424
@gouthamu5424 4 жыл бұрын
Your Videos are really helpful!! I let all the ads run completely so that I can contribute something to you.
@mithinthegamer69
@mithinthegamer69 3 жыл бұрын
dude please switch to dark mode 😂
@shubhamshivgunde5847
@shubhamshivgunde5847 5 жыл бұрын
n1=int(input("Enter 1st no")) n2=int(input("Enter 2st no")) n3=int(input("Enter 3st no")) if((n1>n2)and(n1>n3)): print(n1,"is greatest") elif(n2>n3): print(n2,"is greatest") else: print(n3,"is greatest")
@GurpreetSingh-td4es
@GurpreetSingh-td4es 4 жыл бұрын
x=input("enter the first number") y=input("enter the second number") z=input("enter the third number") if (int(x)>int(y)): if(int(x)>int(z)): print("x is the greator number") elif(int(y)>int(z)): print("y is the greator number") else: print("z is the greator number")
@luckyprathyusha7135
@luckyprathyusha7135 5 жыл бұрын
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
@LOKESHMC-wg1sd
@LOKESHMC-wg1sd Жыл бұрын
Learning in 2023 it's just awesome u are making me to interest to learn
@piyushshinde1533
@piyushshinde1533 Жыл бұрын
since 4 days i was confused between nested if and elif, now fully understood the difference between them . Thank you so much sir!!🙏
@shrutiagrawal8015
@shrutiagrawal8015 4 жыл бұрын
number1 = int(input('Write your first number of choice')) number2 = int(input('Write your second number of choice')) number3 = int(input('write your third number of choice')) z = max(number1,number2,number3) print('your maximum number is:') print(z)
@sahilprasantachoudhury911
@sahilprasantachoudhury911 4 жыл бұрын
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 3 ай бұрын
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")
@asmitabagchi6886
@asmitabagchi6886 3 жыл бұрын
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
@1gamerCasual10
@1gamerCasual10 9 ай бұрын
num = int(input("Type a positive or negative number: ")) if num >= 1: print("positive number ") elif num == 0: print("Neutral number ") else: print("Negative number ") print("let's compare the values ? ") num1 = int(input("Type first number: ")) num2 = int(input("Type second number: ")) num3 = int(input("Type thrird number: ")) if (num1 > num2 and num1 > num3): print("The largest number is the number entered was " + str(num1)) elif (num2 > num1 and num2 > num3): print("The largest number is the number entered was " + str(num2)) elif (num3 > num1 and num3 > num2): print("The largest number is the number entered was " + str(num3))
@kaviyar4814
@kaviyar4814 4 жыл бұрын
Ur way of teaching is so awesome.... and as a fresher , I learned more and become craze on python😁
@mikegaspar900
@mikegaspar900 9 ай бұрын
#Exersice Python m = int(input('Enter the number m:')) if m0: print("The number m is positive") else: print("The number m is neither positive nor negative")
@rohankiratsata1161
@rohankiratsata1161 5 жыл бұрын
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 жыл бұрын
i think the sort list will be print like this "print(num)"
@rohankiratsata1161
@rohankiratsata1161 5 жыл бұрын
@@vineetsingh4318 no
@MaulikSrivastava
@MaulikSrivastava 5 жыл бұрын
You can also use max(num). This will directly give the greatest no.
@MaulikSrivastava
@MaulikSrivastava 5 жыл бұрын
@@vineetsingh4318 it doesn't really matter, the list will be stored in the computer anyway
@scripttag9235
@scripttag9235 4 жыл бұрын
a = int(input("1st no")) b = int(input("2nd")) c = int(input("3rd")) li = [a,b,c] li.sort() print(li) Like this?
@ojasgupta9596
@ojasgupta9596 3 жыл бұрын
* your answers are * x = int(input('Number:')) if x > 0: print('Positive') else: print('Negative') THIS IS FOR FIRST PART x = int(input('first number: ')) y = int(input('second number :')) z = int(input('third number :')) if x > y and x > z: print('your greatest number is = ') print(x) elif y > x and y > z: print('your greatest number is = ') print(y) else: print('your greatest number is = ') print(z) FOR SECOND PART
@bhavnashard5327
@bhavnashard5327 3 жыл бұрын
In last statement..... else print('Wrong Input') Colon(:) is missing
@smartstudywithaj6259
@smartstudywithaj6259 2 жыл бұрын
Sir I am unable to download python in my computer.What may be the possible reason for this.Sir please tell me.My computer is windows 7.🙏🙏🙏🙏🙏
@FactsDiscoveryyoutube
@FactsDiscoveryyoutube 5 жыл бұрын
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 4 жыл бұрын
where is the question LOL
@FactsDiscoveryyoutube
@FactsDiscoveryyoutube 4 жыл бұрын
@@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
@GowthamChandmanikanta
@GowthamChandmanikanta Жыл бұрын
For quiz question 1) Num= int(input('enter a number:')) if Num>0: print("positive") if Num
@superhumanformula3481
@superhumanformula3481 5 жыл бұрын
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 жыл бұрын
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?
@owenkosimontekhumalo5653
@owenkosimontekhumalo5653 4 жыл бұрын
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")
@sanjeevpandey2753
@sanjeevpandey2753 5 жыл бұрын
Sir, colon is missed at the end :-) I tried running
@a.y.making931
@a.y.making931 3 жыл бұрын
ANSWER- 1ST QUES. x = -2 >>> if x >= 0: print("positive") else: print("negative") 2ND QUES. a = int(input("enter 1st no")) >>> b = int(input("enter 2nd no")) >>> c = int(input("enter 3rd no")) >>> if a >=b and a >= c: print(a) elif b >= c and b >= a: print(b) else: print(c)
@harshvora1922
@harshvora1922 5 жыл бұрын
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 жыл бұрын
@@ashiqmohamed6675 you can use print(max(x,y,z)) works the same way
@ashiqmohamed6675
@ashiqmohamed6675 5 жыл бұрын
@@DrowsyElephant thank you
@chandsujoy
@chandsujoy 5 жыл бұрын
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
@akshatsrivastava3733
@akshatsrivastava3733 3 жыл бұрын
A=int(input("Enter no 1")) B=int(input("Enter no 2")) C=int(input("Enter no 3")) if(A>B and A>C): print("No 1 is the greatest number") if(B>A and B>C): print("No 2 is the greatest number") if(C>A and C>B): print('No 3 is the greatest number') else: print('no result')
@samuelkiran5896
@samuelkiran5896 5 жыл бұрын
Your teachings are “Easy to understand” & you make it so much more fun and interesting. Thank you!
@GowthamChandmanikanta
@GowthamChandmanikanta Жыл бұрын
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
@prynka1803
@prynka1803 3 жыл бұрын
Really osm explanation I am often confused with if,elif,else Now all my doubts is clear Thank you so much sir...
@shruts_thegirl
@shruts_thegirl 2 жыл бұрын
# largest of three numbers x = int(input("Enter a number: ")) y = int(input("Enter a number: ")) z = int(input("Enter a number: ")) if (x>y) and (x>z): print("x is greater than y and z") elif (y>z) and (y>x): print("y is greater than x and z") else: print("z is greatest number")
@parthvats4209
@parthvats4209 5 жыл бұрын
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 жыл бұрын
This is kinda correct. You should put an elif statement just in case x=0
@EmoAmoeba
@EmoAmoeba 4 жыл бұрын
#1 Check if nos are positive or negative x = int(input("Enter any integer ")) if (x>0): print("You're quite positive bro") elif(x==0): print("AHHHHH i see what you did there, 0") else: print("EWWWW the negativity")
@syedamirali3205
@syedamirali3205 2 жыл бұрын
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 7 күн бұрын
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 7 күн бұрын
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 7 күн бұрын
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)
@anshjoshi205
@anshjoshi205 3 жыл бұрын
1- import math x =int(input("Enter a number")) y = x**2 z = x - math.sqrt(y) if z ==0: print("positive") else: print("negative") 2- a = int(input("Enter 1st number")) b = int(input("Enter 2nd number")) c = int(input("Enter 3rd number")) if a>b: if a>c: print("a is largest") else: print("c is largest") else: print("b is largest")
@olivekuchri
@olivekuchri 4 жыл бұрын
set=[2,1,4,5] set.sort() print(set) print(max(set))
@milanbariya4914
@milanbariya4914 4 жыл бұрын
You don't need to sort that list...
@milanbariya4914
@milanbariya4914 4 жыл бұрын
🤓 Quiz Answer 🤓 Take three values from user and find the greatest number from them. Answer : num1 = int(input("Enter 1st number :")) num2 = int(input("Enter 2nd number :")) num3 = int(input("Enter 3rd number :")) if num1 >= num2 and num1 >= num3: print(num1, "Is greatest number") elif num2 >= num1 and num2 >= num3: print(num2, "Is greatest number") else: print(num3, "Is greatest number")
@vemorphose1167
@vemorphose1167 5 жыл бұрын
14:58 you forgot to put In a colon after else...
@vishnupriyam2926
@vishnupriyam2926 4 жыл бұрын
2nd problem : x = int(input("Enter the first value:")) y = int(input("Enter the first value:")) z = int(input("Enter the first value:")) if x > y and x > z : print("woahh! x is greater") elif y > x and y > z : print ("woahh! y is greater") else : print("woahh! z is greater") 1st problem: i = int(input("enter the number")) if i
@kamatisjuice
@kamatisjuice 4 жыл бұрын
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.
@yashikagupta644
@yashikagupta644 3 жыл бұрын
1) a= int (input ("enter number")) if a ==0: print ("zero") elif a>0: print (" postive number") elif a
@shivajishinde1496
@shivajishinde1496 6 жыл бұрын
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!
@praneethpydimarry6032
@praneethpydimarry6032 2 жыл бұрын
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")
@prasea7
@prasea7 4 жыл бұрын
At the end of the video you forgot colon: after your last else statement
@milanbariya4914
@milanbariya4914 4 жыл бұрын
🤓 Quiz Answer 🤓 Write a code to check a given number is positive or negative. Answer: Number = int( input ( "Enter Any Number" ) ) if number < 0 : Print (number, " Is Negative Number " ) elif number == 0 : Print ( number, " Is Neither Positive Nor Negative " ) else: Print ( number, " Is Positive Number " )
@ishanthmishra7658
@ishanthmishra7658 4 жыл бұрын
Solution of question at the end of the video l = int(input ("value")) if l>0 : print("positive") elif l
@ashishbhatnagar2260
@ashishbhatnagar2260 4 жыл бұрын
Sir can be more efficient ? x=int(input("Enter first number")) y=int(input("Enter second number")) z=int(input("Enter third number")) if x>y&x>z: print("The greatest is:-" ) print(x) elif y>z: print("The greatest is:-") print(y) else: print("The greatest is:-") print(z)
@ranitde463
@ranitde463 4 жыл бұрын
You are the one who helps in programming a lot.Thanks a lot sir😀☺☺☺☺😮
@kalikotakavyasri2196
@kalikotakavyasri2196 4 жыл бұрын
x=list(input("enter 3 different values:)) if x[0] > x[1] and x[0]>x[2]: print("greatest:", x[0]) elif x[1]>x[0] and x[1]>x[2]: print("greatest:", x[1]) else: print("greatest:", x[2])
@Pavankumar-su4hl
@Pavankumar-su4hl 4 жыл бұрын
Sir jst few months got a software job in infosys, now learning python 😍
@yogeshkumarshankariya642
@yogeshkumarshankariya642 4 жыл бұрын
x=int(input('enter the value')) if x>0: print('positive') else: print('negative') user1=int(input('enter the value')) user2=int(input('enter the value')) user3=int(input('enter the value')) print(max(user1,user2,user3))
@sabarishsudhan9345
@sabarishsudhan9345 3 жыл бұрын
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 !
@Karan-oh4mq
@Karan-oh4mq 2 жыл бұрын
x=int(input('enter any number:') if x=>0 : print('positive') elif x==0: print('it\'s the hero') elif x=
@sachintak9600
@sachintak9600 4 жыл бұрын
Really interesting and fun to watch ❤
@harshanasemasinghe446
@harshanasemasinghe446 3 жыл бұрын
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")
@amit8932
@amit8932 6 жыл бұрын
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 5 жыл бұрын
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
@mounikamandava5128
@mounikamandava5128 4 жыл бұрын
1) x = int(input("enter a number")) if x>0: print("given number is positive number") else: print("given number is negative number") 2)x = int(input("enter a number")) y = int(input("enter a number")) z = int(input("enter a number")) if x>y and x>z: print(x) elif y>z and y>x: print(y) elif z>x and z>y: print(z) else: print(x)
@jaybahadurthapa1492
@jaybahadurthapa1492 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 😎
@hallo-xp2wh
@hallo-xp2wh 2 жыл бұрын
a=int(input("enter any number")) if a>0 : print(a," is +tive") elif a==0 : print("neither positive nor negative") elif a
#20 Python Tutorial for Beginners | While Loop in Python
12:43
Telusko
Рет қаралды 1,6 МЛН
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 12 МЛН
How I Would Learn Python FAST in 2024 (if I could start over)
12:19
Thu Vu data analytics
Рет қаралды 361 М.
#26 Python Tutorial for Beginners | Array in Python
15:57
Telusko
Рет қаралды 1,3 МЛН
If statements in Python are easy (if, elif, else) 🤔
8:21
Bro Code
Рет қаралды 135 М.
#21 Python Tutorial for Beginners | For Loop in Python
7:27
Telusko
Рет қаралды 1,3 МЛН
Dictionary in Python
12:24
Telusko
Рет қаралды 1,4 МЛН
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 869 М.
Control Flow in Python - If Elif Else Statements
16:08
Programming with Mosh
Рет қаралды 297 М.
#14 Python Tutorial for Beginners | Python BitWise Operators
12:42