-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Updated the nested if
statement syntax to reflect correct indentation
#665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LAbhilashKumar
wants to merge
3
commits into
Asabeneh:master
Choose a base branch
from
LAbhilashKumar:fixing_indentation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
LAbhilashKumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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: | ||
LAbhilashKumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if <condition>: | ||
-statements- | ||
if <condition>: | ||
-statements- | ||
|
||
""" | ||
# example: | ||
LAbhilashKumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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") |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.