From ef3f870cb94e05825983078c54de327d14e496eb Mon Sep 17 00:00:00 2001 From: tteodorescu0 Date: Fri, 21 Jun 2024 19:50:42 -0400 Subject: [PATCH] Update 03.Conditionals-and-strings.md Fixed typos --- 03.Conditionals-and-strings.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/03.Conditionals-and-strings.md b/03.Conditionals-and-strings.md index 7e59a01..760d2df 100644 --- a/03.Conditionals-and-strings.md +++ b/03.Conditionals-and-strings.md @@ -26,7 +26,7 @@ Relational operators in `Python` are used to compare the values on either side o | `>=` | Greater than or equal to | `5 >= 5`| `True` | | `<=` | Less than or equal to | `5 <= 3`| `False` | -The order of calculation is the same as in math +The order of calculation is the same as in math. ## 2. Logical Operators (`if/elif/else`) @@ -40,7 +40,7 @@ However, in Python, indentation is an integral part of the code structure. Incor #### Example -The correct indentation should be 4 spaces according to the PEP-8 standart. +The correct indentation should be 4 spaces according to the PEP-8 standard. ```python if condition: @@ -68,7 +68,7 @@ if condition: Follow the rules of indentations during this course, and you will get the general idea of constructions which require them. -Don't worry if this seems to be hard for now, with more practice indendtaion will never be a problem even in complex applications. +Don't worry if this seems to be hard for now, with more practice indentation will never be a problem even in complex applications. ### 2.1. `if` Statement @@ -91,7 +91,7 @@ if y < 5: # is not ``True`` --> the code within ``if`` block WON'T BE x is greater than 5 ``` -Let's write a mini program to verify, that you actually learning Python and allowed to attend this course. +Let's write a mini program to verify that you are actually learning Python and allowed to attend this course. #### Example @@ -136,7 +136,7 @@ Which programming language are we learning? # Asking for user's input # Case 1 >> Python -Correct +Correct! # Case 2 >> Java @@ -349,7 +349,7 @@ Example: If the intervals are -3 to 7 (inclusive), and the user enters 5, the ou #### Assignment 2: Interval Membership p.2 -**Objective**: Create a program that accepts an integer x and determines whether `x` belongs to any of the given intervals. +**Objective**: Create a program that accepts an integer `x` and determines whether `x` belongs to any of the given intervals. ``` Input: @@ -389,7 +389,7 @@ Example: If the user enters 3, 4, and 5, the program should output 'YES'. ## 4. Strings -Previosuly we saw `strings` and know how to delcare them, but how to work with them? +Previously we saw `strings` and know how to declare them, but how to work with them? ### 4.1 Basic `str` operations @@ -398,6 +398,9 @@ Strings can be concatenated (glued) with the `+` operator, and repeated with `*` #### Example ```python +greeting = "Hello" +name = "World" + # Concatenation full_greeting = greeting + ', ' + name + '!' @@ -475,7 +478,7 @@ False Often, you need to access a specific character in a string. In Python, this is done using square brackets `[]` with the `index (number) `of the desired character. -***NOTE***: The count in `Python` starts from `0` and the 1st element of any data structure we will learn will be `0` element! +***NOTE***: The count in `Python` starts from `0` and the 1st element of any data structure we will learn will be the `0` element! Let's say we have the following string: @@ -502,7 +505,7 @@ Negative `indices` start from `-1` for the last characte | ---------- | ----------- | ----------- | | `s[-1]` | n | 6th character of string | | `s[-4]` | t | 3rd character of string | -| `s[-3]` | h | 6th character of string | +| `s[-3]` | h | 4th character of string | #### Output @@ -683,7 +686,7 @@ You walk into the forest and find a hidden treasure chest! ### Task 3: Travel Itinerary Planner -**Objective**: Plan your futre holiday, you might be tired already :) +**Objective**: Plan your future holiday, you might be tired already :) ``` Input: The user enters three cities they plan to visit.