Skip to content
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

chapter 3 and 4 changes done #65

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

aravinds-arv
Copy link
Contributor

No description provided.

@aravinds-arv aravinds-arv changed the title chapter 3 changes done chapter 3 and 4 changes done Nov 12, 2023
Copy link
Collaborator

@Bharath314 Bharath314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job with a lot of changes! I have made a few comments; can you go through them?

docs/chapter-3/lesson-3.3.md Outdated Show resolved Hide resolved
- Multiple levels of nesting is possible.



## `#!py while` versus `#!py for`

`#!py for` loops are typically used in situations where the number of iterations can be quantified, whereas `#!py while` loops are used in situations where the number of iterations cannot be quantified exactly. This doesn't mean that the number of iterations in a `#!py for` loop is always constant. For example:
`#!py for` loops are typically used in situations where the number of iterations can be quantified and is known in advance, whereas `#!py while` loops are used in situations where the number of iterations cannot be quantified exactly. This doesn't mean that the number of iterations in a `#!py for` loop is always constant. For example:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is necessary to know the number of iterations in advance to use a for loop. For example,

for i in range(int(input())):
    print(i)

I think the entire paragraph doesn't really apply to python but rather to some other language like C or Java. In python, for loops are used to iterate over sequences such as lists, sets, generators, strings, etc., whereas while loops are used to execute a block of code while a condition is true.

Copy link
Contributor Author

@aravinds-arv aravinds-arv Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually what I believe is being implied in this paragraph is that in for loops, the number of times the code block is run can be determined in advance. Even in your example we know that the body of for only needs to executed as much number of times as the input provided. And in case of iterable objects like lists, sets etc the for loop is run exactly as many times as the length of the object.

while on the other is used commonly in cases where we don't have this knowledge in advance.. as you said we just know that it needs to be executed as long as some condition stays True.

Many programming tutorials I've seen also introduce the use of while and for using the same idea. Technicalities and implementation of loops might vary across languages but this basic idea I think applies to all. What say?

docs/chapter-3/lesson-3.3.md Show resolved Hide resolved
@@ -1,6 +1,6 @@
# Lesson-3.5

## Library
## Library (Continued)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, can you tell me why you added "continued" in parantheses?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a library lesson in some earlier chapter too where some other library was introduced.. so I thought we had to convey to the readers that this isn't the same lesson. Should I get rid of it 🫤? Or maybe we could do something like:

  • Library - Part 1
  • Library - Part 2

mkdocs.yml Outdated Show resolved Hide resolved
@aravinds-arv
Copy link
Contributor Author

Thanks for reviewing.. going through the comments now!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants