From 231e1db5cd848afa7f8542484c0c8b444d4dcabf Mon Sep 17 00:00:00 2001 From: Abhilash Date: Sat, 17 May 2025 16:42:42 +0530 Subject: [PATCH 1/3] Updated the nested `if` statement syntax to reflect correct indentation --- indentation.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 indentation.py diff --git a/indentation.py b/indentation.py new file mode 100644 index 000000000..4b81d69f7 --- /dev/null +++ b/indentation.py @@ -0,0 +1,29 @@ +""" +Whitespace at the beginning of the line is called 'indentation'. These whitespaces or the indentation are very important in python. In a Python program, +the leading whitespace including spaces and tabs at the beginning of the logical line determines the indentation level of that logic. + +* In most programming languages, indentation has no effect on progamming logic. It is used to align statements to make the code more readable. +However, in python, indentation is used to associate and group statements. + +All statements within the same block must have the same indentation level. Typically, one tab or 4 spaces are used per level. + +All statements inside a block should be at the same indentation level.. + + +Below is the correct syntax for nested conditions with proper indentation: + +if : + -Statements- + if : + -statements- + +""" +# example: +user = int(input ("enter any digit.. ")) +if user <=10: + if user>=5: + print("entered number is less than 10 and greater than 5") + else: + print("entered number is less than 5") +else: + print("entered number is greater than 10") \ No newline at end of file From f624f9c67bcfc8356b4183719e9e5e65ec3eb129 Mon Sep 17 00:00:00 2001 From: "L. Abhilash" <160405976+LAbhilashKumar@users.noreply.github.com> Date: Mon, 19 May 2025 19:10:17 +0530 Subject: [PATCH 2/3] Update indentation.py updated PR --- indentation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/indentation.py b/indentation.py index 4b81d69f7..91497f107 100644 --- a/indentation.py +++ b/indentation.py @@ -1,5 +1,5 @@ """ -Whitespace at the beginning of the line is called 'indentation'. These whitespaces or the indentation are very important in python. In a Python program, +Whitespace at the beginning of the line is called 'indentation'. These whitespaces or the indentation are very important in python. In a Pythonprogram, the leading whitespace including spaces and tabs at the beginning of the logical line determines the indentation level of that logic. * In most programming languages, indentation has no effect on progamming logic. It is used to align statements to make the code more readable. @@ -7,23 +7,23 @@ All statements within the same block must have the same indentation level. Typically, one tab or 4 spaces are used per level. -All statements inside a block should be at the same indentation level.. +All statements inside a block should be at the same indentation level Below is the correct syntax for nested conditions with proper indentation: if : - -Statements- - if : + -statements- + if : -statements- """ # example: user = int(input ("enter any digit.. ")) -if user <=10: +if user<=10: if user>=5: print("entered number is less than 10 and greater than 5") else: print("entered number is less than 5") else: - print("entered number is greater than 10") \ No newline at end of file + print("entered number is greater than 10") From 44a009b64663a5b88e2853f5122dfe7a866519f5 Mon Sep 17 00:00:00 2001 From: "L. Abhilash" <160405976+LAbhilashKumar@users.noreply.github.com> Date: Mon, 19 May 2025 19:12:12 +0530 Subject: [PATCH 3/3] Update indentation.py --- indentation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indentation.py b/indentation.py index 91497f107..fa3c1514a 100644 --- a/indentation.py +++ b/indentation.py @@ -1,5 +1,5 @@ """ -Whitespace at the beginning of the line is called 'indentation'. These whitespaces or the indentation are very important in python. In a Pythonprogram, +Whitespace at the beginning of the line is called 'indentation'. These whitespaces or the indentation are very important in python. In a Python program, the leading whitespace including spaces and tabs at the beginning of the logical line determines the indentation level of that logic. * In most programming languages, indentation has no effect on progamming logic. It is used to align statements to make the code more readable. @@ -7,7 +7,7 @@ All statements within the same block must have the same indentation level. Typically, one tab or 4 spaces are used per level. -All statements inside a block should be at the same indentation level +All statements inside a block should be at the same indentation level. Below is the correct syntax for nested conditions with proper indentation: