Python Decision Making Structure

Python Decision Making Structure

The structure in which we provide a condition, on the basis of condition, a statement or set of statement is execute.

We can use decision making structure, in which our code decide to execute statement OR set of statements? according to given? condition.

Examples:

Display a message “Congratulation, you can take participant in this program”, if person age is 18 or greater than 18

Display message ”Welcome” if day is Friday

Display message, “you are eligible for the admission of MCS”, if your marks greater than 1000

Show a message “It is even number” if user input a number that divisible by 2.


There are different decision making structure used in Python:

Following types of decision making structure, work with given condition

?if statement

?if...else statement

?Nest if statement

?if elif else statement.

if statement

It take a condition, if condition is true, then it execute a statement or set of statement.

if condition is false, no thing to display.

Syntax

if (expression/condition):

? Statement or set of statement

Example

marks =60;

if? (marks > 70):

? print("Qualified for admission")



要查看或添加评论,请登录

Rushikesh J.的更多文章

  • Linux Operating System

    Linux Operating System

    Linux Operating System ======================= => Linux is a community based OS => Linux is free & Open Source => Linux…

  • Infrastructure

    Infrastructure

    ================= Infrastructure ================= Servers (Machines) Databases Storage Network Security Backup =>…

  • Application Architectural Patterns

    Application Architectural Patterns

    =================================== 1) Monolithic Architecture (Outdated) 2) Microservices Architecture (Trending)…

  • DevOps Introduction

    DevOps Introduction

    =============== What is DevOps =============== DevOps = Development + Operations => DevOps is a culture/process in IT…

    2 条评论
  • Try and Exception in Python

    Try and Exception in Python

    Exception is the error and is an event, which occur when program statements are executing. It disrupts the flow of…

  • Python Array With Examples

    Python Array With Examples

    Array in Python Array in Python Array is the collection of items having same data type with contiguous memory location.…

  • Python Date Object

    Python Date Object

    We can work with time and date with Python. There are two module in Python time and datetime that used to work with…

  • String Formatting WITH Problems and Solution

    String Formatting WITH Problems and Solution

    What is String Formatting? It is the way to insert custom string or variable in a text (string). Using string…

  • SET Different Methods With Examples

    SET Different Methods With Examples

    SET Method : add() Working: This method is used to add element to set. Syntax: set.

  • Python SET Comprehension With Examples

    Python SET Comprehension With Examples

    What is Comprehension? ?We create a sequence from a given sequence is called comprehension. ?Sequence means list…

社区洞察

其他会员也浏览了