If Else Conditional Statements in Python | Python Tutorial – Day #14
![*](https://i0.wp.com/allprowebdesigns.com/wp-content/uploads/2024/05/1716828060_maxresdefault.jpg?resize=840%2C430&ssl=1)
Video Title: If Else Conditional Statements in Python | Python Tutorial – Day #14
Do you remember we used to skip our school on a rainy day in childhood We used to say that if it rains, I will not go to school And if it doesn’t rain, we’ll go to school We used to do decision making in this situation And we do a lot of decision making in our life For eg. If I’m tired so I won’t go for picnic and if I’m not so I will… So we usually do this type of decision making like "If you’re hungry so order some food" And if you’re not, so won’t If you’re hungry and got bucks, so order some food Else control your hunger and try to cook something at home So we usually do this type of decision making in our daily life For the same decision making in python programming, we have (If/Else) statement We can use (If/Elif/Else) How we can use these conditions in Python programming, I’ll teach you this today Let’s move to the computer screen And let’s get started [ [S [ST [STA [STAR [START [STARTI [STARTIN [STARTING [STARTING [STARTING T [STARTING TH [STARTING THE [STARTING THEM [STARTING THEME [STARTING THEME] So guys let me open my Day #14 Repl firstly And as you can see today’s topic is "If/Else statement" Many times it happens in the program that I have to work according to some condition. For eg. If I take an input from the user BTW I can write "print(int(input))" like this To take an input as an ‘Integer’ You already know that that the by-default nature of input is ‘String’ And if I want to take it as an ‘Integer’ so I can use ‘Int’ function Which means I can do type casting Let’s suppose if I write "Enter your age" And I want to store user’s age in variable ‘ a ‘ And I’ll write it like….. "Your age is:" , and I’ll add a comma(,) and then I’ll print user’s age And after that, if the user is 18+ so I can display…. If he/she can drive or cannot either of two Let’s suppose the "user’s age > 18" So I’ll display… Firstly I’ll add a colon(:) here and then I’ll press ‘Enter’ And then I’ll write " print("You can drive") " And then… OK! Let me first write the program And then I’ll explain you that program step-by-step "You cannot drive" Let’s suppose I gave input "9" And your age is 9 has been displayed Now I’m running the program again… …Along with (if/else) statement If I write "9" And I pressed ‘Enter’ key so look "You cannot drive" But if I write 90….. or 78 The program is not on a run right now but if I write 78 In-fact I may have given quite a big number I may have written 768 I gave 76, so "Your age is 76, You can drive" is displayed Let me add a colon and a space here So based on input, we determined if that person can drive or not And now I’d like to move to the tutorial I’ve written "Sometimes the programmer needs to check the evaluation of certain expression(s), whether the expression(s)evaluate to True or False." Now basically how this works is… These are our conditional operators ">,<…." "==" ">=" "<=" and BTW " = " is not a conditional operator If I want to check the equality so I have to check with " == " First let me tell you about ‘Conditional Operators’ Let me tell you about ‘Conditional Operators’ " >, <, >= & <= " And then comes " == " it checks for whether the two numbers are equals or not And let me show you examples I’ll just print " a>18 " And I’ll just print " a <= 18 " And then I’ll print " a == 18 " And then I’ll print " a != 18 " "Not-equals( != )" is also a ‘Conditional Operators’ Not equals to…. Now I’ll print it… Now look I’m taking age dynamically as an input from the user Let’s suppose I want the age to be 18 So look what will happen Is ‘ age>18 ‘ No if it’s not greater than 18, even if it is 18 Even of the age is 18 so the statement ‘age>18’ won’t be true Now let’s have a look on " age<18 " Is the age is less than equals to 18? So Yes! Because we have applied the condition for less than and equals to Which means if it is less than 18 so it’s true and if it is equals to 18 so it’s true So this will evaluate to ‘True’ Is the age is exactly equals to 18? Yes that’s true… So the ‘True’ has been printed here and it is returning the ‘Boolean’ type " a <= " " a >= " " a == " " a < " " a > " They all are returning ‘Boolean’ type " a != 18 " is it true? No this is not true ‘a’ is actually equals to 18 So these are the conditional operators let me comment this out I hope you got it… ‘If’ statement works on conditional operators Which means it search for a condition that can be evaluated to ‘True’ or ‘False’ And after searching, if the statement is true Which means if " a>18 " so it prints this block of code And if it is not true So it prints this block of code But it won’t print both of these together Whether it’ll fall under ‘if’ or ‘else’ Now you might be thinking what this colon(:) is And why have I added this space why can’t we remove this So look when I removed this space so I got an error In Python this space is called ‘Indentation’ If you’re using modern IDEs like VScode, PyCharm or even Replit So when you’ll press enter, they’ll automatically add space In Python this space is called ‘Indentation’ ‘Indentations’ means that you’re starting a block If you are a user of C language so let me tell you we don’t use curly brackets{ } here We just specify that we entered in a block just by adding a colon(:) & spaces Here we added a colon(:) and spaces so this means we have enter in this ‘if’ If I press ‘Enter’ and even if I write "print("Yes")" even now we are inside the block of ‘if’ If I do " print("No") " here… So even now we’re inside the block of ‘else’ This is inside ‘Else’ and this too Now you’ve to tell me in the comments if this is inside the block of ‘Else’ Is this inside ‘Else’? No it’s not Even if the code inside of ‘else’ is being executed even then you’ll get this code printed And if it is not… even then you’ll get this code printed Which means it doesn’t have any business with the code inside of ‘else’ it’ll always be executed Let me show you Look, if the age is greater then 18 let me take age greater than 18 Let’s suppose If I take 48 Will this be printed for age 48? Yes it’ll! Because it doesn’t have any business with ‘if’ or ‘else’ this is the independent statement So look the code inside of ‘else’ is being printed Sorry inside of ‘if’…. Because this is greater than 18 You can drive and ‘Yes’ and this is also being printed But if I take an age which is less than 18 for eg. if I take 8 Now if I run this, so look ‘No’ is also being printed along with this But if I would’ve added this statement inside of ‘else’ statement So look, this is now the part of ‘else’ Because I’ve added an ‘Indentation’ here From now on I won’t say ‘Space’ I’ll say ‘Indentation’ whenever I say this word, just understand what am I referring to I’m now inside the ‘else’ block Inside the ‘else’ block And because I’m inside the ‘else’ block so now if the age is not greater than 18 Then this will be printed, look…. But if I add an age which is greater than 18 so this won’t be printed So look, for age 78… For age 78 ‘Yes’ is being printed and not "Yay!" Because "Yay!" is now the part of ‘Else’ As we learned about (if/else) statement same like them we also have got (elif) statement We also have got nested,(if/else), so we’ll talk about all of them in this video I’ve written everything that I told you Is the it is evaluation is ‘True’ so it’ll be moved to ‘if’ otherwise to ‘Else’ OK let’s do one thing! Let’s make a new file in Replit Till now I was working with a single file But now I’ll create files I’ll create a file with name "if-else.py" So I’ve created a file with name "if-else.py" I’ll copy this and paste it here and then I’ll run it So what have they told here? Price of apple is 210 and the budget is 200 So… In-fact I mistakenly have ran "main.py" so I’ll stop it because I want to ran my "if-else.py" file Actually, in Python template of Repl only the "main.py" file runs So what I’ll do is… Actually I want to open ‘Shell’ And here I’ll write "Python if-else.py" "if-else.py" And I’m able to see "Alexa, do not add Apples to the cart." Why is this being displayed? Let me tell you Firstly I’ll move my shell to here Now let me tell you… Look, the price of apple was 210 And my budget was 200 I commanded if the price>budget So obviously…. Sorry if budget>price So this means I can purchase it So I’m saying "Alexa, add 1Kg Apples to the cart. Or else I’m saying "Do not add" So I’ve used (if/else) statement here We used quite a simple example here So we’ll move forward and we’ll have a look on ‘Elif’ statement Assume that if I want to execute more than 1 statement based on certain conditions For eg. Let’s suppose my budget is 200 and price 210 So the budget is quite close to the price So maybe I don’t want to buy apples for ₹200 If the apples are of ₹190 Let me change the price to ₹190 So maybe I don’t want to buy So I’ll do one thing if ‘applePrice <= budget’ And along with that if I want to check another condition Or if I say applePrice… Or if I say (Budget-applePrice) So basically what am I doing is… (budget – applePrice >….) Suppose I’ve ₹20,000 And apples are ₹190/Kg so it doesn’t matter So the money I have after buying the apple The money I have with me… Let me simplify it… Suppose apples are ₹10/Kg and I have ₹100 Let me change the price to ₹10 and I have ₹200 So the money left with me is ₹190 If the greater than is as long as 50 I will buy the apples But… Elif….. But, if (budget – applePrice > 20) If this is greater than 20 or let’s suppose 70 So what I’ll do is…. I’ll print…. "It’s OK you can buy" Now if I run it So look, because this is 190…. In-fact I have to run it with ‘Shell’ In this way "python if-else.py" "Add 1Kg apples to the cart" So what happened is… This condition became true So it has executed this But if this condition would have result in ‘False’ So it would have checked the next condition And so on…. Let me change and take a good example So what I’ll do is… I’ll revert my ‘if-else.py’ program And then I’ll give a good example of elif statements So I’ll look for (if/else) statement along with ‘elif’ statements So let me copy this…. And I’ll create a program with name "elif.py" So look a program has been created with name "elif.py" and the of "num=0" Let’s do one thing, take the value of num from the user And "Enter the value" "Enter the value of num: " If the ‘ num < 0 ‘ so the number is negative If ‘ num = 0 ‘ so it’s zero else it is positive And now if I run this so I’ll write "Python elif.py " and it’ll run "Enter the value of num: " so let’s suppose I entered 7 Number is positive I’ll run this program again and let’s suppose if I write "-8" So the number is negative And if I add 0 so "Number is 0" will be printed here Now how do they work (if/elif/else) Firstly the condition of ‘if’ is checked If the condition of ‘if’ is true, then only the ‘if’ will be executed Only when the condition of ‘if’ becomes true But if not, then it’ll move to the condition of ‘Elif’ and try to match it Let’s suppose if there would have been another ‘Elif’ If there would have been another ‘Elif’ so it would have tried to check that too If (num == -999) Let’s suppose if it’s -999 Or I change this to +999 999 number is special Let’s suppose if I do this…. Else the number is positive Now let’s run it and check if I input 999 so "Number is special" will appear or not "So number is special" So basically how does this works? Look, it starts with ‘if’ It first checks the condition of ‘if’ If the condition is ‘True’ So it’ll jump directly from here to here Let’s suppose if I write "I’m happy now" here So this program will be happy after finding the condition it has to match And once it’s condition matched then it become so greedy and starts ignoring others If it is matched with a condition then it’ll ignore this, this & this It should match Firstly it’ll move to ‘if’ and ask him to match the condition "If will say… No I won’t" My condition is ‘ num<0 ‘ and you’re 999 so bugger off Then it’ll ask ‘ num == 0 ‘ to match it’s condition ‘ num == 0 ‘ will say "Bugger off" Then it’ll move to here and ask ‘Elif’ to match the condition So this ‘Elif’ will say "Yes! the condition is matching" What’s the condition? ‘ == 999 ‘ and it is matching And because they are matching so it won’t go to ‘Else’ and if there were more ‘Elif’ so it would have ignored them It’ll directly jump here And because it is jumping here I’ll be able to see "I’m happy now" So look, we can see the code inside of this And we can also see "I’m happy now" no matter what will execute "Enter the value of num: " " 7 " Number is positive, I’m happy now Enter the value of number Let’s suppose "-9" Number is negative I’m happy now On 999, ‘Number is special’ I’m happy now So "I’m happy now" have no business with (if/else) ladder No business with (if/else) ladder So I can add ‘elif’ as many as I want And they all will matched until the condition matches So this is how (if/elif/else) works I hope you got my point And now I’ll give you a program with name "Nested" I’ll name it "nested.py" Let me correct it’s spelling by renaming it BTW never name you programs after Python keywords or Python Packages So I’ll name it "myif.py" Because ‘if’ is a keyword in Python I don’t want the name of file to be clashed with Python’s Sometimes a very classical error occurs in Python In which if you ever create your file with a name of a module, so it basically search in you file instead of module So it throws error So whenever you’re working with a module so don’t name you’re file after that module So I hope you understood That’s why I named it "myif.py" and then I created "if-else.py" And then I created "elif,py" Let’s me improve it, I’ll name it "01 myif.py" I’ll rename it "myelif.py" In-fact this program and this program…. 1 sec, let me rename it to "02 if-else.py" I’m doing this just for your convenience so that you know which program you’ve to run first So I’ve renamed these program with numbering We’ll create 4th file and it’s name will be "04 nested.py" I’ve created this program with name "nested.py" And now what I’ll do is, I’ll tell you about nested if/else statement Nested if/else statements are nothing but… If you’ve added ‘if’ in another ‘if’ And you can do this multiple times Let me explain… Look…. What we have written here? We’ve written " num = 18 " If the ‘ num < 0 ‘ so it’ll execute this code If there were another line under this level of indent First understand the concept of ‘level of indent’ This is a level of indent Let’s suppose ‘ num < 0 ‘ which is ‘False’ because num is 18 So it’ll move to ‘Elif’ If ‘ num > 0 ‘ ? Yes! ‘ num > 0 ‘ Actually it is 18 which is greater than 0 So it’ll move to the ‘Elif’ It’ll evaluate it And then it again got the if/else ladder So it’ll now evaluate that So if ‘ num <= 18 ‘? No! Sorry if ‘ num <= 10 ‘? No! Is num greater than 10 and less than equal to 20? Yes that’s true So it’ll move to ‘elif’. So this is the second level of indent One indent of this ‘elif’ was still on the move Now this is inside the ‘elif’ which is inside this ‘elif’ So this is how you have to evaluate your programs So it’ll print this… "Number is between 11-20" And then it won’t go to ‘Else’ And then it won’t go to this ‘else’ This ‘else’ was the part of this ‘if’ And this ‘else’ belongs to this ‘if’ I hope you’re getting my points Now let me run this program and I’ll show you "04_nested" 04 tab BTW I can auto-complete it by pressing ‘Tab’ key If you’re unable to see, so let me move my pip here Now I’ve moved to here, this is now visible to you In-fact I’ll put this here So look I’ve created this with "04_nested.py" And look "Number is between 11-20 has appeared here" I hope you’re happy now, and you’ve understood how if/else/elif works Even now if someone tells me that they don’t understand this… And how this works? So I’d like to tell you that you need practice And you need to practice every topic Create some programs, practice some upcoming exercises And hang on to this course And if you don’t get any topic so watch it again, what’s the problem? If you’ve to watch Day #3 10 time that’s going to be worth it As long as you’re able to understand that It doesn’t matter how many times you watch that or how many programs you created It doesn’t matter, do whatever it takes. If you successfully learn to create a website With Django backend Or you learned ML from Python Or if you’ve become a job-ready Python developer So nobody is going to ask you how many time you’ve written Day #5 program It doesn’t matter man I hope you get this And if you haven’t accessed the play-list so make sure to do it That’s it for this video guys Thank you so much guys for watching this video 🙂 And I’ll see you next time
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Maza aa rha hai?
00:01 If-else conditional statements in Python are used for decision making in daily life and programming.
02:14 Illustrating the use of if-else conditional statements in Python
04:39 Understanding if-else conditional statements
06:55 Learn about If-Else conditional statements in Python.
08:45 Using If Else statements for conditional execution in Python
10:45 Understanding If Else conditional statements in Python
13:09 If the condition becomes true, it will jump to the corresponding block of code.
15:14 File names should not clash with Python keywords or modules
17:22 Conditional statements in Python and the importance of practice
19:07 Understanding If Else conditional statements in Python
Crafted by Merlin AI.
Just a big humble thank you Harry. Enjoying each and every lecture and practicing too…
Sir if the code is –
a = int(input("Enter your age: "))
if(a>=18):
print("You are eligible to drive")
else:
print("Not eligible")
print("Hello") # printed
print ("hello") # Will this string be printed when age is smaller than 18 ?? Please confirm asap…
Thanking you…..
Apna college bhi video Dekh rahi he
import time
timestrap1 = time.perf_counter()
print(timestrap1)
if timestrap1[3] in (1,2,3,4,5,6,7,8,9,10,11,12):
print('good morning')
else:print('good night')
5/23
Day 14 done ✅
no
koi hai jo samsya ka samadhan kar sake
i just finished , i use two of examples provided in this tutorial and make a function where i can get a input and can make the computer to tell me whatever the number is 0 or bet 10 or bet 20 or above 20 , by the way i use bing ai and it write this code in just 5 sec and understandable
100 videos in a single day present on 8th day.
mazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
gyaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂
day 14
import time #time module
Time_combo = time.strftime('%H:%M:%S') #This will not take int, and if you did, it will give ValueError: invalid literal for int() with base 10: '10:28:29'. It means your string has characters that are not valid for an integer, or say only that string will be converted as an int which represents valid integers. For instance:%H:%M:%S—>10:23:13–>does not represent valid integer, but 102313—> is a valid integer
print(Time_combo)
A= int(time.strftime('%H')) #for an hour
print(A)
B= int(time.strftime('%M')) #for minutes
print(B)
C= int(time.strftime('%S')) #for seconds
print(C)
# A=int(input("your time:")) #to check code. As we know 24hrs format can never be 24 as an integer, 24th hr= 00 hr. So, every time you use this and give input as an integer above 23 it will say good night, but in reality, there won't be such a case.
#considering 24hrs format
if (A<12):
print("Good Morning")
elif (A>=12 and A<=15):
print("Good Afternoon")
elif (A>=17 and A<=21):
print("Good Evening")
else:
print("Good Night")
Here's a modified calculator with the use of if else statement:
a=(input("insert your first numbern>>>"))
b=(input("insert your second numbern>>>"))
c=(input("Type the operatorn>>>"))
if(c== "+"):
print("The sum of these numbers is:")
print(float(a)+float(b))
elif(c== "-"):
print("The difference of these numbers is:")
print(float(a)-float(b))
elif(c== "*"):
print("The multiple of these numbers is:")
print(float(a)*float(b))
elif(c== "/"):
print("The divison of these numbers is:")
print(float(a)/float(b))
else:
print("You have entered the wrong operator only use =,+,*,/")
print("Thanks for using :)")
Present
present
i am started now
sir ji agar muze condition he ki first digit 1 chahiye to kaise karu?
Yeh video sahi main tagda tha pur dimaag pe de Raha hai
Anyone noticed that fart 3:06 😂
i m present sir