Tutorial on if, else and else-if (elif) conditions

  Рет қаралды 48,725

IIT Madras - B.S. Degree Programme

IIT Madras - B.S. Degree Programme

Күн бұрын

Пікірлер: 24
@avenumadhav3568
@avenumadhav3568 3 жыл бұрын
#1 Find whether the given number is odd or even: 0:23 #2 Find whether the given number ends with 0 or 5 or any other number 7:43 #3 Find the grade of students based on given marks 8:41 #4 Convert given flowchart into Python Code 20:22 my code: #1 i = int(input()) if(i%2 == 0): print('even') else: print('odd') #2 num = 0 if (num % 10 == 0): print(0) elif (num % 5 == 0): print(5) else: print('other') #3 marks = int(input()) if (marks >= 0 and marks =90): print('A') elif (marks >=80 and marks =70 and marks =60 and marks
@YasirKhan-mb1iy
@YasirKhan-mb1iy 3 жыл бұрын
sir, which book is used for the tutorial? or if can suggest any good book for python,which have problems to solve with python?
@ojasmehrotra2821
@ojasmehrotra2821 2 жыл бұрын
For q2, is this method an efficient method to do the question or is it more prone to mistakes while programming? n1 = str(input("Enter a number- ")) n2 = n1[-1] if (n2 == '0'): print ('The number ends in 0') elif (n2 == '5'): print ('The number ends in 5') else: print ('Other output')
@raj_patel
@raj_patel 2 жыл бұрын
Thanks Bro
@MUTHU_KRISHNAN_K
@MUTHU_KRISHNAN_K 7 ай бұрын
Nice I think,we can even avoid mentioning the 'str' explicitly 😊👍
@sayanghosh6996
@sayanghosh6996 3 жыл бұрын
6:30 why do we need another if statement? Why cant we simply print num%10 ? Seems a simpler solution to me.
@armanbothra118
@armanbothra118 3 ай бұрын
rint("enter a number") n=int(input()) if(n%5==0): print("number ends with 0 or 5") else: print("the number is not end with 0 or 5")
@thamizhan_on_yt
@thamizhan_on_yt 2 жыл бұрын
What is the text editor you use sir?
@SSCTechInsights
@SSCTechInsights 3 жыл бұрын
which key is used for right alignment of all the selected text ?
@PriyaSingh-ex8ps
@PriyaSingh-ex8ps 2 жыл бұрын
print('Travel Fron Indore To Delhi') Time=int(input("Enter maximum no of Hours you have to reach to Delhi ")) Time_Longer=8 if(Time
@nikulpd8137
@nikulpd8137 Жыл бұрын
sir, for question 2 what if i do it like, a=str(input('enter the number: ')) if(a.endswith('0')): print('0') elif(a.endswith('5')): print('5') else: print('other') is it okay?
@MUTHU_KRISHNAN_K
@MUTHU_KRISHNAN_K 7 ай бұрын
Nice I think,we can even avoid mentioning the 'str' explicitly 😊👍
@kajukatli9985
@kajukatli9985 2 жыл бұрын
#code by divyankpapa print('start') print('travelling from Bhopal to Delhi') time=int(input('enter travel time:')) #minimum travel time should be greater than 2 hours if(time>=2): if(time=3000): if(3000=150): if(150 =450): print('take train') else: print('invalid amount') else: print('invalid input') print ('thank you')
@054_nirajkumar3
@054_nirajkumar3 3 жыл бұрын
थैंक्यू
@akarshk1
@akarshk1 3 жыл бұрын
Whats up man I see your THANK YOU comment on every video LOL
@snehamukherjee9800
@snehamukherjee9800 3 жыл бұрын
@@akarshk1 true XD
@MilanoMine2002
@MilanoMine2002 11 ай бұрын
Now are u in which term? Of iitm ​@@snehamukherjee9800
@DHEERAJSINGH-b9e
@DHEERAJSINGH-b9e 2 ай бұрын
what is longer here??
@shayanchakraborty5761
@shayanchakraborty5761 3 жыл бұрын
Why am i getting a syntax error in the first if statement with the following code? Can anyone please point out the mistake? print("Enter the marks: ") marks=int(input()) ( if(90
@induvardhan_m
@induvardhan_m 3 жыл бұрын
Look at the open parenthesis before if block and make sure to use nested if only for the second check i.e, it works only for AND operations not for OR operations.
@induvardhan_m
@induvardhan_m 3 жыл бұрын
Look at the open parenthesis before if block and make sure to use nested if and only if there is a second check i.e, it works only for AND operations not for OR operations.
@ishu7891
@ishu7891 2 жыл бұрын
you are using the else condition without its "if" part which will be if(marks>=0 and marks
@steveraphaelpulikottil5755
@steveraphaelpulikottil5755 2 жыл бұрын
( not required before & ) " " after if statements, respectively
@umarulf
@umarulf 2 ай бұрын
nd cool
Introduction to "import library"
15:45
IIT Madras - B.S. Degree Programme
Рет қаралды 43 М.
If statements in Python are easy (if, elif, else) 🤔
8:21
Bro Code
Рет қаралды 167 М.
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
Why Pandas
19:39
IIT Madras - B.S. Degree Programme
Рет қаралды 25 М.
Tutorial on while loop
28:11
IIT Madras - B.S. Degree Programme
Рет қаралды 52 М.
Lists and Sets
28:05
IIT Madras - B.S. Degree Programme
Рет қаралды 37 М.
Introduction to the if statement
9:08
IIT Madras - B.S. Degree Programme
Рет қаралды 41 М.
Different ways to import a library
11:55
IIT Madras - B.S. Degree Programme
Рет қаралды 37 М.
Understanding Ownership in Rust
25:30
Let's Get Rusty
Рет қаралды 276 М.
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 458 М.
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН