Skip to content

Added Chapter 4 of Level 1 of Python Tutorial - #11

Open
kritarth2135 wants to merge 5 commits into
feature/python-tutorialfrom
feature/tutorial-lvl01-chap04
Open

Added Chapter 4 of Level 1 of Python Tutorial#11
kritarth2135 wants to merge 5 commits into
feature/python-tutorialfrom
feature/tutorial-lvl01-chap04

Conversation

@kritarth2135

Copy link
Copy Markdown
Contributor

No description provided.

Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated
Comment threaddocs/python-tutorial/chapters/04-built-in-functions-pt-1.md Outdated

@CodesMahaCodesMaha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wonderful changes so far. Perhaps a few more to go.

## `print()`

The `print` function is used to print/show something on the screen (also known as the terminal or
standard output). With this you can write the first program that every programmer writes when they

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

With this you can

Usually, you add a comma after an introductory phrase like 'with this'.

```

Each `print` statement prints on a new line. You can print multiple things using a single `print`
statement by separating them using commas(`,`), which will result in all the values being printed on

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Forgot a space after "commas"? Like that you added the comma after the brackets, though; well done.


!!! note

Keep in mind that this works only in `print` and can NOT be used to combine different strings or

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

By the way, though "can not" is also fine, "cannot" is often recommended. (For emphasis, one could use uppercase letters for the entire word "cannot".)


Now you know how to take input from the user, but, the `input` function returns a `str` no matter
what the user types. So, for example, if the user types `54`, it will return a `str` (`"54"`), not
an `int` (`54`). So if you want to use the number the user entered, you will need to convert the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So if you want to use …

A comma after the transition 'so' would be preferred.

### Explicit Type Casting

Python has many built-in functions for explicit type casting, and they are named the same as the
data type it casts to. Here is the list of type-casting functions with the type they cast to:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

they are named the same as the data type it casts to

Since we are using a plural pronoun "they", it would be more suitable to use "they cast" instead of "it casts" afterwards.

| `int()` | `int` |
| `str()` | `str` |

For example, to get a number from the user you can do this:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

to get a number from the user you can do this

A comma before "you can do" would be preferred. Alternatively, the different parts can be switched like so:

you can do this to get a number from the user

@CodesMahaCodesMaha added the feature New feature proposal label Aug 29, 2026
@Jiggly-BallsJiggly-Balls added the python-tutorial Issues related to the Python tutorial label Aug 31, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

featureNew feature proposalpython-tutorialIssues related to the Python tutorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@kritarth2135@CodesMaha@Jiggly-Balls