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

Utilities i #3017

Merged
merged 6 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Types of change:
### Changed
- [Html - Link Relative Paths - Change part of PQ as it wasn't worder properly](https://github.com/enkidevs/curriculum/pull/2985)
- [Python - Format Text Paragraphs With Textwrap - Make the fill method more clear](https://github.com/enkidevs/curriculum/pull/2981)
- [Python - Utilities I - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3017)
- [Python - Utilities II - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3018)
- [Python - Working With Strings - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3019)
- [Python - Arrays I - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3020)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ revisionQuestion:

## Content

Find a list of all python modules installed on a machine by running the following command in a terminal.
Find a list of all Python modules installed on a machine by running the following command in a terminal.

```bash
pydoc modules
```

Or, inside of a python interactive shell:
Or, inside of a Python interactive shell:

```python
>>> help('modules')
Expand All @@ -45,7 +45,7 @@ Or, inside of a python interactive shell:

## Practice

Complete the following command such that when used in the Python interactive shell it will show all modules installed on the machine:
Complete the following command such that when used in the Python interactive shell, it will show all modules installed on the machine:

```py
>>> ???('???')
Expand All @@ -63,7 +63,7 @@ Complete the following command such that when used in the Python interactive she

## Revision

What command/s can be ran in **a terminal*** in order to see all Python modules installed on the machine?
What command can be used in **a terminal*** to see all Python modules installed on the machine?

???

Expand Down
8 changes: 4 additions & 4 deletions python/python-core/utilities-i/schedule-events-with-sched.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ revisionQuestion:

## Content

Another useful **Python** module is `sched` and it's used for general purpose event scheduling.
Another useful **Python** module is `sched`, and it's used for general-purpose event scheduling.

Import the module:

Expand All @@ -31,7 +31,7 @@ import sched
import time # we will use this
```

Every operation is done with the help of a `scheduler` class that needs two time functions. The first one to determine the current time and the second to wait for a specific period of time. (e.g. `time.time` and `time.sleep`)
Every operation is done with the help of a `scheduler` class that needs two-time functions. The first one to determine the current time and the second to wait for a specific period of time. (e.g. `time.time` and `time.sleep`)

```python
s = sched.scheduler(time.time, time.sleep)
Expand All @@ -55,7 +55,7 @@ Then we run our scheduler:
s.run()
```

`first` is printed after 2 seconds while `second` is printed after 3 seconds.
`first` is printed after 2 seconds, and the `second` after 3 seconds.


---
Expand Down Expand Up @@ -92,7 +92,7 @@ Given the scheduler code:
```python
sched.enter(3,2,print,argument=('second',))
```
What is the priority and what the delay?
What is the priority, and what is the delay?
```python
# Priority ???
# Delay ???
Expand Down
21 changes: 10 additions & 11 deletions python/python-core/utilities-i/your-own-python-calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ print(cal)
The output will look like this:

```plain-text
January 2016
Mo Tu We Th Fr Sa Su
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
January 2016
Mo Tu We Th Fr Sa Su
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31


```
Expand All @@ -77,9 +77,9 @@ To print a whole year's calendar:
print(calendar.calendar(2016))
```

Output not shown since it is too large.
The output is not shown since it is too large.

This module provide other useful methods for working with dates, times and calendars such as `calendar.isleap` (checks if a year is a leap year).
This module provides other useful methods for working with dates, times, and calendars, such as `calendar.isleap` (checks if a year is a leap year).


---
Expand All @@ -89,8 +89,7 @@ This module provide other useful methods for working with dates, times and calen
Set the first day of the week of your `calendar` to be Monday:

```python
calendar.??? \
(calendar.MONDAY)
calendar.???(calendar.MONDAY)
```

- `setfirstweekday`
Expand Down