Posts

Showing posts from January, 2022

The Mystery of Conditionals - If Conditional

Image
Conditionals The Four Conditionals What are Conditionals? Conditionals are sentences that generally consist of two clauses , one which is dependent on the other. So; The conditional sentence - any conditional sentence - has two parts:  If Clause  +   ,   +  Main Clause ✅ If  you heat water to 100 degrees , | it boils . ⟹⏩ if clause | main clause ✅ Water boils   |   if you heat it to 100 degrees. ⟹ ⏩ main clause | if clause   🌞 Order is not important. The "Main Clause" can come before "if clause", only you will not use a "comma" in this case. How many forms of conditional? The Four Forms of Conditional Zero Conditional First Conditional Second Conditional Third Conditional ZERO CONDITIONAL Usage: - General truths - General habits  Zero Conditional - Structure If Clause Main Clause Examples Present simple Present simple - If it rains , I wear a coat. - If you heat metal, it expands . - If you mix red and blue, you get ...

Test on Nouns

Image
Nouns Quiz What is a Noun? In English grammar, a noun is a word that represents a person, place, thing, or idea. Nouns can be used to name objects, people, animals, place s, and abstract concepts. For example: People: teacher, doctor, friend Places: city, park, beach Things: car, book, pen Ideas: love, freedom, happiness Nouns can be categorized as proper nouns (specific names of people, places, or organizations) or common nouns (general names for people, places, or things). Proper nouns are usually capitalized, while common nouns are not. For example: Proper Noun: John, New York, Google Common Noun: man, city, company There are also other types of nouns such as concrete nouns (represent physical entities that can be perceived through the senses), abstract nouns (represent intangible concepts), collective nouns (represent a group of things or people), and countable/uncountable nouns (represent things that can or cannot be counted). If you haven't yet read our post on Nouns , try to...

Parts of Speech - Nouns

Image
What is a Noun? parts of Speech - Nouns A Noun (n)* is a word that identifies/refers to a thing, a person, a place, a feeling,  or their names. A Pronoun is a "noun substitute". A pronoun is used to avoid the unnecessary repetition of a noun. Examples of nouns: Things: food, car, building, apartment, shop,....  (singular and plural) Persons: John, Simon (Names must start with capital letters), man, woman, girl, baby … Animals: cat, lions, panda, buffalo,.... Places: School, home, garden, heaven, America (Names of countries and cities always start with a capital letter) … Fruits: apples, tomato, orange, banana, …. Feelings: anger, fear, joy, happiness, sadness, cleverness, trust, surprise, affection, honor … Some words are nouns (n) and verbs (v) in the same time, like: love, help Some nouns come as singular (only one) and can be plural (many), like (tree, trees, foot, feet) - We call them Countable (C) Other nouns can not be plural (like   happiness, anger, John, Ahmad,)...

Python LAB 2.5.1.6 Improving the Caesar cipher

Image
 Improving the Caesar cipher Improving the Caesar Cipher Level of difficulty Hard Pre-requisites Module 1.11.1.1, Module 1.11.1.2 Objectives improving the student's skills in operating with strings; converting characters into ASCII code, and vice versa. Scenario You are already familiar with the Caesar cipher, and this is why we want you to improve the code we showed you recently. The original Caesar cipher shifts each character by one: a becomes b , z becomes a , and so on. Let's make it a bit harder, and allow the shifted value to come from the range 1..25 inclusive . Moreover, let the code preserve the letters' case (lower-case letters will remain lower-case) and all non-alphabetical characters should remain untouched. Your task is to write a program which: asks the user for one line of text to encrypt; asks the user for a shift value (an integer number from the range 1..25 - note: you should force the user to enter a valid shift value (don't give up and don't...

Python LAB 2.5.1.3 Four simple programs

Image
 Solution for the Empty Line empty lines in python If you have reached practice 2.5.1.3 Four simple programs, you will notice a challenge in the bottom of the exercise: The code has one important weakness - it displays a bogus result when the user enters an empty line. Can you fix it? Let's see how to fix it. The problem: User may enter an empty line or just press Enter without any data. Solution: In case user entered an empty line = a loop + else We need to keep prompting user to enter data = input() line = input ( "Enter a line of numbers - separate them with spaces: " ) strings = line . split () total = 0 while strings == []: # If line is empty, string.split() will equal []     line = input ( "No data found \n Enter a line of numbers - separate them with spaces: " )     strings = line . split () else :         try :         for substr in strings :             total += float ( sub...

How to Remove Spaces from an Excel String Cell

Image
Document  Easy Formulas to Remove Spaces Excel formulas to remove spaces and clean your data efficiently. Simply, the paces inside an Excel string Cell are either: leading/starting spaces Mid spaces Trailing/ending spaces Plus, if you are exporting the data from the internet or a database, you may have some problematic characters (unprintable or 7-bit ASCI characters). We will handle this too. ✋ Before we start, we will assume that the data is in cell A1. We will insert the formulas starting from B1.Feel free to change cells reference to your references. How to remove all extra spaces from an Excel cell? This will include leading, mid, and trailing spaces =TRIM(A1) or =SUBSTITUTE(A1," ","") Remove Spaces and Clean Unprintable Characters =TRIM(CLEAN(A1)) You m...

Python 2.4.1.6 LAB: A LED Display

Image
Python Code to make a Seven Led Display Seven LED Display Exactly, what you see in the picture on top is a sample of a seven led display which uses a decimal number from 0-9 for as many digits as needed. Also, alpha characters (letters and symbols)can be used. Figure.1 Why is it called "Seven Segment"? Simply because it contains seven elements as shown in Figure.1. The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. The optional decimal point (an "eighth segment", referred to as DP) is used for the display of non-integer numbers. Figure.2 As shown in Figure.2, this is how the numbers are shown. For example, " 0 " means all segments from A-G are led(shown), " 1 " means B and C are shown. And below table shows us the plan of our code Seven Segments-LED display If you want to get a full idea about How Seven Segment LED Display works, you will find a slidesho...

Python 2.3.1.18 LAB: Your Own Split

Image
 Python LAB: 2.3.1.18 Your Own Split Function 2.3.1.18 Your Own Split Objectives improving the student's skills in operating with strings; using built-in Python string methods. Scenario You already know how split() works. Now we want you to prove it. Your task is to write your own function , which behaves almost exactly like the original split() method , i.e.: it should accept exactly one argument - a string; it should return a list of words created from the string, divided in the places where the string contains whitespaces; if the string is empty, the function should return an empty list ; its name should be mysplit()   Lab Problem Use the template in the editor. Test your code carefully. Expected output ['To', 'be', 'or', 'not', 'to', 'be,', 'that', 'is', 'the', 'question'] ['To', 'be', 'or', 'not', 'to', 'be,that', 'is', 'the', '...

Past Perfect vs Present Perfect

Image
 Past Perfect vs Present perfect had been or has been? - The  word " Perfect " refers to something " finished & complete ". Past Perfect 💬 Means something began in the past, lasted for some time, then ended . This is entirely in the past . He had been in prison from 1900 to 1914. (A specific period of time) 💬 To show that an action happened before a specific time in the past. She had established her company before 2008. He had never played football until last week. They had gotten engaged before last year. I had fallen asleep before eight o'clock. 💬 Past Perfect ⤄  vs ⤄  Past Simple : past perfect vs past simple If two actions happened in the past, we use the tenses this way: Action 1 - Past Perfect (first action) Action 2 - Past Simple (Second action that caused or interrupted the first action) She stayed up all night because she had received bad news. (First, she received bad news “past perfect”, then, she stayed up “past simple”.) They lost many of ...