Posts

Showing posts from February, 2022

Python LAB 2.8.1.4 Reading ints safely

Image
 Reading ints safely Reading ints safely Objectives improving the student's skills in defining functions; using exceptions in order to provide a safe input environment. Scenario Your task is to write a function able to input integer values and to check if they are within a specified range. LAB Sandbox The function should: accept three arguments: a prompt, a low acceptable limit, and a high acceptable limit; if the user enters a string that is not an integer value, the function should emit the message Error: wrong input, and ask the user to input the value again; if the user enters a number which falls outside the specified range, the function should emit the message Error: the value is not within permitted range (min..max) and ask the user to input the value again; if the input value is valid, return it as a result. Test data Test your code carefully. This is how the function should react to the user's input: Enter a number from -10 to 10: 100 Error: the value is not within per...

يوم التأسيس - يوم بدينا

Image
 يوم التأسيس يوم التأسيس السعودى - 300 عام تحتفل المملكة الهربية السعودية اليوم الموافق الثلاثاء 22 فبراير 2022 بكرى "يوم التأسيس" تحت شعار "يوم بدينا " , والذى يصادف ذكرى تأسيس الدولة السعودية الأولى قبل 3 قرون (300 عام) على يد الإمام محمد بن سعود ويأتي الاحتفاء بهذه الذكرى، بعد أن أصدر الملك سلمان بن عبدالعزيز آل سعود   أمرا ملكيا في يناير الماضي يقضي باعتبار 22 فبراير من كل عام يوماَ للتأسيس، ليتم الاحتفاء بهذه المناسبة لأول مرة وسط احتفالات وفعاليات تعم المملكة وتؤكد على الجذور التاريخية للبلاد. وكان الإمام محمد بن سعود قد أسس الدولة السعودية الأولى في منتصف عام 1139هـ (1727م) والتي استمرت إلى عام 1233هـ (1818م)، وعاصمتها "الدرعية". وأصبحت هذه مدينة  عاصمة لدولة مترامية الأطراف، ومصدر جذب اقتصادي واجتماعي وفكري وثقافي، وتحتضن على ترابها معالم أثرية، إضافة إلى أن النظام المالي للدولة وصف بأنه من الأنظمة المتميزة من حيث الموازنة بين الموارد والمصروفات. وقد هاجر كثير من العلماء إلى "الدرعية" لتلقي التعليم والتأليف الذي كان سائدا وقتها مما أدى إل...

Fun with Phrasal Verbs

Image
> Phrasal Verbs Fun with Phrasal Verbs Fun with Phrasal Verbs Phrasal Verbs are FuN Run out of to have no more of something This morning, I wanted some toast but I’d run out of bread. So, I rushed out of the house and got into the car. I turned the key but the car didn’t start -I’d run out of petrol! I ran down the road to the shop but they’d run out of sliced bread. I decided to buy some rolls instead. Then I realised I’d run out of . I’m always doing and the shopkeeper has run out of patience with me. I came home, looked at the clock and saw that I’d run out of time for breakfast. You can run out of food, most substances and materials, time, money, patience and luck. What have you ever run out of? Put off postpone doing something ...

Python 2.5.1.10 LAB: Find a word!

Image
 Find a Word in a Combination of Characters Find a word game Objectives improving the student's skills in operating with strings; using the find() method for searching strings. Scenario Let's play a game. We will give you two strings: one being a word (e.g., "dog") and the second being a combination of any characters. Your task is to write a program which answers the following question: are the characters comprising the first string hidden inside the second string? For example: if the second string is given as "vcxzxduybfdsobywuefgas", the answer is yes; if the second string is "vcxzxdcybfdstbywuefsas", the answer is no (as there are neither the letters "d", "o", or "g", in this order) Hints: you should use the two-argument variants of the pos() functions inside your code; don't worry about case sensitivity. Test your code using the data we've provided. Test data Sample input: donor Nabucodonosor Sample output:...

Python 2.5.1.9 LAB: The Digit of Life

Image
 The Digit of Life The digit of life Life Path Number Calculator To know your life path number, You need to enter your birth date as numbers only to calculate your life path number. You should add the digits of the month, day, and year until you arrive at a single digit number. How digit of life  is calculated Let's see the lab question. Objectives improving the student's skills in operating with strings; converting integers into strings, and vice versa. Scenario Some say that the Digit of Life is a digit evaluated using somebody's birthday. It's simple - you just need to sum all the digits of the date. If the result contains more than one digit, you have to repeat the addition until you get exactly one digit. For example: 1 January 2017 = 2017 01 01 2 + 0 + 1 + 7 + 0 + 1 + 0 + 1 = 12 1 + 2 = 3 3 is the digit we searched for and found. Your task is to write a program which: asks the user her/his birthday (in the format YYYYMMDD, or YYYYDDMM, or MMDDYYYY - actually, the ...

Python 2.5.1.8 LAB: Anagrams

Image
 Anagrams Anagram Listen = Silent [1] An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.[1] For example, the word binary into brainy and the word adobe into abode. The original word or phrase is known as the subject of the anagram. Any word or phrase that exactly reproduces the letters in another order is an anagram. Now, lets see the lab question. Scenario An anagram is a new word formed by rearranging the letters of a word, using all the original letters exactly once. For example, the phrases "rail safety" and "fairy tales" are anagrams, while "I am" and "You are" are not. Your task is to write a program which: asks the user for two separate texts; checks whether, the entered texts are anagrams and prints the result. Note: assume that two empty strings are not anagrams; treat upper- and lower-case letters as equal; spaces are not taken into acc...

Python 2.5.1.7 LAB: Palindromes

Image
Python: Check If a String is a Palindrome Palindrome Objectives improving the student's skills in operating with strings; encouraging the student to look for non-obvious solutions. Scenario Do you know what a palindrome is? It's a word which look the same when read forward and backward. For example, "kayak" is a palindrome, while "loyal" is not. Your task is to write a program which: asks the user for some text; checks whether the entered text is a palindrome, and prints result. Note: assume that an empty string isn't a palindrome; treat upper- and lower-case letters as equal; spaces are not taken into account during the check - treat them as non-existent; there are more than a few correct solutions - try to find more than one. Test your code using the data we've provided. Test data Sample input: Ten animals I slam in a net Sample output: It's a palindrome Sample input: Eleven animals I slam in a net Sample output: It's not a palindrome So...

English Test on Conditional Sentences

Image
 Online Quiz on Conditional Sentences - If Conditional Sentences Test If you studied our previous post "The Mystery of Conditionals - If  Conditional" , you would be able to pass below text. But in case your score is less than 75 %, then you need to reconsider reading the main course again. Remember the golden rule " Learn Less, Practice More " Challenge your score, challenge your time.