Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

one of the easy topic in python

Rating
-
Sold
-
Pages
3
Uploaded on
18-02-2024
Written in
2023/2024

Conditional statements are fundamental constructs in programming that allow you to make decisions based on certain conditions. In Python, conditional statements enable you to control the flow of your code by executing specific blocks of code based on whether certain conditions are true or false.

Show more Read less
Institution
Course

Content preview

Python Conditional Statements

Conditional Statements are features of a programming language, which perform different
computations or actions depending on whether the given condition evaluates to true or false.
Conditional statements in python are of 3 types

 If statement

 If else statement

 If elif statement

 Nested if else

1. If Statement : if Statement is used to run a statement conditionally i.e. if given
condition is true then only the statement given in if block will be executed.

if <condition>:
<if statement block >


For example consider the code given below
if (percentage > 33):
print (“Pass”)


Explaination : In the above code if value of percentage is above 33 then only
the message “Pass” will be printed.



2. If else Statement In the case of if else statement If given condition is true then the
statement given in if block will be executed otherwise(else) the statements written in
else block will be executed

if <condition>:
<if statement block >
else:
<else statement block>
For example consider the code given below
if (percentage > 33):
print (“Pass”)
else:
print(“Fail”)
Explaination : In the above code if value of percentage is above 33 then only
the message “Pass” will be printed otherwise it will print “Fail”

Written for

Institution
Course

Document information

Uploaded on
February 18, 2024
Number of pages
3
Written in
2023/2024
Type
Class notes
Professor(s)
None
Contains
Python

Subjects

$7.29
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
anandhaprakashs

Get to know the seller

Seller avatar
anandhaprakashs
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions