RUVIDEO
Поделитесь видео 🙏

Conditional Statement and Indentation in Python || Lesson 10 || Python || Learning Monkey ||

#pytho #learningmonke #pythoncodin #placement #pythontutorial #pythoncours #pythonforbeginner #pythonfordatascienc #pythonfullcours #pythonprogrammin #pythonfreecourse
Conditional Statements and Indentation in Python
In this class, we discuss conditional statements and indentation in python.
Conditional Statements
Before going into the concept. First, you should have some basics on operators and input-output. Click here.
Let’s take an example and understand conditional statements in python.
Example:
Take details of an employee and give them a bonus of 5% of their salary. If he is a manager give him an extra 8% house allowance and 5% food allowances.
Program:
id= input(“enter id”)
name = input(“enter name”)
designation = input(“enter designation”)
salary = float(input(“enter salary”)
B=0
H=0
F=0
if designation == “manager”:
H = salary *0.08
F= salary * 0.05
B = salary * 0.05
Total = salary +B+H+F
print(Total)
From the above program, we understand a conditional statement is ‘if’.
In the if statement condition is given designation == “manager”. ie if the given condition is True.
It has to execute a block of code that belongs to the if condition.
The block of code is given for if conditions are.
H = salary *0.08
F= salary * 0.05
The above two lines of code are the block of code that belongs to if conditional statement.
Now we have to understand the concept of indentation.
Indentation
First, understand how python executes. Then we go to the concept of indentation.
In the above program. Python starts execution line by line. ie first line, second line, and so on.
When it comes to if statement.
If the condition is true it has to go and execute the block of code that belongs to the if statement.
How does python understand the block of code that belongs to the if statement?
For this python uses indentation.
Here we have to give at least one space at the beginning of the line.
All the blocks of statements that belong to if statement is given at least one space at the beginning.
With this space, python identifies the code that belongs to the if statement.
The remaining all lines should start in the same column.
This is how indentation helps the python compiler to identify a block of code that belongs to conditional statements.
Take one more example and understand the concept of indentation and conditional statements better.
Example:
Take details of the student and identify he is eligible for the scholarship.
If his percentage is greater than 80. He is eligible.
Id = input(“Id”)
name = input(“enter name”)
percentage=int(input(“enter percentage”))
if percentage = 80:
print(“eligible”)
else:
print(“not eligible”)
print(“thank you”)
After the condition colon should be a must. it’s the syntax.
The same way after else we need a colon.
If the condition is true then execute the block of code that belongs to the if statement.
If the condition is False Then go to else block of code.
The block of code belongs to if statement or else statement is following indentation.



Link for playlists:
https://www.youtube.com/channel/UCl8x4Pn9Mnh_C1fue-Yndig/playlists



Link for our website: https://learningmonkey.in

Follow us on Facebook @ https://www.facebook.com/learningmonkey

Follow us on Instagram @ https://www.instagram.com/learningmonkey1/

Follow us on Twitter @ https://twitter.com/_learningmonkey

Mail us @ [email protected]

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Conditional Statement and Indentation in Python || Lesson 10 || Python || Learning Monkey ||», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.