Python Tutorial for Beginners 9 - Python IF ELSE Statements

preview_player
Показать описание
In this Video I am going to show How to use IF ELSE conditional statements in python. The if statement evaluates a Boolean condition, and if it is True, performs the indented statements(or a block or code); but if the test is False, it does nothing. The if statement can have an optional else part which will be performed if the test result is False.
If you if condition expression contains logical operators then,
In (A and B), if A is false, then so is the expression, and there is no need to evaluate B
In (A or B), if A is true, then so is the expression, and there is no need to evaluate B

★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

python 3 if else statement
python if elif
finally python
Python IF...ELIF...ELSE Statements
Рекомендации по теме
Комментарии
Автор

HOW COULD SOMEONE. DISLIKE THIS AWESOME TUTORIAL

recu
Автор

Thanks for such a simple but great way of explaining things clearly. Started learning Python !

BhanuChander-SYL
Автор

thanking you for your lessons it would be helpfull if you include practice set also

jalaj
Автор

thank you for all of these videos they are helping a lot .;).

Gaga
Автор

Thank you so much it was very helpful. What if someone by mistake enters a letter instead of a number and you want to print "Sorry you must enter a number". How would you do that?

senchi
Автор

Thanks for this video...But u didn't consider the case when n == 0...How do I add the condition

onyekachiosisiogu
Автор

Sir how does the program know the absolute value when its only a string ??

Lordknight
Автор

im getting syntax error saying
source code cannot contain null bytes

please suggest what need to be done to avoid this

i am using python 3.6.4 version

deebeshs
Автор

So basically indent is doing the job of braces.I wish they had braces instead.Its so confusing isn't it?

vmohakrish
Автор

I am writing two conditions with the help of if then a else condition but when I fulfill my 1st condition else condition is working as a different code

pawanmohangogoi
Автор

for my version of python, the following code is working not the code you suggested please clarify

n = int(input("Number? "))
if n<0:
print("The aboslute value of", int (n), " is", int (-n))

murthy
Автор

why are we using 2 file...y not use the normal one with >>>...which doesnt give result fr if else

sreejasanthosh
Автор

I am getting an invalid syntax warning for putting in colon. For some reason, its not liking the colon, can somebody explain why?

khurramsaqib
Автор

how to type in next line ? when i enter it executes the code ..!! so i have type whole code in one line ...plz help

ShadiGeet
Автор

I really hope this tutorial help me cuz i'm under stress r n

aaronaustrie
Автор

This code isn't running; I get a syntax error.
n = int(input("Please enter a number? "))
if n<0:
print("The absolute value of", n, " is", -n)

I don't know if it is because n now is an integer and needs to be recast as a string? But when I do so it doesn't work either. Puzzled.

thuyvuong
Автор

how the value of - 3 is 3? it should be - 3 isn't it?

krakesh
Автор

after
(input("number"))
for...ber"..

trickstercow
Автор

Dear PK, why this statements are not working ??

input = raw_input("Enter the number :")
number = int(input)

if number %2==0:
print ("Your number is even")
else:
print("your number is odd")

md.shorifulislam
Автор

It is not working well with python 3.6.5 version

amrutashet