if-else and nested program in python language
java programming and c, c++, Matlab, Python, HTML, CSS programming language, and new techniques news and any history.
CODING YOUR FIRST PROGRAM
Friends, I have told you till now that if you want to write a Python program online, how can you do it, and if you want to install Python on your computer, then what you have to do.
In today's text, I will tell you that if you want to show any word, sentence or number on your computer screen with the help of Python Program, how can it be done today we will write your first program in Python and see how With the help of the Python program, we can show any word (sentence), sentence, number, on our computer screen.
With the help of an example, you will better understand Nested if statements.
java programming and c, c++, Matlab, Python, HTML, CSS programming language, and new techniques news and any history.
CODING YOUR FIRST PROGRAM
Friends, I have told you till now that if you want to write a Python program online, how can you do it, and if you want to install Python on your computer, then what you have to do.
In today's text, I will tell you that if you want to show any word, sentence or number on your computer screen with the help of Python Program, how can it be done today we will write your first program in Python and see how With the help of the Python program, we can show any word (sentence), sentence, number, on our computer screen.
print('Welcome To Web3tutorial.com')
print('Learn Python in hindi')
print('my wife is my life')
IF STATEMENTS
Syntax means the way that we use to write the program as we refine the rules of the grammar of Hindi language to write Hindi, just to write the program, it is a reflection of the rules of the programming language of Syntax.
age = 20
if age>=18:
print ("You Are Eligible To Vote In India")
IF … ELSE STATEMENT
If we have only one option in the statement, what to do if the condition is correct but in the if..else statement we have two options if the condition is correct and what to do if it is not correct.if test expression:
statement(s)
else:
statement(s)
If..else statement is a very important concept for all programming languages, you can practice by making a few simple programs on the if..else statement of python so that you understand the if..else statement properly.age = eval(input("Enter Your Age?"))
if(age>=18):
print("You are Eligible To vote in INDIA")
else:
print("Your Are Not Eligible To vote in INDIA")
Output:-
Enter Your Age? 12
You Are Not Eligible To vote in INDIA
PYTHON NESTED IF ELSE STATEMENTS:-
Nested if statements are also similar to the if..else statement but in Nested if statements, the second statement can be started within a statement.With the help of an example, you will better understand Nested if statements.
Example 1: –
num = float(input("Enter a number: "))
if num >= 0:
if num == 0:
print("Zero")
else:
print("Positive number")
else:
print("Negative number")
Output :-
Enter a number: 5
Positive number

Comments
Post a Comment