<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Ammar Alyousfi's Blog</title><link href="https://ammar-alyousfi.com/" rel="alternate"/><link href="https://ammar-alyousfi.com/feed.xml" rel="self"/><id>https://ammar-alyousfi.com/</id><updated>2026-05-10T18:19:15.245732+04:00</updated><subtitle>A blog about data science.</subtitle><entry><title>Exploring Goodreads Data: An Analysis of 10 Million Books</title><link href="https://ammar-alyousfi.com/2024/exploring-goodreads-data-an-analysis-of-10-million-books.html" rel="alternate"/><published>2024-07-07T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2024-07-07:/2024/exploring-goodreads-data-an-analysis-of-10-million-books.html</id><summary type="html">&lt;p&gt;An interactive analysis of 10 million books on Goodreads.&lt;/p&gt;</summary><content type="html">&lt;h1 class="title"&gt;Exploring Goodreads Data: An Analysis of 10 Million Books&lt;/h1&gt;

&lt;!--  animate__animated animate__bounce --&gt;
&lt;!-- &lt;div id="feat-img"&gt;&lt;/div&gt; --&gt;

&lt;!-- &lt;p class="par"&gt;In this post, I’ll present the results of analyzing the data of 10+ million books on Goodreads.&lt;/p&gt; --&gt;

&lt;p class="par"&gt;Goodreads is one of the largest book websites on the internet. It has data about millions and millions of books from different genres and in many languages. It’s hard not to find a book on Goodreads whether it's published hundreds of years ago or just a few days ago.&lt;/p&gt;

&lt;p class="par"&gt;Today, I present the analysis results of more than 10 million books on Goodreads. In fact, the original dataset that I used had 50+ million books but I excluded 40 million of them for data quality reasons mentioned later in this article.&lt;/p&gt;

&lt;div class="feat-img"&gt;
    &lt;img src="/assets/book-analysis-1/feat-img.png" alt="feat-img"&gt; 
&lt;/div&gt;

&lt;p class="par"&gt;Goodreads allows you to search for any book and view its info, but there is no way to see all the available books and interact with them. Using the data in this analysis, however, I was able to do just that with millions of titles. Below, I’ll share some interesting findings and provide a method for further exploration at the end.&lt;/p&gt;

&lt;p class="par"&gt;Continue reading to know more about the analysis and the data or you can &lt;a href="#ref2"&gt;jump directly to the results section&lt;/a&gt;. But don't also forget to read about &lt;a href="#ref1"&gt;how to get the most out of this analysis&lt;/a&gt;.&lt;/p&gt;

&lt;div id="toc-con"&gt;
    &lt;h2 class="toc-title"&gt;Table of Contents&lt;/h2&gt;
    &lt;div id="toc"&gt;&lt;/div&gt;
    &lt;p class="toc-note"&gt;&lt;span class="toc-note-star material-symbols-outlined"&gt;star&lt;/span&gt; marks the sections that I find most interesting.&lt;/p&gt;
&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Data Used&lt;/h1&gt;
&lt;p class="par"&gt;I used an &lt;a target="_blank" href="https://www.kaggle.com/datasets/opalskies/large-books-metadata-dataset-50-mill-entries"&gt;obscure dataset&lt;/a&gt; published on Kaggle a few years ago. Its size uncompressed is 90 GB which made it hard to deal with on my personal computer, so I used cloud services (on AWS) for that. More on that below.&lt;/p&gt;

&lt;p class="par"&gt;The dataset contains information about 50+ million books published throughout the years up to 2021. It contains information about books including title, author, publisher, publication date, average rating, number of ratings, number of reviews, number of pages, categories assigned by users, format, and more.&lt;/p&gt;

&lt;!-- &lt;div id="mc_embed_shell"&gt;

    &lt;div id="mc_embed_signup"&gt;
        &lt;form action="https://ammar-alyousfi.us19.list-manage.com/subscribe/post?u=85eb6400d7b26faab2b8449e6&amp;amp;id=5b800dc254&amp;amp;f_id=00515de4f0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_self" novalidate=""&gt;
            &lt;div id="mc_embed_signup_scroll"&gt;
                &lt;div class="indicates-required"&gt;&lt;span class="asterisk"&gt;*&lt;/span&gt; indicates required&lt;/div&gt;
                &lt;div class="mc-field-group"&gt;&lt;label for="mce-EMAIL"&gt;Email Address &lt;span class="asterisk"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;input type="email" name="EMAIL" class="required email" id="mce-EMAIL" required="" value=""&gt;&lt;/div&gt;&lt;div class="mc-field-group"&gt;&lt;label for="mce-FNAME"&gt;First Name &lt;/label&gt;&lt;input type="text" name="FNAME" class=" text" id="mce-FNAME" value=""&gt;&lt;/div&gt;
            &lt;div id="mce-responses" class="clear foot"&gt;
                &lt;div class="response" id="mce-error-response" style="display: none;"&gt;&lt;/div&gt;
                &lt;div class="response" id="mce-success-response" style="display: none;"&gt;&lt;/div&gt;
            &lt;/div&gt;
        &lt;div aria-hidden="true" style="position: absolute; left: -5000px;"&gt;
            /* real people should not fill this in and expect good things - do not remove this or risk form bot signups */
            &lt;input type="text" name="b_85eb6400d7b26faab2b8449e6_5b800dc254" tabindex="-1" value=""&gt;
        &lt;/div&gt;
            &lt;div class="optionalParent"&gt;
                &lt;div class="clear foot"&gt;
                    &lt;input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="Subscribe"&gt;
                    &lt;p style="margin: 0px auto;"&gt;&lt;a href="http://eepurl.com/iRwPJw" title="Mailchimp - email marketing made easy and fun"&gt;&lt;span style="display: inline-block; background-color: transparent; border-radius: 4px;"&gt;&lt;img class="refferal_badge" src="https://digitalasset.intuit.com/render/content/dam/intuit/mc-fe/en_us/images/intuit-mc-rewards-text-dark.svg" alt="Intuit Mailchimp" style="width: 220px; height: 40px; display: flex; padding: 2px 0px; justify-content: center; align-items: center;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/form&gt;
    &lt;/div&gt;
    &lt;/div&gt; --&gt;

&lt;h1 class="top-heading"&gt;Method and Tools&lt;/h1&gt;

&lt;p class="par"&gt;As mentioned above, the dataset is large (90 GB) and it’s hard to deal with on a personal computer. So I used cloud services to process the data and extract the information I needed for the analysis. I used AWS services for that. I uploaded the data to S3 then used Glue to discover the data on S3 and define a structured table on top of it. From there, I used Athena to query the data, explore it, and extract the subset I needed for the analysis.&lt;/p&gt;

&lt;p class="par"&gt;The original dataset contains 50+ million books but most of them are not useful for the analysis. For example, some "books" are actually journals, notebooks, planners, calendars, etc. so I excluded them. I also excluded books with no ratings at all, meaning no one had rated them on Goodreads. After that, I ended up with around 23 million books.&lt;/p&gt;

&lt;p class="par"&gt;Some of these 23 million books were actually the same book but in different editions. For example, a book can have an English edition, a French edition, a Spanish edition, etc. It also can have multiple editions in the same language. I wanted to analyze books, not editions, so I selected one edition for each book. I ended up with around 9 million unique books.&lt;/p&gt;

&lt;p class="par"&gt;I Used SQL in Athena to clean the data and make it more structured and ready for analysis. Then I downloaded the data to my computer and started the analysis. To perform the analysis, I used Python, Pandas, NumPy, scikit-learn, OpenCV, and other libraries for data processing and analysis inside a Jupyter Notebook.&lt;/p&gt;

&lt;p class="par"&gt;For the interactive data visualization that you will see below, I used D3.js and in a few cases Observable Plot. This is my first time I extensively use D3.js for data visualization and I found it very powerful and flexible. It's now one of my favorite libraries although it has a steep learning curve. I've used Matplotlib, Seaborn, Plotly, and other libraries for data vis before but D3.js is different and more powerful in many ways.&lt;/p&gt;

&lt;!-- &lt;div id="filter-guide"&gt;
    &lt;div&gt;Hover over the filters to show them.&lt;/div&gt;
&lt;/div&gt; --&gt;

&lt;div id="ref1"&gt;&lt;/div&gt;
&lt;h1 class="top-heading"&gt;How to Use this Analysis&lt;/h1&gt;
&lt;p class="par"&gt;Here are some quick important notes to help you get the most of this analysis.&lt;/p&gt;

&lt;h2 class="sub-heading"&gt;Filtering: Fiction, Non-Fiction, or All&lt;/h2&gt;
&lt;p class="par" id="show-fg-trg"&gt;The analysis covers millions of books. You can filter the analysis results to see only fiction books, only non-fiction books, or all books (the default option.) You can do that by clicking on the filter buttons (&lt;span class="material-symbols-outlined inline-icon"&gt;tune&lt;/span&gt;) on the right side of the screen. When you select an option, all charts and numbers on the page change to reflect the selected option.&lt;/p&gt;

&lt;p class="par note"&gt;You can also use keyboard shortcuts: &lt;span class="keybk"&gt;Shift&lt;/span&gt; + &lt;span class="keybk"&gt;F&lt;/span&gt; for fiction, &lt;span class="keybk"&gt;Shift&lt;/span&gt; + &lt;span class="keybk"&gt;N&lt;/span&gt; for non-fiction, and &lt;span class="keybk"&gt;Shift&lt;/span&gt; + &lt;span class="keybk"&gt;A&lt;/span&gt; for all.&lt;/p&gt;

&lt;h2 class="sub-heading"&gt;Interactive Charts&lt;/h2&gt;
&lt;p class="par"&gt;This analysis is interactive, meaning you can hover over the charts to see more info about the data points. For example, you can hover over a book to see its title, author, and other info.&lt;/p&gt;

&lt;div id="filter-opener"&gt;
    &lt;span class="material-symbols-outlined"&gt;tune&lt;/span&gt;
&lt;/div&gt;

&lt;div id='book-type-filter-wrapper'&gt;
    &lt;input type='radio' id='radio1-1' name='radio' value="fiction"&gt;
    &lt;label for='radio1-1'&gt;Fiction&lt;/label&gt;
    &lt;input type='radio' id='radio1-2' name='radio', value="non-fiction"&gt;
    &lt;label for='radio1-2'&gt;Non-Fiction&lt;/label&gt;
    &lt;input type='radio' id='radio1-3', checked='checked', name='radio', value="all"&gt;
    &lt;label for='radio1-3'&gt;All&lt;/label&gt;
&lt;/div&gt;

&lt;!-- &lt;h1 class="top-heading analysis-results"&gt;Analysis Results&lt;/h1&gt; --&gt;
&lt;p class="par analysis-results-p"&gt;Now let’s begin with the analysis results...&lt;/p&gt;

&lt;div id="ref2"&gt;&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Top Books&lt;/h1&gt;

&lt;p class="par"&gt;Let’s start with the top books on Goodreads. We will look at the most rated books, most reviewed books, and top rated books.&lt;/p&gt;

&lt;p class="par"&gt;Each book on Goodreads can be rated by users between 1 and 5 stars. The average rating of a book is a good indicator of its quality. The number of ratings a book receives is also a good indicator of its popularity.&lt;/p&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Popular Books&lt;/h2&gt;

&lt;p class="par"&gt;The following chart shows books that received the largest number of ratings, indicating that they are the most popular on the platform. &lt;span class="int-ins"&gt;Hover over any bar to see more info about the book. Click on a book cover to go to its page on Goodreads.&lt;/span&gt;&lt;/p&gt;

&lt;div id="most-rated-books-chart" class="chart-con"&gt;&lt;/div&gt;

&lt;p class="par"&gt;The histogram below shows the distribution of book rating counts. Note that the y-axis is log scaled (i.e. it goes like 1, 10, 100, 1000, etc. instead of 1, 2, 3, 4, etc.) &lt;span class="int-ins"&gt;Hover over any bar to see the number of books with that rating count.&lt;/span&gt;&lt;/p&gt;

&lt;div id="ratings-hist-chart" class="chart-con"&gt;&lt;/div&gt;

&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Reviewed Books&lt;/h2&gt;

&lt;p class="par"&gt;In addition to rating a book between 1 and 5 stars, users can leave a written review where they talk about their opinion about the books, their notes, recommendations, etc.&lt;/p&gt;

&lt;p class="par"&gt;In addition to indicating popularity like the number of ratings above, the number of reviews points out the impact of the book. In other words, it’s easy to rate a book but to write a review, it usually means you have more to say about the book, whether positive or negative.&lt;/p&gt;

&lt;p class="par"&gt;The following chart shows books that received the highest number of reviews. &lt;span class="int-ins"&gt;Hover over any bar to see more info about the book. Click on a book cover to go to its page on Goodreads.&lt;/span&gt;&lt;/p&gt;

&lt;div id="most-reviewed-books-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;!-- &lt;h2 class="section-heading"&gt;Highest Rated Books&lt;/h2&gt;
&lt;div id="num-books-5-rating"&gt;There are &lt;span id="num_55_rating"&gt;&lt;/span&gt; books with a 5/5 rating. Let's see the ones with most ratings.&lt;/div&gt;
&lt;div id="highest-rated-books-chart" class="chart-con"&gt;&lt;/div&gt; --&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading featured"&gt;Top Rated Books&lt;/h2&gt;

&lt;p class="par"&gt;When searching for the top-rated books on Goodreads, it's important to consider not only the average rating but also the number of ratings each book has received. While there are some books with a perfect 5/5 rating, they often have a low number of ratings, which can make the rating less reliable.&lt;/p&gt;

&lt;p class="par"&gt;To find the most highly-rated books on Goodreads, I used two methods that you can choose between:&lt;/p&gt;

&lt;h4&gt;Weighted Rating&lt;/h4&gt;

&lt;p class="par"&gt;The weighted rating takes into account both the average rating (out of 5) and the number of ratings a book has received. Average rating is a crucial metric, but relying solely on it can be misleading for books with very few ratings. So we add number of ratings to the formula to enhance the reliability. A high number of ratings can indicate a more trustworthy average rating.&lt;/p&gt;

&lt;p class="par"&gt;The weighted rating formula combines these two metrics as follows:&lt;/p&gt;

&lt;div class="math-eq"&gt;
\[ \begin{align}
\text{Weighted Rating}_i = \frac{n_i \times r_i}{\sum_{j=1}^{m} n_j}
\end{align} \]
&lt;/div&gt;

&lt;p class="par"&gt;Where:
- \(i\) is the index of the current book
- \(n_i\) is the number of ratings for book \(i\)
- \(r_i\) is the average rating for book \(i\)
- \(m\) is the total number of books
- \(\sum_{j=1}^{m} n_j\) is the sum of the number of ratings for all books&lt;/p&gt;


&lt;p class="par"&gt;This formula ensures that books with a higher number of ratings and a high average rating will rank higher than those with fewer ratings, even if they have a perfect 5/5 average rating.&lt;/p&gt;

&lt;h4&gt;Percentage of 5-Star Ratings&lt;/h4&gt;

&lt;p class="par"&gt;Another approach to finding top-rated books is to look at the percentage of 5-star (or 5/5) ratings the book has received. For instance, if a book has a 5-star percentage of 40%, it means that 40% of the ratings given to the book are the highest possible rating of 5/5. The remaining 60% of the ratings are split among lower ratings.&lt;/p&gt;

&lt;p class="par"&gt;By focusing on books with a high percentage of 5-star ratings, we can identify those that have not only received high ratings but have also maintained that high level of satisfaction among a significant number of reviewers.&lt;/p&gt;

&lt;p class="par note"&gt;Note: For the two methods mentioned above, we excluded books with less than 500 ratings.&lt;/p&gt;

&lt;p class="par"&gt;Use the filter below to switch between methods. &lt;span class="int-ins"&gt;Hover over any book cover in the chart to see more info. Click on a book cover (if you're not on a mobile device) to go to its page on Goodreads.&lt;/span&gt;&lt;/p&gt;

&lt;div class="top-rated-filter-con"&gt;
    &lt;div class="top-rated-filter-title"&gt;See top rated books by:&lt;/div&gt;
    &lt;div class="top-rated-filter-buttons"&gt;
        &lt;button class="top-rated-filter active" data-filter="weighted"&gt;Weighted Rating&lt;/button&gt;
        &lt;button class="top-rated-filter" data-filter="5-percentage"&gt;Percentage of 5-Star Ratings&lt;/button&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;div id="top-rated-books-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Average Rating Over Time&lt;/h2&gt;

&lt;p class="par"&gt;The following chart shows the average rating of books published each decade from 1700s to 2010s. It allows us to see how book rating tend to change over time. &lt;span class="int-ins"&gt;Hover over the line to see the average rating for each decade.&lt;/span&gt;&lt;/p&gt;
&lt;div id="avg-rating-over-time-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p class="par note"&gt;Note: Books with less than 50 ratings were excluded from this analysis.&lt;/p&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading featured"&gt;Top Books Over Time&lt;/h2&gt;

&lt;p class="par"&gt;The following chart shows the "top" book over the years since 2000 in four different categories:&lt;/p&gt;

&lt;ul class="par-ul"&gt;
&lt;li&gt;&lt;strong&gt;Most Popular Books:&lt;/strong&gt; the book with the highest number of ratings each year.&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Highest Rated:&lt;/strong&gt; the book with the highest average rating (out of 5) each year.&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Popular, Yet Not So Loved:&lt;/strong&gt; the book with the highest number of ratings in a year, but whose average rating (out of 5) is below average that year.&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Hidden Gem:&lt;/strong&gt; the book with the highest average rating (out of 5) in a year, but whose popularity (number of ratings) is below average that year.&lt;/li&gt;
&lt;/ul&gt;

&lt;p class="par note"&gt;Note: Books with 500 ratings or less were excluded from this section.&lt;/p&gt;

&lt;p class="par"&gt;&lt;span class="int-ins"&gt;Hover over any book to see more info about it.&lt;/span&gt;&lt;/p&gt;

&lt;div id="top-books-over-time-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Book Topics and Genres&lt;/h1&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading featured"&gt;Most Common Words in Book Titles, Over Time&lt;/h2&gt;
&lt;p class="par"&gt;The following word cloud shows the most common words in book titles over time. This can give us an idea of the most popular topics in books over the years.&lt;/p&gt;

&lt;p class="par"&gt;Select a decade below to see the most common words in book titles for that decade. 1950s is selected by default.&lt;/p&gt;

&lt;p class="par"&gt;In the word cloud, word size reflects its frequency in book titles: the bigger the word, the more it was used in book titles. Also, when you go from one decade to another, new words—that weren't common in the previous decade—will appear in a different color. This helps you see how the most common words in book titles have changed over time.&lt;/p&gt;

&lt;p class="par"&gt;&lt;span class="int-ins"&gt;Hover over any word to see the exact number of times it was used in book titles and some of the book titles where it was used.&lt;/span&gt;&lt;/p&gt;

&lt;div id="common-words-options-con"&gt;
    &lt;div class="common-words-options-title"&gt;Select a decade:&lt;/div&gt;
    &lt;div id="common-words-options"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="word-cloud-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Genres Popularity Over Time&lt;/h2&gt;

&lt;p class="par"&gt;The following chart shows the popularity of different genres over the years between 1901 and 2013. It allows us to see how the popularity of different genres has changed over time. We focus on 10 of the most popular genres on Goodreads. Popularity is measured by the number of books published each year under each of the genres.&lt;/p&gt;

&lt;p class="par"&gt;Use the checkboxes below to remove/add genres to the chart. &lt;span class="int-ins"&gt;Hover over a line to see more info about the genre popularity over the years.&lt;/span&gt;&lt;/p&gt;

&lt;div id="shelf-filters-con"&gt;
&lt;div class="shelf-filters-title"&gt;Select genres to show:&lt;/div&gt;
&lt;div id="shelf-filters"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="pl" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class='dash-sub-em-con'&gt;
    &lt;!-- &lt;div class="sub-img"&gt;&lt;img src="/assets/images/2021/lb4.png" &gt;&lt;/div&gt; --&gt;
    &lt;p&gt;
        Do you want to look at the data&lt;sup&gt;*&lt;/sup&gt; and interact with it? Click the button below to get access to
        a dashboard with hundreds of thousands of books to explore.
    &lt;/p&gt;
    &lt;p&gt;&lt;a href="https://mailchi.mp/fc0b1ad90e2f/goodreads-analysis-1" target="_blank"&gt;
        &lt;button class="dsem-btn"&gt;Get Access&lt;/button&gt;
    &lt;/a&gt;&lt;/p&gt;
    &lt;p&gt;&lt;span class="dsem-note"&gt;*The dashboard show books used in this analysis that have more than 500 ratings.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Authors&lt;/h1&gt;
&lt;p class="par"&gt;Let’s now explore book authors. We will look at the most prolific authors, the most popular authors, and the top-rated authors.&lt;/p&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Prolific Authors&lt;/h2&gt;
&lt;p class="par"&gt;The following graph shows the authors who produced the largest number of books. &lt;span class="int-ins"&gt;Hover over any bar to see more info about the author and their most popular books.&lt;/span&gt;&lt;/p&gt;

&lt;div class="par note"&gt;Only books with more than 50 ratings were considered to determine the most prolific authors.&lt;/div&gt;

&lt;div id="top-authors-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Popular Authors&lt;/h2&gt;
&lt;p class="par"&gt;The following graph shows the authors whose books received the largest number of ratings. This is done by combining the number of ratings for all books by the author. &lt;span class="int-ins"&gt;Hover over any bar to see more info about the author and their most popular books.&lt;/span&gt;&lt;/p&gt;

&lt;div id="most-rated-authors-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Top Rated Authors&lt;/h2&gt;
&lt;p class="par"&gt;The following graph shows the authors whose books received the highest average ratings. This is done by calculating the average rating for all books by the author. &lt;span class="int-ins"&gt;Hover over any author name to see more info about the author and their most popular books.&lt;/span&gt;&lt;/p&gt;

&lt;p class="par"&gt;Author rating is calculated by averaging the ratings of all books by the author weighted by the number of ratings each book received. The following formula was used to calculate each author rating:&lt;/p&gt;

&lt;div class="math-eq"&gt;
\[ \begin{flalign}
&amp; \text{Author Rating} = \frac{\sum_{i=1}^{n} w_i r_i}{\sum_{i=1}^{n} w_i} &amp;
\end{flalign} \]
&lt;/div&gt;

&lt;p class="par"&gt;where \( r_i \) represents the rating of the \( i \)-th book, \( w_i \) represents the number of ratings (or the weight) that the \( i \)-th book received. The symbol \( \sum \) represents the sum over all books from 1 to \( n \), where \( n \) is the total number of books.&lt;/p&gt;

&lt;p class="par note"&gt;Only authors who authored more books than the average number of books per author and who received more than 50 ratings per book on average were considered.&lt;/p&gt;

&lt;div id="top-rated-authors-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Publishers&lt;/h1&gt;
&lt;p class="par"&gt;Now let’s head to the publishers. Similar to authors, we will look at the most prolific publishers, the most popular publishers, and the top-rated publishers.&lt;/p&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Prolific Publishers&lt;/h2&gt;
&lt;p class="par"&gt;The following graph shows the publishers who published the largest number of books. &lt;span class="int-ins"&gt;Hover over any bar to see more info about the publisher and the most popular books they published.&lt;/span&gt;&lt;/p&gt;

&lt;div class="par note"&gt;Only books with more than 50 ratings were considered to determine the most prolific publishers.&lt;/div&gt;

&lt;div id="top-publishers-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Popular Publishers&lt;/h2&gt;

&lt;p class="par"&gt;The following graph shows the publishers whose books received the largest number of ratings. This is done by combining the number of ratings for all books published by the publisher. &lt;span class="int-ins"&gt;Hover over any bar to see more info about the publisher and their most popular books.&lt;/span&gt;&lt;/p&gt;

&lt;div id="most-rated-publishers-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Top Rated Publishers&lt;/h2&gt;

&lt;p class="par"&gt;The following graph shows the publishers whose books received the highest average ratings. This is done by calculating the average rating for all books published by the publisher. &lt;span class="int-ins"&gt;Hover over any publisher name to see more info about the publisher and their most popular books.&lt;/span&gt;&lt;/p&gt;

&lt;p class="par"&gt;Publisher rating is calculated by averaging the ratings of all books published by the publisher weighted by the number of ratings each book received. The following formula was used to calculate each publisher rating:&lt;/p&gt;

&lt;div class="math-eq"&gt;
\[ \begin{flalign}
&amp; \text{Publisher Rating} = \frac{\sum_{i=1}^{n} w_i r_i}{\sum_{i=1}^{n} w_i} &amp;
\end{flalign} \]
&lt;/div&gt;

&lt;p class="par"&gt;where \( r_i \) represents the rating of the \( i \)-th book, \( w_i \) represents the number of ratings (or the weight) that the \( i \)-th book received. The symbol \( \sum \) represents the sum over all books from 1 to \( n \), where \( n \) is the total number of books.&lt;/p&gt;

&lt;p class="par note"&gt;Only publishers who published more books than the average number of books per publisher and who received more than 50 ratings per book on average were considered.&lt;/p&gt;

&lt;div id="top-rated-publishers-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Book Series&lt;/h1&gt;
&lt;p class="par"&gt;A series is a collection of books that are connected by a shared theme or story. This section of the analysis focuses on book series. &lt;span id="perc_books_in_series"&gt;&lt;/span&gt; of the &lt;span id="books_count_2"&gt;&lt;/span&gt; books we are looking at are part of a series. In this section, we will look at the longest series and the most popular series.&lt;/p&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Longest Book Series&lt;/h2&gt;
&lt;p class="par"&gt;The following chart shows the top 20 series with the largest number of books. Each small rectancle represents a book in the series. &lt;span class="int-ins"&gt;Hover over a series title to see more info about it including its most popular books.&lt;/span&gt;&lt;/p&gt;

&lt;p class="par note"&gt;Only books with more than 50 ratings were considered to determine the longest series.&lt;/p&gt;

&lt;div id="longest-series-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Most Popular Series&lt;/h2&gt;

&lt;p class="par"&gt;The following chart shows the series that received the largest number of ratings across all their books. &lt;span class="int-ins"&gt;Hover over any bar to see the most popular book in the series along with other info.&lt;/span&gt;&lt;/p&gt;

&lt;div id="most-rated-series-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h1 class="top-heading"&gt;Number of Pages&lt;/h1&gt;
&lt;p class="par"&gt;Let’s now talk about the number of pages. We will look at the distribution of the number of pages for the books then see how the typical number of pages change over time. &lt;/p&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Number of Pages Distribution&lt;/h2&gt;
&lt;p class="par"&gt;The following chart shows the distribution of the number of pages for the books; it allows us to see the variety in book lengths. The x-axis represents the number of pages and the y-axis represents the number of books with that number of pages. &lt;span class="int-ins"&gt;Hover over any bar to see the number of books with that number of pages.&lt;/span&gt;&lt;/p&gt;

&lt;p class="par note"&gt;Note that the y axis is log scaled.&lt;/p&gt;

&lt;p class="par note"&gt;Books that don't have an actual number of pages (like books in audio formats) and books with more than 10,000 pages are excluded from this analysis.&lt;/p&gt;

&lt;div id="num-pages-hist-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Number of Pages Over Time&lt;/h2&gt;
&lt;p class="par"&gt;The following chart shows the median number of pages for books published each decade between 1700s and 2020s. This is a good indicator of the typical length of books over time. We use the median, not the average, because there are a few books with an extremely high number of pages that would skew the average, so the median is more robust in this case.&lt;/p&gt;

&lt;p class="par note"&gt;Books that don't have an actual number of pages (like books in audio formats) are excluded from this analysis.&lt;/p&gt;

&lt;div id="num-pages-over-time-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;!-- Some of the longest books:... --&gt;

&lt;!-- &lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Very Long But Highly Rated Books&lt;/h2&gt;
&lt;p class="par"&gt;The following chart shows the books with the highest number of pages and the highest average ratings. This is a good indicator of the quality of long books.&lt;/p&gt;
&lt;p class="par"&gt;The following chart shows the longest books with the highest average ratings. Hover over a book to see more info about it.&lt;/p&gt;
&lt;div id="long-high-rating-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt; --&gt;

&lt;h1 class="top-heading"&gt;Book Covers&lt;/h1&gt;

&lt;div class="module"&gt;
&lt;h2 class="section-heading"&gt;Popular Colors in Book Covers&lt;/h2&gt;
&lt;p class="par"&gt;The following chart shows the most popular colors in book covers. You can see that we show colors for three groups of books:&lt;/p&gt;

&lt;ul class="par-ul"&gt;
    &lt;li&gt;Most rated 1,000 books&lt;/li&gt;
    &lt;li&gt;Top rated 1,000 books&lt;/li&gt;
    &lt;li&gt;Random sample of 1,000 books that are not in the above two groups&lt;/li&gt;
&lt;/ul&gt;

&lt;p class="par"&gt;The size of each color reflects its popularity, meaning colors with wider areas were used more frequently in book covers.&lt;/p&gt;

&lt;p class="par"&gt;To get the most popular colors in each of the three groups mentioned above, I downloaded the images of the 1,000 book covers in the group, extracted the colors of all pixels in the images, converted the colors to the CIELAB color space which is designed to approximate human vision, then ran a clustering algorithm on all the colors to group them in 15 clusters. After that, I fetched the colors at the centers of the clusters and the number of pixels that belong to each cluster and the results are what you're looking at below.&lt;/p&gt;

&lt;p class="par note"&gt;Books with no cover image or with 50 ratings or less were excluded from this analysis.&lt;/p&gt;

&lt;div id="colors-chart" class="chart-con"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class='dash-sub-em-con'&gt;
    &lt;!-- &lt;div class="sub-img"&gt;&lt;img src="/assets/images/2021/lb4.png" &gt;&lt;/div&gt; --&gt;
    &lt;p&gt;
        If you've enjoyed this analysis and you want to look at the data&lt;sup&gt;*&lt;/sup&gt; and interact with it? Click the button below to get access to a dashboard with hundreds of thousands of books to explore.
    &lt;/p&gt;
    &lt;p&gt;&lt;a href="https://mailchi.mp/fc0b1ad90e2f/goodreads-analysis-1" target="_blank"&gt;
        &lt;button class="dsem-btn"&gt;Get Access&lt;/button&gt;
    &lt;/a&gt;&lt;/p&gt;
    &lt;p&gt;&lt;span class="dsem-note"&gt;*The dashboard show books used in this analysis that have more than 500 ratings.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p class="par lastNote"&gt;👋&lt;br&gt;If you have any questions, feedback, or suggestions, you can email me at ammar5656 at gmail dot com, or you can reach me on X (link below)&lt;/p&gt;

&lt;!-- Number of records in the database: 47,015,693
Number of distinct book IDs: 47,015,693
Number of distinct book titles: 30,202,212
Number of distinct work IDs: 27,442,602

Empty titles: 480
Empty ISBNs: 16,797,129
Empty ISBN13s: 14,197,907
Empty language: 38,299,361
Empty publication date: 18,192,502
Empty original publication date: 21,064,808
Empty format: 18,559,874
Empty publisher: 18,364,021
Empty number of pages: 22,413,596
Empty series ID: 42,272,022
Empty description: 14,790,316


Processing Steps:
- When only year or year and month provided for publication date or original publication date, we set month and day to 1. When an invalid date is provided, we try to make it valid as much as possible. For example, if the provided date is 2019-28, we set the date to 2019-01-01.
- Exclude records where the author is "NOT A BOOK" (usually journals, notebooks, planners, calendars, etc. See Goodreads description of this author). Examples: 50145364, 42190702, 45797073, 52120457, 31745544.
- Around 300,000 records have the author as "Anonymous" and ~200,000 "Unknown". We keep these records. (See Goodreads descriptions).
- Remove extra white spaces from author names.
- There are 2786577 records where ISBN or ISBN13 are not null but aren't valid ISBNs (not 10/13 digits). We keep these records.
- Replace "en-US", "en-GB", etc. with "eng" for language. There are other languages with similar issues, but much less frequent.
- `rating_dist` column gets splitted into 5 columns, one for each rating.
- HTML tags are removed from description. [Not implemented]

Notes About Works:
- Work ID is the same for all editions of a book. But it's different for related books. For example, work ID for "Chicken Soup for the Sister's Soul: Inspirational Stories About Sisters and Their Changing Relationships" is different than the work ID for "Chicken Soup for the Sister's Soul 2: Celebrating Love and Laughter Throughout Our Lives".
- Books with the same work ID have (almost) the same rating and review data, original publication date, series ID and name, and shelves. But they have different title, publication date, description, number of pages, etc.

Stats for Excluding Records:
- All books: 47,015,693
- Books with rating count &gt; 0: 23,356,640
- Books with rating count &gt;= 10: 12,506,971
- Works: 27,442,602
- Works with rating count &gt; 0: 9,320,928


- Created the `goodreads_books_p` table which implements the processing steps above and which includes books with rating count &gt; 0.
- Created the `goodreads_works_p` table which implements the processing steps above and which includes works with rating count &gt; 0. The book selection for a given work ID is done by selecting the book with minimum ID that has a publication date (not null) and has a cover image. If there is no book with these criteria for a given work ID, then the book with minimum ID is selected. --&gt;</content><category term="data-science"/><category term="data-analysis"/><category term="data-science"/><category term="data-visualization"/></entry><entry><title>ملخص كتاب براهين النبوة</title><link href="https://ammar-alyousfi.com/ar/2024/proofs-of-prophethood-book-notes-ar.html" rel="alternate"/><published>2024-02-22T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2024-02-22:/ar/2024/proofs-of-prophethood-book-notes-ar.html</id><summary type="html">&lt;p&gt;كتاب من عنوانه يعرض براهين نبوة سيدنا محمد صلى الله عليه وسلم ويناقش اعتراضات المعترضين. وفي هذا المنشور أعرض المقتطفات التي انتقيتها من الكتاب، وهي لا تعتبر ملخصاً للكتاب ولكل الجوانب التي تناولها، لكنها الأشياء التي أحسست بأهميتها الأكبر من وجهة نظري. الكتاب أكثر من 600 صفحة وهذا الملخص صفحات …&lt;/p&gt;</summary><content type="html">&lt;p&gt;كتاب من عنوانه يعرض براهين نبوة سيدنا محمد صلى الله عليه وسلم ويناقش اعتراضات المعترضين. وفي هذا المنشور أعرض المقتطفات التي انتقيتها من الكتاب، وهي لا تعتبر ملخصاً للكتاب ولكل الجوانب التي تناولها، لكنها الأشياء التي أحسست بأهميتها الأكبر من وجهة نظري. الكتاب أكثر من 600 صفحة وهذا الملخص صفحات قليلة، لذا ستجد في الكتاب معلومات وتفاصيل أكثر.&lt;/p&gt;
&lt;p&gt;المؤلف أتاح تحميل الكتاب كاملاً مجاناً من هنا: https://almobadarah.com/books/baraheen.ar.pdf.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2024/baraheen-book-cover.jpeg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;صفحة الكتاب على موقع Goodreads الخاص بالكتب: &lt;a href="https://www.goodreads.com/ar/book/show/38224557"&gt;براهين النبوة والرد على اعتراضات المستشرقين والمنصرين&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="_1"&gt;حفظ القرآن والسنة&lt;/h2&gt;
&lt;p&gt;لقد شهد لميزة حفظ السيرة النبوية في تاريخ الأنبياء المستشرق بنيامين بوزمورث سمث - أحد أساقفة الكنيسة المشيخية في أمريكا - حيث ذكر في كتابه (محمد والمحمدية) أننا لا نعلم الكثير عن حياة موسى وعيسى وبوذا وغيرهم أما الإسلام فأمره كله واضح وفي أيدي الناس تاريخه الصحيح ويعلمون من أمر محمد صلى الله عليه وسلم الكثير. ص77.&lt;/p&gt;
&lt;p&gt;شهادة المستشرق اليهودي برنارد لويس المعروف بمواقفه السلبية من الإسلام: «&amp;hellip;ولكن نقد علماء الحديث الدقيق للأسانيد وجمعهم الدقيق للاختلافات&amp;hellip; يعطي لعلم التأريخ العربي في القرون الوسطى مهنية ومراساً لا نجد له نظيراً في القديم ولا مماثلاً في القرون الوسطى في الغرب&amp;hellip; بل حتى علم التاريخ في العالم المسيحي اليوناني، والذي هو أكثر تقدماً وتعقيداً، يقصر هو أيضاً عن مضاهاة الأدبيات التاريخية الإسلامية من نواحي الحجم والتنوع والعمق التحليلي». ص81.&lt;/p&gt;
&lt;p&gt;شهادة المؤرخ النصراني اللبناني (أسد جبرائيل رستم): «أول من نظم نقد الروايات التاريخية ووضع القواعد لذلك علماء الدين الإسلامي، فإنهم اضطروا اضطراراً إلى الاعتناء بأقوال النبي، وأفعاله لفهم القرآن وتوزيع العدل&amp;hellip; فانبروا لجمع الأحاديث ودرسها وتدقيقها فأتحفوا علم التاريخ بقواعد لا تزال، في أسسها وجوهرها، محترمة في الأوساط العلمية حتى يومنا هذا». ص82.&lt;/p&gt;
&lt;p&gt;السيرة لم تؤلف في القرن الثالث الهجري، وإنما قد ازدهر فيه جمع أخبار الرسول صلى الله عليه وسلم في مؤلفات علمية تخصصية بأسانيد يبلغ طرفها الآخر الرسول صلى الله عليه وسلم، وهذه الأسانيد يمكن الحكم عليها وفق الأصول التي وضعها عباقرة أهل الحديث. وقد نقل العلماء كل ما وصل إليهم سواء كان صحيحاً أو ضعيفاً أو حتى موضوعاً.&lt;/p&gt;
&lt;p&gt;‏أبعد الناس عن إحسان الظن برواة الأخبار هم علماء الحديث، ‏إذ يمكن القول أن علم الحديث قائم في الحكم على الرواة على سوء الظن بالرواة لا التسليم الأولي بعدالتهم، حتى قال الإمام المحدث (عبد الرحمن بن مهدي) في القرن الثاني الهجري: «خصلتان لا يستقيم فيهما حسن الظن: الحكم والحديث». قال الإمام (ابن القطان): «لم نر أهل الخير في شيء أكذب منهم في الحديث» فلم يكن هم المحققين من المحدثين تصحيح روايات أهل الورع والصلاح. ص88-89.
ولم يقتصر علماء الحديث على تقسيم الرواة إلى ثقات وضعفاء وإنما ميزوا الثقات إلى طبقات، والضعفاء رتبوهم في دركات.&lt;/p&gt;
&lt;p&gt;حديث: «من كذب علي متعمداً فليتبوأ مقعده من النار» رواه بضعة وسبعون صحابياً، منهم العشرة المبشرون بالجنة، ولم يرو حديث عن النبي صلى الله عليه وسلم بهذه الكثرة. كما روى أربعة وعشرون صحابياً حديث: «نضر الله عبداً سمع مقالتي فوعاها، فبلغها من لم يسمعها» وهو في الحض على الرواية الصادقة التي تذيع خبر الوحي.&lt;/p&gt;
&lt;p&gt;اعترف المنصّر (ويليام موير) قائلًا: «قرآنٌ واحد كان سائدًا بين المسلمين، والاستخدام المتزامن لنفس السّفر من جانبهم جميعًا في كل عصر حتّى يومنا هذاء هو دليل حاسم أن ما بين أيدينا الآن هو النص عينه الذي تمّ إعداده بأمر الخليفة المظلوم. يبدو أنّه لا يوجد أي عمل آخر ظل اثني عشر قرنا بهذا النقاء كنص». [من كتاب Life of Mohamet: from original sources]&lt;/p&gt;
&lt;p&gt;الاتفاق حاصل بين جميع علماء النقد النصيّ أنه لا سبيل للوصول بطريق مباشر أو من خلال التراث الشفهي أو المخطوطات إلى نص التوراة، بالإضافة إلى أنّنا نملك ثلاث روايات متأخرة ومختلفة للتوراة في عدد من نصوصها: التوراة العبرية، والتوراة السامرية، والترجمة السبعينية اليونانية. وأما العهد الجديد (الإنجيل مجازًا) فقد انتهت (Institut für neutestamentliche Textforschung) - أهم مؤسسة علميّة عالميّة مهتمة بتركيب أفضل نص يوناني للعهد الجديد ‏- في نسختها اليونانية الأخيرة (NA 28) إلى أن آخر رجائها في البحث التاريخي النقدي أن تصل إلى أقدم نص ممكن للعهد الجديد لا النص الأصلي، لامتناع استعادة النص الأوّل.
البحث التاريخي أثبت وجود العديد من الأخطاء في العهدين القديم والجديد، بعضها مذكور ص544 وما بعدها.&lt;/p&gt;
&lt;p&gt;الكتاب المقدس وفقدان الأسانيد: يتكون الكتاب المقدس من 66 سفراً عند البروتستانت أو أكثر عند الكاثوليك والأرثودكس. وهذه الأسفار كلها بلا استثناء فاقدة للإسناد المتصل، بل هي عند التحقيق بلا إسناد أصلاً.&lt;/p&gt;
&lt;p&gt;علم المستشرقون - بداهة - أن قبول السيرة كلية أو بالجملة لا بد أن يؤول إلى الإقرار بنبوة محمد صلى الله عليه وسلم، ولذلك كان مبدأ النظر الاستشراقي في السيرة البحث عن بدائل غير الميراث الحديثي، وقد تولى كبر هذا الأمر (إجناتس جولدتسيهر)، ثم اتسع الأمر وتفرعت مسالكه. ولا يملك القارئ الجاد إلا العجب من هذه البدائل التي يطرحها المستشرقون بعدما ردوا الروايات المسندة المصفاة من كدر الشبهة، فهي مراجع صامتة لا تُبين، أو مشبوهة لا تستأمن على خبر التاريخ وعلى رأسها:
1. الكتابات المبكرة لغير المسلمين: رغم إغراء العثور على مصدر تاريخي خارجي &amp;ldquo;محايد&amp;rdquo; في قراءة التاريخ الإسلامي، إلا أن هذا المذهب فاسد من أوجه كثيرة أهمها:
    - المصادر غير الإسلامية المبكرة لا تكاد تقدم معلومات تاريخية تذكر عن الإسلام، وإنما هي عبارات قليلة جداً، وعامة جداً. ولعل النظر في أكبر مؤلف اليوم قام بجمع الشهادات غير الإسلامية المبكرة، وهو: Seeing Islam As Others Saw It، يشهد بوضوح لما نقول؛ فالشهادات التي جمعها لا تكاد تدل على غير وجود دين جديد ظهر في بلاد العرب، وأن أصحاب هذا الدين يغزون الأمم المجاورة.
    - الكتابات المذكورة قائمة على السماعات البعيدة والإشاعات، وليس فيها شيء تقريباً من البحث التاريخي والتحقيق العلمي المعتبر، خاصة أنها كتبت بيد رجال عاشوا خارج دولة الإسلام لم يخالطوا المسلمين بصورة مباشرة، ولا يعرفون اللغة العربية.
    - الكتابات المذكورة غير محايدة، إذ عامة كاتبيها خصوم للإسلام، منهم رجال دين نصارى، وأصحاب مصالح سياسية وعرقية يرفضون الفتح الإسلامي برمته.
2. الآثار القديمة المعاصرة للبعثة أو القريبة منها: كانت الحياة وقتئذ قائمة على المساكن البسيطة من خيام وغيرها مما لا يورث الأمم التالية شواهد واسعة من نقوش ومنحوتات تورخ للحضارات وعقائدها، إلا ما ندر في اليمن. فكيف يفلح الجهد الاستشراقي في تعقب تاريخ رجل واحد عاش قبل قيام الدولة مغموراً أو محارَباً، وبعدها في زهد بعيداً عن العمائر والدواوين الإدارية؟!
3. الخيال والوهم التآمري: ذهب بعض المستشرقين إلى رد جميع التراث التاريخي الإسلامي. ص99.&lt;/p&gt;
&lt;h2 id="_2"&gt;صدق النبي صلى الله عليه وسلم&lt;/h2&gt;
&lt;p&gt;إن نفي الصدق عن (محمد) يلزم منه أن يكون هذا الرجل أعظم مفتر ومخادع سعى على الأرض؛ إذ كان يفتعل القرآن عند كل حادثة حتى إنه يأتي بأفعال وحركات شديدة بدعوى الاستجابة لعارض الوحي كما كان يفتعل الإخلاص لإفراد الربٌ بالعبادة والتمجيد وكان يخدع من يلازمه من أصحابه ويفتعل النزاهة في معاملاته ويخدع حتى نساءه في بيته بافتعال الصدق والنزاهة. 
خلاصة البرهان المطلوب من منكر طابع الصدق في شخصية نبي الإسلام هو أن يوضح كيف استطاع رجل ظاهره الحماسة لإفراد الربّ بالطاعة وتنزيه القلوب عن الشرك والزهد في الملاذ والسعي لصلاح معاش الناس ومعادهم - وهو الأمر الذي شهد به من عاشره في الليل والنهار والحل والارتحال والغضب والرضى والسلم والحرب والضيق والفرج - أن يبطن في قلبه عكس ذلك فهو يحب الكذب ويمعن فيه ولا يجد سبيلاً لما يريد إلا به.&lt;/p&gt;
&lt;p&gt;يقول المستشرق المُنَصّر المخاصم للإسلام (ويليام موير): «إن من أعظم معززات صدق محمد أن أوائل المعتنقين للإسلام كانوا أقرب أصدقائه إليه وأهل بيته وهم الذين لهم صلة وثيقة بحياته الخاصة فلا يخفى عليهم ملاحظة تناقض الحال الذي لا يخلو منه - بصورة كبرت أو صغرت - المخادع المنافق عندما يكون في ملأ ويكون في بيته».&lt;/p&gt;
&lt;p&gt;ما الذي يطمع فيه مدعو النبوة غير المجد الدنيوي والتسلط على رقاب الناس والتنعم بخيراتهم؟! فهل في حياة النبي صلى الله عليه وسلم شيء من ذلك؟ انظر إلى حجراته اليوم في المدينة وقارنها بما كان لدى الأكاسرة والقياصرة، واقرأ الأحاديث الصحيحة في زهده التام في مكة وفي المدينة حين القوة ص129-130.&lt;/p&gt;
&lt;p&gt;إنه لا تجتمع في الإنسان أمانة تامة وخديعة ماكرة، وحرص على هداية الخلق وسعي لإضلالهم.. ولذلك فثبوت الكمال الخلقي البشري خاصة خلة الصدق ينقض مخالِفَه ضرورةً.&lt;/p&gt;
&lt;p&gt;إن الناظر في حال نبي الإسلام القائم بالليل متهجدًا بالقرآن، في خشوع وذلَ وإخبات حتّى تشققت منه القدم، لا يسعفه خيال الشكّ السادر أن يرى في روح هذا الرجل الخاشع بعض طيف الخديعة والمكر. إنه يرى روحًا تذوب مع كلمات القرآن، ومعاني التوحيد، وصور القيامة، ومشاهد البعث المهيبة.&lt;/p&gt;
&lt;p&gt;أقوال عن النبي صلى الله عليه وسلم:
لقد بحثت في التاريخ عن الإنسان النموذج ووجدته في محمد. الشاعر الألماني الكبير جوته.
ربما علينا أن نتساءل - إذا أخذنا في الاعتبار كل المعايير التي من الممكن أن تؤخذ في الحسبان لقياس عظمة الإنسان - إن كان هناك أحد أعظم من محمد. الشاعر الفرنسي الكبير Alphonse de Lamartine.&lt;/p&gt;
&lt;h2 id="_3"&gt;معجزات النبي صلى الله عليه وسلم&lt;/h2&gt;
&lt;p&gt;المعجزات مخالفة لتجربة الإنسان مع الطبيعة وليست مناقضة لهذه التجربة، فهي من الممكنات العقلية، وإثبات المعجزة بذلك مسألة تاريخية وليس مسألة فلسفية.&lt;/p&gt;
&lt;p&gt;عن المعجزات: إن كان المخالف لا يصدق غير الأخبار المتواترة فقد ثبت في السيرة معجزات متواترة. والتواتر هو ما رواه جمع غفير عن مثله إلى منتهاه، تحيل العادة تواطؤهم على الكذب، ويكون مستندهم الحس. وهو على نوعين: لفظي وهو ما تواتر لفظه عن الرواة، ومعنوي وهو تواتر معنى مشترك ككرم حاتم الطائي وشجاعة عنترة فهي أمور لا نشك فيها وإن كنا لا نجزم بصحة الأحداث الفردية لكرم حاتم وبطولات عنترة. ومجموع روايات معجزات النبي صلى الله عليه وسلم تصل إلى التواتر المعنوي إذ تمنع العادة أن يتواطأ هذا الجم الغفير من الرواة على الكذب في نقل خوارق نبي الإسلام.
ولا يقتصر خبر معجزات النبي على تواتر جنس الخارقة، وإنما ثبت بالتواتر عدد من المعجزات المخصوصة بعينها، نقلها عدد كبير من الصحابة، وعنهم عدد أكبر من التابعين حتى مؤلفي الدواوين التي صنفت لجمع الحديث النبوي:
- قتل عمار والفئة الباغية: تواتر عن الرسول قوله للصحابيّ «عمّار بن ياسر»: «تقتلك الفئة الباغية». ومعلوم بيقين أن «عمّارًا» قد قتلته طائفة (معاوية) بعد وفاة الرسول، سنة 37هـ، وقد بغت طائفته على الخليفة المبايع زمانه «علي بن أبي طالب».قال (السيوطي): «هذا الحديث متواتر رواه من الصحابة بضعة عشر»؛ فقد رواه (خزيمة بن ثابت) و(أبو سعيد الخدري) و(عمرو بن العاص) وابنه (عبد الله)، و(أم سلمة) و(أبو هريرة) و(معاوية)، و(عمرو بن حزم) و(حذيفة) و(أبو أيوب) و(أبو رافع) و(أبو اليّسَر) و(ابن مسعود).
- انشقاق القمر: ثبت عن جمع من الصحابة وقوع حادثة انشقاق القمر. قال صاحب «نظم المتناثر من الحديث المتواتر»: «قال التاج ابن السبكي في شرحه لمختصر ابن الحاجب الأصلي: الصحيح عندي أن انشقاق القمر متواتر منصوص عليه في القرآن مروي في الصحيحين وغيرهما من طرق من حديث شعبة عن سليمان بن مهران عن إبراهيم عن أبي معمر عن ابن مسعود، ثم قال: وله طرق أخرى شتى بحيث لا يُمترى في تواتره. وقال في الشفا: أمَا انشقاق القمر فالقرآن نص بوقوعه. وأخبر بوجوده. ولا يعدل عن ظاهر إلا بدليل، وجاء برفع احتماله صحيح الأخبار من طرق كثيرة. وفي «أمالي» الحافظ (ابن حجر): أجمع المفسرون وأهل السير على وقوعه. قال: ورواه من الصحابة: عليّ وابن مسعود وحذيفة وجبير بن مطعم وابن عمر وابن عباس وأنس. وقال (القرطبي) في «المفهم»: رواه العدد الكثير من الصحابة ونقله عنهم الجم الغفير من التابعين فمن بعدهم. وفي المواهب اللدنية: جاءت أحاديث الانشقاق في روايات صحيحة عن جماعة من الصحابة منهم: أنس وابن مسعود وابن عباس وعليّ وحذيفة وجبير بن مطعم وابن عمر.
- حنين الجذع: حادثة رواها جم غفير من الصحابة. قال صاحب «نظم المتناثر من الحديث المتواتر»: «أورده في الأزهار من حديث: سهل بن سعد وجابر بن عبد الله وابن عمر وأبي بن كعب وبريدة وابن عباس وأبي سعيد الخدري وأنس وأم سلمة والمطلب بن أبي وداعة السمهي، عشرة أنفس. قلت: قال عياض في الشفا: أمره مشهور منتشر والخبر به متواتر؛ أخرجه أهل الصحيح، ورواه من الصحابة بضعة عشر، ثم ذكر منهم العشرة المذكورين. وقال الحافظ ابن حجر في «أماليه»: طرقه كثيرة. قال البيهقي: أمره ظاهر؛ نقله الخلف عن السلف، وإيراد الأحاديث فيه؛ كالتكلف؛ يعني: لشدة شهرته.&lt;/p&gt;
&lt;h2 id="_4"&gt;القرآن كتاب يأبى التفسير المادي&lt;/h2&gt;
&lt;p&gt;قد يقول المخالف: . . نعم. . قد تحدّى القرآن المخالفين؛ واستفز نفوسهم للرد. . لكن ليس في ذلك برهان لإعجازه؛ إذ قد اجتمعت له من الأسباب التاريخيّة ما جعله كتابًا فريدًا فرادة سونيتات (شكسبير). ولكل عصر مؤلفاته الأدبيّة النادرة التي من الممكن تفسير تميّزها بخدمة الأوضاع الثقافية والاجتماعيّة لشخصيّة كُتابِها بصقل مواهبهم وتنمية ملكات الإبداع الفكري في نفوسهم. . كل شيء قابل للتفسير المادي، حتى ما يُدّعى من إعجاز القرآن!
ونقول: .. بل كان القرآن في جميع أمره مخالفاً لفرادة سونيتات (شكسبير)؛ فقد تحدّى العرب أهل الفصاحة والذلاقة أن يأتوا بمثله رغم أنّ كلّ ما احتف به من تفاصيل وسياقات تاريخيّة تمنع أن يبلغ الحدّ المتوسّط من البلاغة، فضلًا عن أن يبلغ أعلى درجاتها البشريّة، فهو كتاب يأبى التفسير المادي لأمور:
- القرآن كتاب أظهره للناس رجل أمئّ لم يجلس ليتعلّم القراءة أو الكتابة، ولا تلقّى دروسًا في صناعة الأفكار وتحبيرها، وتأصيل الدرس اللاهوتي وترتيبه. وأمًا (شكسبير) مثلاً فقد دخل المدارس وتعلّم اليونانيّة واللاتينية. وكانت الكتب متوافرة أمامه يأخذ منها ويذر، كما التقى المدرّسين المبرّزين وأخذ عنهم، وتصفّح الكتب الوفيرة واغترف منها. 
- نبي الإسلام لم يتعلّم الشعر، ولم ينظمه، ولم يشتهر به. ومعرفة الشعر وإتقانه مقدمةٌ ضرورية لدخول عالم الأدب، ولذلك جاءت الآيات في نفي معرفة الشعر عن النبيّ قاطعة للريبة ونافية للتهمة في محضر الصديق والخصم الذين عرفوا تفصيل حياته ومدارج عمره: { وما علمناه الشعر وما ينبغي له إن هو إلا ذكر وقرآن مبين }.
- سونيتات (شكسبير) مثلاً لم تبلغ من الجمال مبلغًا واحدّا، وإنّما البراعة فيها تتفاوت، فمرّة تعلو، وفي أخرى تسفل دون ذلك. وأمَا القرآن، فقطعة واحدة من البيان المعجب. يقول الإمام (حازم القرطاجني) عن القرآن: «إِنَّ الإعجاز فيه من حيث استمرّت الفصاحة والبلاغة فيه من جميع أنحائها في جميعه استمرارًا لا توجد له فترة ولا يقدر عليه أحد من البشر&amp;hellip;».
- قال بلغاء مكّة لنبي الإسلام: إن هذا الكتاب من بنات أفكارك فتحدّاهم صراحة أن يأتوا بمثله، وأشهر هذا التحدي في كل مكان بلغه صوته. قال تعالى: { أم يقولون تقوله بل لا يؤمنون. فليأتوا بحديث مثله إن كانوا صادقين }.
- لم يزعم أحد لسونيتات (شكسبير) مثلاً صفة فوق طبيعية، فهي عند محبّى أدبه أثر عن ذكاء عقل ورهافة حس. وأمّا القرآن فقد وصفه خصوم نبي الإسلام وشانئيه أنه من جنس السحر، والسحر ليس من كسب العقول وإنّما هو عندهم - فيض من فعل كائنات خارقة هي الجنّ. ولمًا أراد واحد من زعامات الكفر أن يقول فى القرآن ما يكشف أصله، ويفضح سرّه، اجتهد كل الاجتهاد، ثم نفى بشريّته وقال بسحريّته، قال تعالى: { إنه فكر وقدر. &amp;hellip; إن هذا إلا قول البشر }.
- القرآن نظمٌ على طريق جديد يخالف معهود الشعر والنثر: من المعلوم أن أعسر أبواب الإبهار الأدبي أن تجعل الجديد الطريف مقبولًا مألوفًا.&lt;br&gt;
- العصر الذهبي للبيان العربي: نزل القرآن في عصر وبيئة كان الشعر فيها يخفض أقدار الرجال ويرفع، أمّة تميّزرت عن غيرها بظاهرة «شعر النقائض»: نزل القرآن في أمّة من الناس مولعة بالمعارضات الشعريّة لأشهر القصائد. وكان التحدّي القرآني بذلك يجري في مضمار تلك الظاهرة المألوفة في سوق الأدباء. ومعلومٌ  عامةً أن صنائع الأدب في كلّ أمّة أنه إذا استحسنت اتبعت؛ وإذا استُملحت قصدت، فكيف والعرب في القرن السابع قد اتخذوا المعارضات الشعريّة سُنة أدبية؟!
- كيف يكون هذا القرآن من نتاج صحراء القرن السابع ميلاديًا النائية، وهو مع ذلك يفيض خيرًا على البشريّة في مجالات التشريع إلى اليوم، ويأخذ بألباب كبار القانونيين الغربيين حتى القرن الواحد والعشرين رغم أنهم لم يلجوا أعماقه الدفينة بعد؟! نقولات عن قانونيين يصفون عظمة تشريع الإسلام ص450-451.&lt;/p&gt;
&lt;h2 id="_5"&gt;معارضة القرآن&lt;/h2&gt;
&lt;p&gt;نقل القرآن اعتراضات المشركين، وكرّر خبر كبيرها وصغيرها. ولو كان في المعارضات ما هو أهل لفخر أهل مكّة لشاع خبر الاستشهاد به، ولألزم القرآن أن يرد عليه، لا أن يكرّر القرآن عرض التحدّي ونقل عجز بلغاء المشركين دون نكير من المخالفين. ولذلك قال المستشرق (إدوارد هنري بلمر): «مسألة عدم نجاح أفضل الكتّاب العرب في إنتاج أي شيء قريب في الخصاصة من القرآن نفسه ليس شيئًا مفاجئًا».&lt;/p&gt;
&lt;p&gt;ولا يصحّ تاريخيًا فى المعارضة إلا القليل النادر. وقد عاش فى بلاد المسلمين خصوم حاقدين اجتهدوا في الطعن في نبوة (محمد) صلى الله عليه وسلم، ولم يستعلن منهم واحد بكتاب معارض للقرآن رضي عنه مخالفو الإسلام في عصره وبعده، ومن هؤلاء (ابن الراوندي) الذي ألّف «الفريد» فى الطعن فى نبوّة (محمّد) صلى الله عليه وسلم والقدح في معجزاته، و«التاج» في قدم العالم، و«الزمرّد» في إبطال النبوّات، وهي كتب نشرها في العلن، وراجت بين الناس. الفرصة إذن كانت قائمة لظهور الكتاب المعارض المتحدّي للقرآن، ولرواجه إذا بدا فيه ما يستحقّ التقديم والتبجيل.&lt;/p&gt;
&lt;p&gt;صوّر القاضي (عبد الجبار) - الذي عاش في النصف الثاني من القرن الرابع الهجري وبداية الخامس انتشار كتب الزنادقة الطاعنين في الإسلام بقوله: «وانظر إلى&amp;hellip; الكتب التي وضعها الملحدة وطبقات الزنادقة، كالحدّاد، وأبي عيسى الورّاق، وابن الراوندي، والحصري، وآمالهم في الطعن في الربوبيّة وشتم الأنبياء صلوات الله عليهم وتكذيبهم، فإنّهم وضعوها في أيام بني العباس وفي وسط الإسلام وسلطانه والمسلمون أكثر مما كانوا إذ ذاك وأشدّ ما كانوا ولهم القهر والغلبة والعز، والذين وضعوا هذه الكتب أذلَ ما كانوا، وإنّما كان الواحد بعد الواحد من هؤلاء يضع كتابه خفيًا وهو خائف يترقب، ويخفي ذلك عن أهله وولده، ولا يطلع عليه إلا الواحد بعد الواحد ممن هو في مثل حاله في الخوف والذل والقهر، ثم ينتشر ذلك في أدنى مدة ويظهر حتى يباع في أسواق المسلمين، ويعرفه خاصتهم وعامتهم، ويتحدثون به ويتقولونه ويذكرونه وقد غمّهم ذلك وساءهم، وودّوا أن ذلك لم يكن». [عبد الجبار، تثبيت دلائل النبوة].‏&lt;/p&gt;
&lt;p&gt;ولا يذكر الناس في أيّامنا من محاولات خصوم الإسلام والمنصّرين غير الكتاب الذي أراد له أصحابه إعلان كسر الإعجاز القرآني في الشرق والغرب، والمسمّى «الفرقان الحقّ» الذي قام على الترويج له المنصّر [الفلسطيني - الأمريكي] (أنيس شروش). ثم ماذا كان من أمر هذا التحدّي الذي حشدت له الأقلام للمعارضة، والمطابع والصحافة للإذاعة والإشهار؟ لا شيء غير الفضيحة.&lt;/p&gt;
&lt;h2 id="_6"&gt;إعجاز بلاغة القرآن&lt;/h2&gt;
&lt;p&gt;ولما سمع (جبير بن مطعم) رضي الله عنه النبي صلى الله عليه وسلم يقرأ في المغرب بالطور، قال عند قوله تعالى : {أَمۡ خُلِقُوا۟ مِنۡ غَیۡرِ شَیۡءٍ أَمۡ هُمُ ٱلۡخَـٰلِقُونَ. أَمۡ خَلَقُوا۟ ٱلسَّمَـٰوَ ٰ⁠تِ وَٱلۡأَرۡضَ بَل لَّا یُوقِنُونَ. أَمۡ عِندَهُمۡ خَزَاۤىِٕنُ رَبِّكَ أَمۡ هُمُ ٱلۡمُصَۣیۡطِرُونَ}: كاد قلبي أن يطير [رواه البخاري].  ويكفي في شهادة العرب الجاهليين لإعجاز القرآن قول (الوليد بن مغيرة) المشرك بعد أن سمع القرآن من فِيّ رسول الله صلى الله عليه وسلم وقد استحثه (أبو جهل) أن يقول فيه قولًَا منكرًا: «وَمَاذًا أَقُولُ؟ فوالله مَا فيكم رَجُلٌ أَعْلَمَ بِالأَشْعَار مِنّي، ولا أَعْلَم بِرَجَزه ولا بِقَصِيدَتِهِ مِنّي، ولا بِأَشْعَار الْجِن، وَالله مَا يُشْبِه الذي يَقُولُ شيئًا من هذا، ووالله، إن لقوله الذي يقول حلاوة، وإن عليه لطلاوة وإنه لمثمر أعلاه، مغدق أسفله، وإنه ليعلو وما يُعلا، وأنه ليحطم ما تحته» [رواه الحاكم. وقال: هذا حديث صحيح الإسناد على شرط البخاري ولم يخرجاه].&lt;/p&gt;
&lt;p&gt;من الشهادات في هذا الباب قول الشيخ (رشيد رضا): «إنّ من أوتي حظًا من بيان هذه اللغة، وفاز بسهم رابح من آدابها حتى استحكمت له ملكة الذوق فيها، لا يملك أن يدفع عن نفسه عقيدة إعجاز القرآن ببلاغته وفصاحته، وبأسلوبه في نظم عبارته. وقد صرّح بهذا من أدباء النصرانيّة المتأخّرين الأستاذ (جبر ضومط) مدرّس علوم البلاغة بالجامعة الأمريكانيّة في كتابه «الخواطر الحسان». وعقّب (الرافعي) على شهادة (رشيد رضا) بقوله: «وصرّح لنا بذلك (بإعجاز القرآن) أديب هذه الملة (النصارى) الشيخ إبراهيم اليازجي الشهير. وهو أبلغ كاتب أخرجته المسيحية. وقد أشار إلى رأيه ذاك في مقدمة كتابه «نجعة الرائد». وكذلك سألنا شاعر التاريخ المسيحي الأستاذ خليل مطران، ولا نعرف من شعراء القوم من يجاريه فأقر لنا بمثل ما أقر به أستاذه اليازجي، والأمر بعد إلى العقل المنصف والعقل «المنصف» ليس له دين إلا الحق،  والحق واحد لا يتغير». من كتاب إعجاز القرآن للرافعي.&lt;/p&gt;
&lt;p&gt;أمّا الأديب الشاعر المعاصر (نقولا حنا) فقد قاده إيمانه بإعجاز القرآن إلى اعتناق الإسلام، والكتابة في تمجيد هذا الكتاب العظيم بقوله في قصيدته «من وحي القرآن»: «قرأت القرآن فأذهلني، وتعمقت به ففتنني، ثم أعدت القراءة فآمنت.. آمنت بالقرآن الإلهي العظيم، وبالرسول من حمله.. النبي العربي الكريم، أما الله فمن نصرانيتي ورثت إيماني به، وبالفرقان عظم هذا الإيمان&amp;hellip; وكيف لا أؤمن ومعجزة القرآن بين يدي أنظرها وأحسها كل حين &amp;hellip; هي معجزة لا كبقية المعجزات.. معجزة إلهية خالدة تدل بنفسها عن نفسها، وليست بحاجة لمن يحدث عنها أو يبشّر بها. [نقل ذلك حسن ضياء الدين عتر في كتاب المعجزة الخالدة عن كتاب من وحي القرآن لنقولا حنا]&lt;/p&gt;
&lt;p&gt;كما أقرّ بإعجاز القرآن المستشرق (جوزيف شارل ماردروس) في مقدّمة ترجمته لاثنتين وستين من السور الطوال في القرآن بتكليف من وزارة الخارجية والمعارف الفرنسيّة. فقد كتب: «أمّا أسلوب القرآن فهو الأسلوب الخاص بالله. وبما أن الأسلوب يمثّل جوهر الكائن الذي صدر عنه هذا الأسلوب، فلا يمكن أن يكون هذا الأسلوب إلا إلهيًا . والحق الواقع هو أن أكثر الكتاب شكًا وارتيابًا قد خضعوا لسلطان تأثيره&amp;hellip; [نقل ذلك وترجمه رشيد رضا في كتاب الوحي المحمدي عن كتاب جوزيف Le Koran qui est la Guidance et le Diffeirenciateur]&lt;/p&gt;
&lt;p&gt;وأمّا (فارس الشدياق) (وهو من أبرز علماء العربية النصارى في القرون الأخيرة حتّى وصفه المستشرق (كرنليوس فاندايك) - صاحب أشهر ترجمة عربيّة للكتاب المقدّس المعروفة باسم (ترجمة الفاندايك) ‏- بأنّه: «الأديب الشاعر اللغوي الكاتب البليغ . . ولغته من أحسن ما كتبه المتأخرون نثرًا في اللغة العربية في عصر النهضة الاخيرة» فقد كتب - بعد إسلامه - غاضبًا من جرأة كاتب نصرانى اسمه (رزق الله) أراد معارضة القرآن لنفى إعجازه اللغوي، فقال: «إِنَ هذا السفيه قد أشعر إشعارًا ظاهرًا بأنه قادر على تحدّي القرآن، وهو أعجب شيء من جنونه وهوسه. . . وقد حان الآن أن نظهر جهله باللغة والصرف والنحو وغير ذلك ليعلم فيما قصده من تحدي القرآن أنه مجنون جنونًا مطبقًا». علمًا بأنّ (فارس الشدياق) قد كُلف بإعداد ترجمة عربيّة للكتاب المقدّس النصراني قبل إسلامه، وقد أتمّها ونشرها، غير أن النصارى منعوا تداولها بعد هدايته.&lt;/p&gt;
&lt;p&gt;وقد أسلم طائفة من كبراء اليهود إعجابًا بدين الإسلام وعقيدة التوحيد. ومن هؤلاء أسماء كبيرة، لعل أهمها (هبة الله بن علي بن ملكا البغدادي) الملقب ب«أوحد الزمان» الفيلسوف البارز والطبيب الشهير.  ومن أبرز أذكياء اليهود الذين أسلموا (السموأل بن يحيى المغربي) العالم بالتوراة والهندسة والرياضيات والفلك والطب والتاريخ‎٠‏ وقد كان والده حبرًا يهوديًا مغرييًا وشاعرًا كبيرًا عدّه (يهوذا الحريزي) أحد أكبر شعراء الأندلس. كتب (السموأل) عن سبب إسلامه في كتابه «بذل المجهود في إفحام اليهود» - الكتاب الذي أثار حفيظة معاصره وأكبر فلاسفة اليهود في القرون الوسطى (موسى بن ميمون) -: ‎«فإني كنت لكثرة شغفي بأخبار الوزراء والكتّاب قد اكتسبت بكثرة مطالعاتي لحكاياتهم وأخبارهم وكلامهم قوّة في البلاغة، ومعرفة بالفصاحة، وكان لي في ذلك ما حمده الفصحاء، وتعجب به البلغاء. .. فشاهدت المعجزة التى لا تباريها الفصاحة الآدميّة فى القرآن، فعلمت صحّة إعجازه».&lt;/p&gt;
&lt;h2 id="_7"&gt;نبوءات قرآنية&lt;/h2&gt;
&lt;h3 id="_8"&gt;غلبت الروم&lt;/h3&gt;
&lt;p&gt;{الم (١) غلبت ٱلروم (٢) فی أدنى ٱلأرض وهم من بعد غلبهم سیغلبون (٣) فی بضع سنین لله ٱلأمر من قبل ومن بعد ویومىٕذ یفرح ٱلمؤمنون (٤) بنصر ٱلله ینصر من یشاء وهو ٱلعزیز ٱلرحیم (٥) وعد ٱلله لا یخلف ٱلله وعدهۥ ولـٰكن أكثر ٱلناس لا یعلمون}: جاءت الآيات في صدر سورة الروم تخبر بمجموعة من البشارات: 
1. انتصار الروم على الفرس. 
2. حصول هذا النصر قبل مضي عشر سنوات من إطلاق النبوءة، إذ إن «بضع» في لغة العرب عددٌ بين ثلاثة وتسعة. 
3. المسلمون سيشهدون هذا النصر مما يعني: أنه لن يتم القضاء عليهم في تلك الفترة رغم أنّهم في حال ضعف وحصار شديدين. 
4. المسلمون سيفرحون عند نصر الروم. وقد وافق ذلك معركة بدر أو صلح الحديبية.
تحققت كل البشارات السابقة. وصدقت الآية . وقد علق المؤرخ الشهير «إدوارد جيبون» صاحب كتاب «تاريخ انحدار الإمبراطورية الرومانية وسقوطها» على هذه النبوءة القرانية العجيبة بقوله: «في الزمن الذي قيل فيه إن هذه النبوءة قد أطلقت، ما كان لنبوءة أن تكون أبعد منها عن أن تتحقق، إذ إن السنوات الاثني عشر الأولى لهيراكليوس قد أعلنت دنوّ انحلال الإمبراطورية.&lt;/p&gt;
&lt;p&gt;تنبيه: شكك بعض المستشرقين في الإعجاز الغيبي في مفتتح سورة الروم بدعوى وجود قراءة بفتح الغين لا ضمها، وأنها هي القراءة الأصلية. والحق أن قراءة &amp;ldquo;غَلبت&amp;rdquo; لا تصح لأسباب:
1. قراءة &amp;ldquo;غُلِبَت&amp;rdquo; متواترة، ولا تنهض أحاديث الآحاد لتعارض المتواتر. 
2. قراءة: &amp;ldquo;غَلَبَت&amp;rdquo; لا تصح عن (ابن عمر) و(أبي سعيد الخدري) رضي الله عنهما: 
    1. الرواية عن (ابن عمر) لا تصح، ففي الإسناد عنه (سفيان بن وكيع)، وحديثه ضعيف، فقد اتهمه (ابن أبي حاتم) بالوضع، وقال فيه (ابن حجر): &amp;ldquo;ليس بشيء&amp;rdquo;. وفي الحديث أيضًا (الحسن الجُفري)، وهو (ابن أبي جعفر عجلان الجفري)، وهو ضعيف. ضعفه (أحمد)، وقال فيه (النسائي): &amp;ldquo;متروك الحديث&amp;rdquo;.&lt;br&gt;
    2. روى (الترمذي) في جامعه عن &amp;ldquo;عطية عن أبي سعيد، قال: لما كان يوم بدر ظهرت الروم على فارس، فأعجب ذلك المؤمنين، فنزلت: &amp;ldquo;الم غلبت الروم&amp;rdquo; إلى قوله: &amp;ldquo;يفرح المؤمنون&amp;rdquo;. قال: ففرح المؤمنون بظهور الروم على فارس.&amp;rdquo; وهي رواية ضعيفة، فمدارها عند (الترمذي) وغيره على &amp;ldquo;عطيّة العوفي&amp;rdquo;. قال (المباركفوري): &amp;ldquo;وفي عطية ثلاثة أشياء: الأوّل أنه مدلس والثاني أنه عند أكثر الأئمة ضعيف، والثالث أنه كان يأخذ التفسير عن الكلبي ويكنّيه بأبي سعيد، فيقول عن أبي سعيد يوهم أنه أبو سعيد الخدري رضي الله عنه&amp;rdquo; 
4. قراءة &amp;ldquo;غَلبت&amp;hellip; سيغلبون&amp;rdquo; لا تستقيم في سياق آيات سورة الروم. قال (الطبري): &amp;rdquo; وَأمًّا قَوْلَهُ: &amp;ldquo;سيغلِبُون&amp;rdquo;، فَإِنَ الْقرَاءَ أَجْمَعِينَ عَلَى فَتْح الْيَاء فِيهَا، وَالْوَاجِبُ عَلَى قِرَاءَة مَنْ قَرَأ: &amp;ldquo;الم غَلبت الروم&amp;rdquo; بفتح الغين أن يقرأ قوْلَه: &amp;ldquo;سَيُغلَبُون&amp;rdquo; بضم الْيَاء، فَيَكُون معناه: وَهُمْ من بَعْد غَلَبتهم فارس سيغلبهم المسلمون، حَتَّى يَصِح معنى الْكَلام وَإِلا لم يَكُنْ لِلكلام كثير مَعنى إن فُتِحَت الْيَاء لأن الْخَبَرَ عَمَا قَد كَانَ يَصِيرُ إلى الْخَبَرِ عَنْ أَنَّهُ سَيَكُونُ، وَذَلِكَ إِفسادُ أَحَد الْخَبَرَيْنِ بِالْآخَر&amp;rdquo; 
5. قال (ابن الجوزي) في سورة (الروم): &amp;ldquo;وهي مكيّة كلّها بإجماعهم&amp;rdquo;، بما يمنع أن تكون الآيات قد نزلت عند معركة بدر في العصر المدنيّ.&lt;/p&gt;
&lt;h3 id="_9"&gt;رؤيا دخول المسجد الحرام&lt;/h3&gt;
&lt;p&gt;{ لَّقَدْ صَدَقَ ٱللَّهُ رَسُولَهُ ٱلرُّءْيَا بِٱلْحَقِّ ۖ لَتَدْخُلُنَّ ٱلْمَسْجِدَ ٱلْحَرَامَ إِن شَآءَ ٱللَّهُ ءَامِنِينَ مُحَلِّقِينَ رُءُوسَكُمْ وَمُقَصِّرِينَ لَا تَخَافُونَ ۖ فَعَلِمَ مَا لَمْ تَعْلَمُوا۟ فَجَعَلَ مِن دُونِ ذَٰلِكَ فَتْحًۭا قَرِيبًا }
كان رسول الله قد رأى في منامه أنه دخل مكة هو وأصحابه وطافوا بالبيت، ثم حلّق بعضهم وقَصَّرَ بعضهم‎.‏ فحدّث بها أصحابه ففرحوا واستبشروا. فلما خرج إلى الحديبية مع الصحابة، منع المشركون المسلمين دخول مكة، ووقع ما وقع من قضية الصلح. وعندها وقع في نفس بعض الصحابة من ذلك شيء، حتى سأل (عمر بن الخطاب) رسول الله في ذلك، فقال له فيما قال: «أفلم تكن تخبرنا أنا سنأتي البيت ونطوف به؟» قال صلى الله عليه وسلم: «بلى، أفأخبرتك أنك تأتيه عامك هذا؟» قال: «لا». قال النبي: «فإنك آتيه ومطوف به». وبهذا أجاب الصدّيق عنه أيضًا. وقد تحققت الرؤيا - ورؤيا الأنبياء حق - بدخولهم معتمرين العام التالي بعد صلح الحديبية.  قال (ابن كثير): «وقوله تعالى : {فَعَلِمَ مَا لَمْ تَعْلَمُوا۟ فَجَعَلَ مِن دُونِ ذَٰلِكَ فَتْحًۭا قَرِيبًا} أي: فعلم الله من الخيرة والمصلحة في صرفكم عن مكة ودخولكم إليها عامكم ذلك ما لم تعلموا أنتم {فَجَعَلَ مِن دُونِ ذَٰلِكَ} أي: قبل دخولكم الذي وعدتم به في رؤيا النبي {فَتْحًۭا قَرِيبًا} وهو الصلح الذي كان بينكم وبين أعدائكم من المشركين.          &lt;/p&gt;
&lt;h3 id="_10"&gt;عاقبة أبي لهب&lt;/h3&gt;
&lt;p&gt;{تَبَّتۡ يَدَآ أَبِي لَهَبٖ وَتَبَّ (1) مَآ أَغۡنَىٰ عَنۡهُ مَالُهُۥ وَمَا كَسَبَ (2) سَيَصۡلَىٰ نَارٗا ذَاتَ لَهَبٖ (3) وَٱمۡرَأَتُهُۥ حَمَّالَةَ ٱلۡحَطَبِ (4) فِي جِيدِهَا حَبۡلٞ مِّن مَّسَدِۭ (5)}
تخبر السورة عن مآل (أبي لهب) وزوجه، وأنهما لن يؤمنا بالإسلام، وسيموتان على الكفر. وقد أسلم كل أهل مكة إلا قله منها (أبو لهب) وزوجه.&lt;/p&gt;
&lt;h3 id="_11"&gt;حفظ الله لرسوله&lt;/h3&gt;
&lt;p&gt;{ يا أيها الرسول بلغ ما أنزل إليك من ربك وإن لم تفعل فما بلغت رسالته والله يعصمك من الناس إن الله لا يهدي القوم الكافرين }
{ فَٱصْدَعْ بِمَا تُؤْمَرُ وَأَعْرِضْ عَنِ ٱلْمُشْرِكِينَ. إِنَّا كَفَيْنَـٰكَ ٱلْمُسْتَهْزِءِينَ }
{ فكيدوني جميعا ثم لا تنظرون }
تُخبر الآيات السابقة أن الله سبحانه سيعصم رسوله من القتل حتّى يبلّغ ما أنزل إليه من ربّه. وقد كان الرسول يتّخذ الحراس قبل نزول الآية، ولما نزلت صرف حراسه وسرحهم قائلا: «يا أيها الناس انصرفوا فقد عصمني الله» : وقد عصمه الله في مواطن كثيرة جدَّا. وما توفي حتى أتم البلاغ الذي وُعد بأدائه كاملًا، ونزل قوله تعالى: { ٱلْيَوْمَ أَكْمَلْتُ لَكُمْ دِينَكُمْ وَأَتْمَمْتُ عَلَيْكُمْ نِعْمَتِى وَرَضِيتُ لَكُمُ ٱلْإِسْلَـٰمَ دِينًا}.&lt;/p&gt;
&lt;h2 id="_12"&gt;الإعجاز التاريخي في القرآن&lt;/h2&gt;
&lt;h3 id="_13"&gt;تسمية حاكم مصر: &amp;ldquo;ملك&amp;rdquo; أو &amp;ldquo;فرعون&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;إن القرآن الكريم أراد أن يفرق بين حاكم مصر الأجنبي على أيام (يوسف) الصديق في عهد الهكسوس، فأطلق عليه لقب (ملك)، وبين حاكم مصر الوطني على أيام (موسى) - مثلًا - الذي أطلق عليه لقب (فرعون) وهو اللقب الذي كان يطلق على ملوك مصر منذ عهد (أخناتون)، هذا فضلًا عن أن ذلك من إعجاز القرآن الذي لا إعجاز بعده، وإذا ما عدنا إلى التوراة، لوجدنا أن الحقائق التاريخية تقف ضد ما أوردته التوراة بشأن استعمال لقب فرعون، إذ إنها تستعمله حين يجب أن تستعمل لقب ملك، وذلك قبل الأسرة الثامنة عشرة، وتستعمل لقب ملك حين يجب أن تستعمل لقب فرعون، وذلك منذ عهد الأسرة الثامنة عشرة وفيما ‏بعدها. [دراسات تاريخية في القرآن الكريم لمحمد بيومي مهران]
لم يُعرف ملك مصر بلقب فرعون إلا منذ حكم أمينوفيس الرابع، أي: في الربع الثاني من القرن الرابع عشر قبل المسيح. كل استعمال لكلمة فرعون للدلالة على ملك مصر قبل هذا العصر هو خطأ تاريخي: ارتكب محررو الكتاب المقدس هذا الخطأ لما كانوا يستعملون لغة زمانهم عند تأليفهم للكتاب المقدس. فى المقابل، فإن استعمال هذه الكلمة للأحداث الأقرب لنا كزمن موسى، هي مطابقة للمعطيات التاريخية. إنه علي أن أعلن أنه في زمن تبليغ القرآن إلى الناس، كانت اللغة المصرية القديمة قد اختفت منذ أكثر من قرنين من الذاكرة البشرية، وبقيت كذلك إلى القرن التاسع عشر، لذلك فليس بإمكاننا أن نعرف أن ملك مصر في زمن يوسف يجب أن يُدعى بلقب غير المذكور في الكتاب المقدس. دقة اختيار الكلمات في هذا الموضوع في نص القرآن تثير التفكير. [Moise et pharaon: les Heibreux en Egypte: quelles concordances des livres saints avec l&amp;rsquo;his-toire? by Maurice Bucaille] &lt;/p&gt;
&lt;h3 id="_14"&gt;وسائل التعذيب في زمن فرعون&lt;/h3&gt;
&lt;p&gt;{ فَأُلْقِىَ ٱلسَّحَرَةُ سُجَّدًۭا قَالُوٓا۟ ءَامَنَّا بِرَبِّ هَـٰرُونَ وَمُوسَىٰ. قَالَ ءَامَنتُمْ لَهُۥ قَبْلَ أَنْ ءَاذَنَ لَكُمْ ۖ إِنَّهُۥ لَكَبِيرُكُمُ ٱلَّذِى عَلَّمَكُمُ ٱلسِّحْرَ ۖ فَلَأُقَطِّعَنَّ أَيْدِيَكُمْ وَأَرْجُلَكُم مِّنْ خِلَـٰفٍۢ وَلَأُصَلِّبَنَّكُمْ فِى جُذُوعِ ٱلنَّخْلِ وَلَتَعْلَمُنَّ أَيُّنَآ أَشَدُّ عَذَابًۭا وَأَبْقَىٰ }
ذكر القرآن الكريم هاهنا وسائل التعذيب في زمن فرعون، وقد نشر الدكتور (أحمد عبد الحميد يوسف) نصًا ورد فى معبد عمدا من بلاد النوبة المصرية يصوّر وسائل التعذيب في زمان فرعون، وهو يرجع إلى السنة الرابعة من عهد (مرنبتاح) (حوالي سنة ‎1220‏ ق.م)، وهو يؤكّد أنَ (مرنبتاح) قد عذب الناس بقطع من خلاف وصلب. [نقله محمد بيومي مهران في دراسات تاريخية في القرآن الكريم]. والسؤال الذي نواجه به المنصّرين هو: لِمَ يورد القرآن هذه الواقعة ويعقبها بذكر حقيقة تاريخية ما كان يعلمها الناس في القرن السابع الميلادي ولم ترد فى التوراة إلا أن تكون وحيًا من الحقّ سبحانه؟&lt;/p&gt;
&lt;h2 id="_15"&gt;إخبار القرآن بحقائق علمية لم تُثبت إلا بعد زمن طويل&lt;/h2&gt;
&lt;p&gt;{ أولم ير الذين كفروا أن السماوات والأرض كانتا رتقاً ففتقناهما } قال (ابن كثير): «كان الجميع متصلًا بعضه ببعض، متلاصق متراكم بعضه فوق بعض في ابتداء الأمر، ففتق هذه عن هذه‏ فجعل السموات سبعًا، والأرض سبعًا». وقد صحّ تفسير الآية بفصل السماء عن الأرض عن التابعي الجليل المفسر (قتادة السدوسي)، والتابعي الجليل (الحسن البصري). [تفسير الطبري]  &lt;/p&gt;
&lt;p&gt;وصف القرآن الكريم الجبال أنّها مثل الوتد، والوتد قطعة من الخشب أو الحديد تغرز في الأرض لتشدّ نفسها، ويكون جزؤها الأكبر مخفيًا تحت الأرض. فالوتد فى (لسان العرب) هو: «ما رُز فى الحائط أو الأرض من الخشب والجمع أوتاد». ‏يشهد العلم الحديث اليوم على دقة هذا الوصف العجيب للجبال، والذي لم يُعرف إلا في الزمن المتأخر بعد دراسات جادة من العلماء المتخصصين، حتى قال الجيولوجي (سيمون لامب): «كان اكتشاف أن للسلاسل الجبليّة جذورًا عميقة [في الأرض] واحدًا من أكبر الاكتشافات الجيولوجيّة في القرن التاسع عشر وبداية العشرين» [Robert Dinwiddie; Simon Lamb and Ross Reynolds, Violent Earth].&lt;/p&gt;
&lt;p&gt;هيمن الاعتقاد بأن دم الحيض أساسي في تكوين الجنين على الطب اليهودي والنصراني واليوناني والهندوسي، وكان الاتفاق بينهم حاصلًا على ذلك. ومن العجيب أنَ الفهم اليهودي‏ النصراني ‏ الأرسطي قد بقي مهيمنًا على الساحة العلميّة حتى قرون بعد البعثة في بلاد المسلمين، حتى قال الإمام (ابن حجر): «وزعم كثير من أهل التشريح أن مني الرجل لا أثر له في الولد إلا في عقده، وأنّه إنّما يتكون من دم الحيض، وأحاديث الباب تبطل ذلك».&lt;/p&gt;
&lt;h2 id="_16"&gt;نبوءات نبوية&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;الإخبار عن استشهاد (عمر) و(عثمان): حدّث (أنس) «أن النبي صلى الله عليه وسلم صعد أحدًا وأبو بكر وعمر وعثمان، فرجف بهم، فقال: «اثبت أحد فإنما عليك نبي وصديق وشهيدان». [رواه البخاري]&lt;/li&gt;
&lt;li&gt;الإخبار أن الرسول سيموت في مرضه الأخير، وأنَ ابنته أوّل من يموت من أهله بعده: روت (عائشة) أن النبي دعا «فاطمة ابنته في شكواه الذي قبض فيه، فسارّها بشيء، فبكت، ثم دعاها فسارّها‎،‏ فضحكت. قالت: فسألتها عن ذلك. فقالت: سارّني النبي صلى الله عليه وسلم فأخبرني أنه يقبض في وجعه الذي توفي فيه، فبكيت. ثم سارني فأخبرني أنّي أوّل أهل بيته أتبعه فضحكت». [رواه البخاري ومسلم]&lt;/li&gt;
&lt;li&gt;الإخبار عن قتل قادة المعركة على الترتيب، وعن آخر من يحمل الراية: عن (أنس) أن النبي صلى الله عليه وسلم نعى (زيدًا) و(جعفرًا) و(ابن رواحة) للناس قبل أن يأتيه خبرهم، فقال : «أخذ الراية (زيد)، فأصيب، ثم أخذ (جعفر)، فأصيب، ثم أخذ (ابن رواحة)، فأصيب وعيناه تذرفان حتى أخذ الراية سيف من سيوف الله حتى فتح الله عليهم». [رواه البخاري]&lt;/li&gt;
&lt;li&gt;الإخبار الدقيق عن الأماكن التي يُقتل فيها الكفّار عند معركة بدر: قال (أنس): «قال رسول الله صلى الله عليه وسلم: هذا مصرع فلان. قال: ويضع يده على الأرض، هاهنا هاهنا قال: فما ماط أحدهم عن موضع يد رسول الله صلى الله عليه وسلم». [رواه مسلم] &lt;/li&gt;
&lt;li&gt;‏الإخبار عن سوء خاتمة مقاتل في صفّه: روى (سهل بن سعد الساعدي) أن رسول الله التقى هو والمشركون، فاقتتلوا. فلمًا مال رسول الله إلى عسكره، ومال الآخرون إلى عسكرهم، وفي أصحاب رسول الله رجل لا يدع لهم شاذة ولا فاذة إلا اتبعها يضربها بسيفه. فقال: ما أجزاً منا اليوم أحد كما أجزأ فلان. فقال رسول الله: «أما إنّه من أهل النار». فقال رجل من القوم: أنا صاحبه. قال: فخرج معه كلما وقف وقف معه، وإذا أسرع أسرع معه. قال: فجرح الرجل جرحًا شديدًا، فاستعجل الموت، فوضع نصل سيفه بالأرض وذبابه بين ثدييه، ثم تحامل على سيفه، فقتل نفسه. فخرج الرجل إلى رسول الله: فقال: أشهد أنك رسول الله». [رواه البخاري ومسلم]&lt;/li&gt;
&lt;li&gt;الإخبار عن الصلح العظيم الذي سيجريه (الحسن بن علي) بين المسلمين بعد الفتنة، قال صلى الله عليه وسلم: «ابنى هَذَا سَيِّدٌ، وَلَعَلَّ الله أَنْ يُصْلِحَ بِهِ بين فئتين مِن الْمُسْلِمِينَ». [رواه البخاري] وقد كان ذلك في الصلح بين طائفة (علي) وطائفة (معاوية). &lt;/li&gt;
&lt;li&gt;الإخبار عن غزو البحر في جيل الصحابة، وعن مشاركة (أم حرام) فيه: قالت (أمّ حرام): «سمعت النبي يَقُول: أول جَيْش من أمتي يَغْزونَ الْبَحْرَ قَدْ أَوْجَبُوا. قالت أم حَرَام: قُلْتُ: يا رَسُولَ الله، أنَا فيهم؟ قَالَ: أَنْتِ فِيهِمْ. ثم قَالَ النبي: أول جيش مِنْ أمّتي يَغْزونَ مَدِينَة قيصر مغفور لهم. فقلت: أنا فيهم يا رسول الله: قال: لا». [رواه البخاري ومسلم] &lt;/li&gt;
&lt;li&gt;الإخبار عن غنيمة مال كسرى: قال (جابر بن سمرة): سمعت رسول الله يقول: «لتفتحن عصابة من المسلمين - أو من المؤمنين - كنز آل كسرى الذي فى الأبيض». [رواه مسلم]‏&lt;/li&gt;
&lt;li&gt;قال الرسول: «لن تقوم الساعة حتى&amp;hellip; تعود أرض العرب مروجًا وأنهارًا». وقال: «يوشك يا معاذ إن طالَتْ بك حياةٌ أنْ تَرَى ما ههنا قد مُلِئ جنانًا». [رواه مسلم] ‏أجرى الشيخ (عبد المجيد الزنداني) مقابلة مع البروفسور (الفريد كرونير) - من أشهر علماء الجيولوجيا في العالم وقد حضر مؤتمرًا جيولوجيًا في كلية علوم الأرض في جامعة الملك عبد العزيز حول عودة الجزيرة العربية مروجًا وأنهارًا&amp;hellip; المقابلة معروضة في الكتاب.&lt;/li&gt;
&lt;li&gt;قال الرسول عن علامات الساعة: «وَأَنْ تَرَى الحفاة العراة الْعَالَة رِعَاء الشاءِ يتَطَاوَلُونَ فى البنيان» [رواه مسلم]. أدى الكشف المفاجئ لثروات البترول والغاز في بلاد الخليج العربي إلى طفرة اقتصاديّة سريعة، فكان أن ظهر في نفس عمر الجيل الذي كان يرعى الأغدام التطاول في البنيان وناطحات السحاب، حتّى إنّ أعظم ناطحات السحاب فى العالم موجودة فى الصحراء العربيّة. فالنبوءة تخبر بالخير المادي الذي يصيب الفقراء من رعاة الغنم فينقلهم إلى فاره البنايات العالية. &lt;/li&gt;
&lt;li&gt;عن (عبد الله بن عمرو): «تخرج معادن مختلفة معدن منها قريب من الحجاز يأتيه من شرار الناس» [رواه الحاكم وقال: هذا حديث صحيح الإسناد ولم يخرجاه]. &lt;/li&gt;
&lt;li&gt;قال الرسول: «لا تقوم الساعة حتى يكون القرآن عارًا، ويتقارب الزمان» [قال الهيثمي في مجمع الزوائد: رواه الطبراني ورجاله ثقات وفي بعضهم خلاف]. واليوم إذ دعا الرجل إلى إقامة الحياة على القرآن، اتهم بالتطرّف والتنطع والظلاميّة والرجعيّة. وزماننا نفسه تقارب فيه العالم،‏ حتى صرنا نعلم خبر أقصى الأرض في لحظة وقوع الأمر حتى كأننا نشهده في مكانه. &lt;/li&gt;
&lt;li&gt;قال الرسول: «لا تقوم الساعة حتى تَخْرج نار من أرض الحجاز تضيء أعناق الإبل ببصرى» [رواه البخاري ومسلم]. ظهرت هذه النار سنة 654هـ. قال (ابن كثير): «ثم دخلت سنة أربع وخمسين وستمائة، فيها كان ظهور النار من أرض الحجاز التي أضاءت لها أعناق الإبل بِبُصرى، كما نطق بذلك الحديث المتفق عليه وقد بسط القول في ذلك الشيخ الإمام العلامة الحافظ شهاب الدين أبو شامة المقدسي في كتابه «الذيل» وشرحه». وقال (الذهبي) : «أمر هذه النار مُتواتِر، وهي مما أخبر به المصطفى حيث يقول: «لا تقوم الساعة حتى تخرج نار من أرض الحجاز تضيء لها أعناق الابل ببصرى». وقد حكى غير واحد ممَّن كان بِبُصرى في الليل، ورأى  أعناق الإبل في ضوئها».             &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="_17"&gt;متفرقات&lt;/h2&gt;
&lt;p&gt;عيش غير المسلمين في بلاد الإسلام: لقد أصاب الجو العلمئّ الإسلامئ المتميّز بالانفتاح والتحفيز على التفكير اليهود بوهجه، فنقلهم إلى عصرهم الذهبي في ظلّ دولة الإسلام. وفي ذلك كتب الرحّالة اليهودي (بنيامين التطيلي) في القرن الثاني عشر الميلادي متحدنًا عن يهود بغداد: «يوجد في بغداد حواليّ أربعين ألف يهوديٌّ، وهم يعيشون في أمان وازدهار، محفوظي الكرامة تحت سلطان الخليفة العظيم، ومن بينهم حكماء كبار». وأثنى بكلمات بليغة على الخليفة العبّاسي، حتى قال عنه: إنّه كان «محسنًا للإسرائيليين وكثيرٌ من زواره من الإسرائيليين».&lt;/p&gt;
&lt;p&gt;فضل المسلمين في تأسيس العلم التجريبي: يقول (روبير بريفو) في كتابه «بناء الإنسانية»: «لقد تعلّم روجر بيكون من خلفاء [مسلمي إسبانيا] في جامعة أوكسفورد اللغة والعلوم العربيّة. لم يكن لروجر بيكون ولا سميّه المتأخر عنه أيّ حقّ في أن يُنسب إليهما الفضل في ابتكار المنهج التجريبي. لم يكن روجر بيكون أكثر من رسول من رُسل علم المسلمين ومنهجهم إلى أوروبا المسيحيّة». مقرّرًا أنّه لا يوجد جانب واحد من جوانب الترقّي الأوروبي لا يمكن الكشف عن الأصل الحاسم للثقافة الإسلامية فيه ومؤكدًا أن العلم الطبيعي والروح العلمية هما أبرز أوجه تأثير  الإسلام في أوروبا المعاصرة. أما مؤْرّخ العلوم (جورج سارتون) فقد أقر أن أهم إنجاز في القرون الوسطى هو خلق الروح التجريبيّة. ورد ذلك أساسًا إلى جهد المسلمين حتى القرن الثاني عشر. وقد ذكرت سيجريد هونكه في كتابها «شمس العرب تشرق على الغرب» تفاصيل مثيرة عن أثر الحضارة الإسلامية على الثقافة والحياة العمليّة الأوروبيّين، بدءًا من «ثقافة الاستحمام»، إلى علوم الطبّ والفلك والرياضيات التي قرّرت فيها أَنْ المسلمين «وليس اليونان هم أساتذة أوروبا في النهضة العلميّة الرياضية» . وانتهت إلى القول: «&amp;hellip; نعم إن العرب هم مخترعو العلوم التطبيقية والوسائل التجريبية بكل ما تدل عليه هذه العبارة. والعرب هم المخترعون الحقيقيون للأبحاث التجريبية!».&lt;/p&gt;
&lt;p&gt;ممن شهد من أعلام الفكر من الغرب من النساء على عظمة الإسلام في باب تحرير المرأة من أثقال الأفكار الجاهليّة (كارن أرمسترونغ) إذ قالت: «كان النساء من أوائل المؤمنات بمحمد. كان تحريرهن مشروعا يملك قلبه. حرِّم القرآن بطريقة حازمة قتل المواليد الإناث، ووبّخ العرب على فزعهم عندما كانت تولد أنثى. وأعطى النساء أيضًا حقوقًا قانونيّة في الميراث والطلاق لم يملك جل النساء الغربيات شيئًا شبيهًا بها حتى القرن التاسع عشر. شجّع محمد النساء أن يلعبن دوزًا إيجابيًا في شؤون  الأمة، وقد عبرن عن آرائهن بصراحة في ثقة أنه سيسمع لهن».&lt;/p&gt;
&lt;p&gt;شهد المستشرق (غوستاف لو بون) في حديثه عن فتح «العرب» للهند أَن الفاتحين قد ألانوا قلوب الناس إلى الإسلام بحسن ملكهم، وأن أهل الهند قد أقبلوا على الدين الوافد عن طيب خاطر لا عن خوف من بارقة السيوف. [La Civilisation des Arabs]             &lt;/p&gt;
&lt;p&gt;من عاش تجربة الاقتراب من الموت شهد أنه رأى أو سمع أو التقى بأشخاص يمنع استلقاؤه في المشفى فاقدًا للوعي أن يدركها، ومن ذلك أن أحد العميان رأى ما أحاط به لما كان فاقدًا الوعي أثناء التجربة، وامرأة تصف خروج روحها ورؤيتها حذاء أزرق فوق سقف المستشفى, ثم بارتقاء السقف وجد الحذاء نفسه، وأخرى أجريت لها عملية على دماغها وهي فاقدة للوعي وعيناها مغلقتان، ثم هي تصف بعد ذلك تفاصيل العملية والآلات (التي كانت مغطاة) وحوارات الأطباء.  ومن المهم هنا الإشارة إلى أن هذه الظاهرة العجيبة قد قادت أكاديميين ملاحدة إلى الإيمان بالله واليوم الآخر بعد اقتناعهم أن الإنسان أكثر من مادة، ومن هؤلاء (ريموند أ. مودي) و(بِم فان لومل). وهي التجربة التي جعلت الفيلسوف (أ. ج. آير)‏ رأس إحدى أهم المدارس الفلسفية الإلحادية في القرن العشرين‏ يقول بعد تجربته الخاصة إثر توقّف قلبه عن النبض لمدة أربع دقائق: «تجاربي القريبة أضعفت بصورة قليلة قناعتي أن موتي الحقيقي - والذي سيكون قريبًا - هو نهايتي). فهو على عناده أقرّ بأثر التجربة فيه. [Gary Habermas &amp;amp; J.P. Moreland, Beyond Death: Exploring the Evidence for Immortality و Jeffrey Long and Paul Perry, Evidence of the Afterlife: The Science of Near-Death Experiences وJ. Steve Miller, Near-Death Experiences as Evidence for the Existence of God and Heaven]&lt;/p&gt;
&lt;p&gt;لقد نظرنا في كتابنا هذا في السيرة المحفوظة لنبي الإسلام، فإذا هي دالة بشهادة الصديق والخصيم على نبوته، ولا سبيل لرد ذلك إلا بإنكار صدق هذا المحفوظ، ولذلك عرضنا منهجيّة توثيق السيرة على سُنَّة علماء الحديث، ومنهج المخالفين، فاستبانت لنا عبقريّة منهج الأوّلين، ولم نسمع من المنكرين غير همهمات للمستشرقين لا تكاد تبين، وهي شكوك ووساوس لم تنتظم في منهج علمي متين.                                                               &lt;br&gt;
قبسات من أخلاق النبي صلى الله عليه وسلم: ص116-119 + ص124.&lt;/p&gt;
&lt;p&gt;شبهات المنصرين: كثيراً ما يستدلون بالضعيف أو الموضوع من الروايات. وجهلهم باللغة جعلهم يأتون بالعجائب. والتدليس في عرض الخبر التاريخي فمثلاً يعرضون قضية قتل الرسول صلى الله عليه وسلم للذكور البالغين من بني قريظة متغافلين عن ما استدعى ذلك وهي الخيانة العظمى التي كادت تودي بأمة الإسلام لو نجحت في مسعاها، ويتجاهلون أن طابع المسامحة والعفو كان الأصل في فعل النبي صلى الله عليه وسلم وخير مثال عفوه عن أهل مكة الذين آذوه كثيراً عند الفتح.&lt;/p&gt;
&lt;p&gt;قول المستشرقة (لورا فيشيا فاغليري) في الرد عن اتهام النبي صلى الله عليه وسلم بالشهوانية لزيجاته المتعددة: أنه طوال سنين الشباب حيث تكون الغريزة الجنسية أقوى ما يكون، وعلى الرغم من أنه عاش في مجتمع كان تعدد الزوجات فيه هو القاعدة، وكان الطلاق سهلاً، لم يتزوج إلا من امرأة واحدة لا غير، ولم يتزوج ثانية إلا بعد أن توفيت خديجة، وإلا بعد أن بلغ الخمسين من عمره. لقد كان لكل زيجة من زيجاته سبب اجتماعي أو سياسي.. وباستثناء عائشة تزوج من نسوة لم يكن عذارى ولا شابات ولا جميلات&amp;hellip; ص138.&lt;/p&gt;</content><category term="كتب"/><category term="ملخص-كتاب"/><category term="دلائل-الإسلام"/></entry><entry><title>My Notes From: $100M Leads: How to Get Strangers To Want To Buy Your Stuff</title><link href="https://ammar-alyousfi.com/2024/my-notes-from-100m-leads-how-to-get-strangers-to-want-to-buy-your-stuff.html" rel="alternate"/><published>2024-02-18T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2024-02-18:/2024/my-notes-from-100m-leads-how-to-get-strangers-to-want-to-buy-your-stuff.html</id><summary type="html">&lt;p&gt;Book Full Title: $100M Leads: How to Get Strangers To Want To Buy Your Stuff.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2024/100m-leads-cover-img.jpeg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/en/book/show/196239284"&gt;$100M Leads: How to Get Strangers To Want To Buy Your Stuff&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in A Paragraph&lt;/h2&gt;
&lt;p&gt;The book is about getting engaged leads. It covers the core four advertising methods: warm …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Book Full Title: $100M Leads: How to Get Strangers To Want To Buy Your Stuff.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2024/100m-leads-cover-img.jpeg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/en/book/show/196239284"&gt;$100M Leads: How to Get Strangers To Want To Buy Your Stuff&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in A Paragraph&lt;/h2&gt;
&lt;p&gt;The book is about getting engaged leads. It covers the core four advertising methods: warm outreach, post free content, cold outreach, and run paid ads. It also covers the four lead getters: customer referrals, word of mouth, agencies, and affiliates. The book is written by Alex Hormozi who is a serial entrepreneur and has founded and scaled three companies to $120M+ in cumulative sales across four different industries without taking on outside capital.&lt;/p&gt;
&lt;h2 id="my-notes"&gt;My Notes&lt;/h2&gt;
&lt;p&gt;Here are my notes from each chapter of the books.&lt;/p&gt;
&lt;h2 id="how-i-got-here"&gt;How I Got Here&lt;/h2&gt;
&lt;p&gt;My offer was simple. I’ll fill your gym in 30 days for free. You pay nothing. I pay for everything. I sell new members and keep the first 6 weeks of membership fees as payment. You get everything else. If I don’t fill your gym, I don’t make money. You spend nothing either way. It was an easy offer to sell.&lt;/p&gt;
&lt;h2 id="the-problem-this-book-solves"&gt;The Problem This Book Solves&lt;/h2&gt;
&lt;p&gt;You&amp;rsquo;re not getting as many leads as you want because you&amp;rsquo;re not advertising enough. Period.&lt;/p&gt;
&lt;p&gt;In a nutshell: I will show you how to get strangers to want to buy your stuff.&lt;/p&gt;
&lt;h2 id="leads-alone-arent-enough"&gt;Leads Alone Aren’t Enough&lt;/h2&gt;
&lt;p&gt;A lead is a person you can contact. That’s all. If you bought a list of emails, those are leads. If you get contact information from a website or database, those are leads. The numbers in your phone are leads. People on the street are leads. If you can contact them, they are leads.&lt;/p&gt;
&lt;p&gt;Leads alone aren’t enough. We want engaged leads: people who show interest in the stuff you sell. If someone gives their contact information on a website, that is an engaged lead.&lt;/p&gt;
&lt;p&gt;Engaged leads are the true output of advertising.&lt;/p&gt;
&lt;h2 id="engage-your-leads-offers-and-lead-magnets"&gt;Engage Your Leads: Offers and Lead Magnets&lt;/h2&gt;
&lt;p&gt;Often, a business promises to give its product or service in exchange for money. This is a core offer.&lt;/p&gt;
&lt;p&gt;Sometimes, though, people want to know more about your offer before they buy. This is common for businesses that sell more expensive stuff. If that’s you, then you’ll often get more leads to engage by advertising with a lead magnet first. A lead magnet is a complete solution to a narrow problem. It’s typically a lower-cost or free offer to see who is interested in your stuff. And, once solved, it reveals another problem solved by your core offer. This is important because leads interested in lower-cost or free offers now are more likely to buy a related higher-cost offer later. Think of it like salty pretzels at a bar. If somebody eats the pretzels, they’ll get thirsty and order a drink. The salty pretzels solve the narrow problem of hunger. They also reveal a thirst problem solved by a drink, which they can get, in exchange for money.&lt;/p&gt;
&lt;p&gt;Your lead magnet should be valuable enough on its own that you could charge for it.&lt;/p&gt;
&lt;p&gt;A person who pays with their time now is more likely to pay with their money later.&lt;/p&gt;
&lt;h3 id="types-of-lead-magnets"&gt;Types of lead magnets&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2024/100mleads-1.png"&gt;&lt;/p&gt;
&lt;p&gt;1) Reveal Their Problem. Think “diagnosis.” If your audience has a problem they don’t know about, your lead magnet would make them aware of it. These lead magnets work great when they reveal problems that get worse the longer you wait. Example: You run a speed test that shows their website loads at 30 % below the speed it should. You draw a clear line between where they should be and how much money they lose by being below standards.&lt;/p&gt;
&lt;p&gt;2) Samples And Trials. You give full but brief access to your core offer. You can limit the number of uses, time they have access, or both. This works great when your core offer is a recurring solution to a recurring problem.&lt;/p&gt;
&lt;p&gt;3) One Step Of A Multi-Step Process. You can give them one step in a multi-step process that solves a bigger problem.&lt;/p&gt;
&lt;p&gt;Leads have to notice your lead magnet before they can consume it. Like it or not, this means how we present it matters more than anything. For example, improving the headline, name, and display of your lead magnet can 2x, 3x, or 10x your engagement.&lt;/p&gt;
&lt;p&gt;Here’s what you do next-you test. The three things you’ll want to test are the headline, the image(s), and the subheadline, in that order.&lt;/p&gt;
&lt;p&gt;People buy stuff based on how much value they think they’ll get after they buy it. And the easiest way to get them to think they’ll get tons of value after they buy is … drum roll please … to provide them with value before they buy.&lt;/p&gt;
&lt;p&gt;Once the leads consume the lead magnet, some of them will be ready to buy or learn more about your offer. This is the time to give a Call To Action (CTA).&lt;/p&gt;
&lt;p&gt;Good CTAs have two things: 1) what to do and 2) reasons to do it right now.&lt;/p&gt;
&lt;p&gt;Let’s say you make $10,000 of profit on your core offer. And it costs you $1000 in advertising to get someone on a call for it. If you close one out of three people, it costs you $3000 in advertising to get a customer.
Imagine you advertise a free lead magnet instead of your core offer. Your lead magnet costs you $25 to deliver, and because it’s free to them, more will engage. The extra engagement means it only costs $75 in advertising to get someone on a call. All in, it’s $100 per call.
Now, let’s say one out of ten folks who get the lead magnet buys your core offer. This means your new cost to acquire a customer is $1000 ($100 x 10 people). We just cut our cost to get a customer by 3x.&lt;/p&gt;
&lt;p&gt;The Core Four Advertising Methods:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2024/100mleads-2.png"&gt;&lt;/p&gt;
&lt;h2 id="1-warm-outreach"&gt;#1 Warm Outreach&lt;/h2&gt;
&lt;p&gt;When I make an offer from scratch, I refer to the value equation. If you’re wondering ‘what’s the value equation?’-it was the core concept of my first book $100M Offers.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2024/100mleads-4.png"&gt;&lt;/p&gt;
&lt;p&gt;The goal is to maximize the first two and minimize the second two. So all you have to do now is show someone: You have exactly what they want They’re guaranteed to get it Insanely fast Without lifting a finger or giving up anything they love.&lt;/p&gt;
&lt;p&gt;So let’s do just that with a real-life offer:&amp;hellip; &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;By the way, do you know anybody who is (describe their struggles) looking to (dream outcome) in (time delay)? I’m taking on five case studies for free, because that’s all I can handle. I just want to get some testimonials for my service / product. I help them (dream outcome) without (effort and sacrifice). It works. I even guarantee people get (dream outcome) or I work with them until they do. I just had a girl named XXX work with me (dream outcome) even though she (describe the same struggle your contact has). I also had another guy who (dream outcome) and it was his first time. I’d just like more testimonials to show it works across different scenarios. Does anyone you like come to mind? (Pause if on the phone) … and if they say no … Haha, well … does anyone you hate come to mind? (ha) This helps break any awkwardness.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There’s an important feature here. We’re not asking them to buy anything. We’re asking if they know anyone. And of the people who say yes, most say they are interested.&lt;/p&gt;
&lt;h2 id="2-post-free-content-part-i"&gt;#2 Post Free Content Part I&lt;/h2&gt;
&lt;p&gt;Building an audience is the most valuable thing I’ve ever done.&lt;/p&gt;
&lt;p&gt;Leila bought me four calls with a big influencer who had the type of audience I wanted to build. She paid $120,000. On my first call, he told me to post regularly on every platform. So, that&amp;rsquo;s what I did. Twelve months later, my audience grew by more than 200,000 people. On my second call, he noted the progress. But I wanted more. He said, “Bro, anyone telling you there’s some secret is trying to sell you something. We just put out as much as we possibly can. Pull up your Instagram and pull up my Instagram&amp;hellip; Look. You’ve posted once today. I posted three times. Pull up your LinkedIn … Look. You posted once this week. I posted five times today.” Simple. Not easy. Over the next six months I put out ten times the content. And over the next six months, I added 1.2M people to my audience.&lt;/p&gt;
&lt;p&gt;Free content makes all other advertising more effective. If you reach out to someone and they can’t find content related to your services, they’re less likely to buy. On the other hand, if they find lots of valuable content, they are more likely to buy.&lt;/p&gt;
&lt;h2 id="2-post-free-content-part-ii"&gt;#2 Post Free Content Part II&lt;/h2&gt;
&lt;p&gt;Switch from “How to” to “How I.” From “This is the best way” to “These are my favorite ways” etc. (especially when starting out).&lt;/p&gt;
&lt;p&gt;Narrow the focus of your content. If you have a small local business, you probably shouldn’t make general business content. Not at first, at least. Why? The audience will listen to people with better track records than you. But you can narrow your topics to what you do and the place you do it. Example: plumbing in a certain town. If you do that, you can become king of that puddle. Over time, you can expand your plumbing puddle to the general local business pond. Then the lake of brick &amp;amp; mortar chains and so forth.&lt;/p&gt;
&lt;p&gt;First, we start with warm outreach. We reach out to every person we have permission to contact. Second, we post publicly about the successes and lessons we have from our first clients. We post testimonials. We provide value. Then occasionally ask. We commit to doing both of these activities every day.&lt;/p&gt;
&lt;h2 id="3-cold-outreach"&gt;#3 Cold Outreach&lt;/h2&gt;
&lt;p&gt;Cold outreach has one key difference from warm outreach: trust. Strangers don’t trust you.&lt;/p&gt;
&lt;p&gt;Cold outreach is a numbers game. The more people you reach out to the more engaged leads you get. Once we figure out how much outreach it takes to engage a lead, then we only have one thing to do … more.&lt;/p&gt;
&lt;p&gt;There are three different ways I get my targeted lead lists. First, I use software to scrape a list of names. Second, I pay brokers to assemble me a list of targeted leads. And if neither of those work, I manually scrape a list of names myself. Find your scraping tool by searching “outbound leads scraping tool” or “database lead scraping.”&lt;/p&gt;
&lt;p&gt;There are two important factors I emphasize to get strangers to engage: personalization and big fast value. This is important because they don&amp;rsquo;t know us and they don’t trust us. We’ve gotta overcome both issues in a matter of seconds. &lt;/p&gt;
&lt;p&gt;A) They Don’t Know Us → Personalize (Act Like You Know Them). This comes in handy for personal subject lines on emails, the first few messages in chat, or the first few sentences someone hears.&lt;/p&gt;
&lt;p&gt;B) They Don’t Trust Us → Big Fast Value. We’re not trying to tickle their interest, we’re trying to blow their minds in under thirty seconds. It needs to be BIG FAST VALUE. If it’s not, or it’s mediocre, you’ll blend in with the ocean of people trying to get their attention. Give away something for free people would normally pay for and they will want it. Note: I didn’t say, “so good they should pay for it,” I said, “stuff they actually pay for.”&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Pro Tip: 50% Email Response Rate Bump
I took our cold outreach template and re-wrote it below a third grade reading level. The results: 50% more leads responded. I recommend running all scripts and messages through a free reading level app online. I won&amp;rsquo;t recommend one because they go out of business all the time, but I promise you can find one. Make your messages easier to understand and more people will respond.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="4-run-paid-ads-part-i-making-an-ad"&gt;#4 Run Paid Ads Part I: Making An Ad&lt;/h2&gt;
&lt;p&gt;With warm and cold outreach we have to do more stuff to reach more people. To reach more people with free content, we depend on the platform or audience sharing it if they feel like it. Paid ads are different. The reach is guaranteed. But getting your money back isn’t. So it’s a game of efficiency rather than reach.&lt;/p&gt;
&lt;p&gt;This chapter reveals how I create more efficient paid ads by finding needles in the haystack. I start with the entire world as my audience (haystack) then narrow down to get a higher percentage of engaged leads (needles). First, I pick a platform that contains my ideal audience. Second, I use whatever targeting methods that exist within the platform to find them. Third, I craft my ad in a way that repels anyone else. Finally, I tell whoever’s left standing to take the next step. People overcomplicate it. But that’s it.&lt;/p&gt;
&lt;p&gt;Once we advertise profitably in a small puddle of an audience, we expand to a pond, then a lake, then an ocean. And as the audience gets bigger it does have more of the wrong people, but it has more of the right ones too.&lt;/p&gt;
&lt;p&gt;&amp;hellip;instead of spending $1000 to make $10,000 with $9000 in profit, you spend $100,000 to make $300,000 with $200,000 in profit. Your ratio goes down, but you make more money.&lt;/p&gt;
&lt;p&gt;Modern advertising platforms have two ways to target. You can use them separately or combine them: &lt;/p&gt;
&lt;p&gt;1) Target a lookalike audience. Modern platforms can show your ad to an audience that is similar to, and much bigger than, a list you provide.&lt;/p&gt;
&lt;p&gt;2) Target with factors of your choosing. Targeting options include: age, income, gender, interests, time, location, etc.&lt;/p&gt;
&lt;p&gt;What should the ad say? → Call Out + Value + Call to Action (CTA)&lt;/p&gt;
&lt;p&gt;Call Out: People noticing your ad is the most important part of the ad … by a lot. My advertising became 20x more effective when I focused the majority of my effort on the first five seconds. We need the audience’s eyes and ears just long enough for them to realize “this is for me, I’ll keep paying attention.”&lt;/p&gt;
&lt;p&gt;People want to work with people who look, talk, and act in ways familiar to them. So if you serve a broad customer base use more ethnicities, ages, genders, personalities etc. in your ads. If you serve a narrow customer base (ex: medical devices for seniors), then use people who look like them.&lt;/p&gt;
&lt;p&gt;Dream Outcome: A good ad will show and tell the maximum benefit the prospect can achieve using the thing you sell.&lt;/p&gt;
&lt;p&gt;Opposite-Nightmare: A good ad will also show them the worst possible hassles, pain, etc. of going without your solution.&lt;/p&gt;
&lt;p&gt;Lower perceived risk by minimizing or explaining away past failures, emphasizing the success of people like them, giving assurances by authority, guarantees, and how what you have to offer will at least give them a better chance of success than what they currently do, etc.&lt;/p&gt;
&lt;p&gt;A good ad will also show them how slow their current trajectory is.&lt;/p&gt;
&lt;p&gt;A good ad will show and tell how much faster they will get the thing they want.&lt;/p&gt;
&lt;p&gt;A good ad will also show them the amount of work and skill they’ll need to get the result without your solution.&lt;/p&gt;
&lt;p&gt;A good ad tells and shows how you can avoid the stuff you hate doing, do more of the stuff you love doing.&lt;/p&gt;
&lt;p&gt;Make your landing pages match your ads. People click an ad because you promised them some benefit. So carry that same look and language over to your landing page.&lt;/p&gt;
&lt;p&gt;In Robert Cialdini’s seminal work, Influence, he shows that people like to think of themselves as consistent. So, if you remind them of the action they just took (CTA), and show how taking the next action aligns with it, you’ll get more people to take the second action (Contact Info). For example, “Now that you just did A, you need to do B to get the most of A.” Or “Doing A makes you a ‘doing A’ kind of person. Doing A kind of people, do B.”&lt;/p&gt;
&lt;p&gt;To be clear, we aren’t selling anything. We are asking if they’re interested in the stuff we sell. And if they’re interested, they’ll give us a way to tell them more about it. And when they do, they become engaged leads.&lt;/p&gt;
&lt;h2 id="4-run-paid-ads-part-ii-money-stuff"&gt;#4 Run Paid Ads Part II: Money Stuff&lt;/h2&gt;
&lt;p&gt;Imagine I spend $100 on ten ads—$1,000 in total. Nine of them lose all $100. Then, one of them makes $500 back for the $100 I spent. I’m still down $500. Many people stop here because they see a $500 dollar loss. But not us. We see a winner. So now we buckle up and 100x down. We spend $10,000 on the winning ad and make $50,000 back.&lt;/p&gt;
&lt;p&gt;I measure paid ad efficiency by comparing the lifetime gross profit of a customer (LTGP) with the cost to acquire a customer (CAC). I express this ratio as LTGP to CAC. Lifetime gross profit is all the money a customer ever spends on your stuff minus all the money it takes to deliver it.&lt;/p&gt;
&lt;p&gt;We speak with hundreds of entrepreneurs every month. They often think they have crappy ads (high CAC) when, in reality, they have a crappy business model (Low LTGP). The cost to acquire customers, between competitors in the same industry, is much closer than you’d think. The difference between the winners and the losers is how much they make off each customer.&lt;/p&gt;
&lt;h3 id="example"&gt;Example&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2024/100mleads-3.png"&gt;&lt;/p&gt;
&lt;p&gt;You spent $30 in ads and only got $10 back. Ten bucks trickles in, one month at a time, until you finally break even … two. months. later. That’s tough! Make no mistake, you should 100 % make that trade. But, now we have a cash flow problem. Here’s the way I fix it-I immediately sell them more stuff.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2024/100mleads-5.png"&gt;&lt;/p&gt;
&lt;p&gt;If I cover the cost to get and fulfill a customer in the first thirty days I can pay off my card, then do it again. It’s how I’ve scaled every company I’ve started for the past seven years past $1M / mo in the first twelve months-without outside funding.&lt;/p&gt;
&lt;p&gt;Ad content ideas: Your Best Free Content Can Make The Best Paid Ads. If you can get your customers to create testimonials or reviews using your product, post them. If they perform well as free content, they often make killer ads too.&lt;/p&gt;
&lt;h2 id="core-four-on-steroids-more-better-new"&gt;Core Four On Steroids: More Better New&lt;/h2&gt;
&lt;p&gt;First, you reach out to people who know you. Then, you start making free content. Then you start reaching out to people who don’t know you. Then you start running paid ads. This is how you do the core four to get engaged leads.&lt;/p&gt;
&lt;p&gt;Here’s how I get better: I test one thing per week per platform.&lt;/p&gt;
&lt;p&gt;First, you do way more of the advertising that works until it “breaks.” Then, the next drop off point becomes obvious. Then you keep that level of advertising up while you go back, fix the constraint, and make it better.&lt;/p&gt;
&lt;p&gt;Only once you’ve exhausted more–better do the real returns come from doing new. First, go with new ad placements on a platform you know. Second, go with placements you know on a new platform. Then, once you get the hang of that new platform, use new placements on it. Once you exhaust that, you can add a new core four activity on top of what you currently do. That gives you my simple, real-world way,&lt;/p&gt;
&lt;p&gt;As far as what to do when? Whenever I build a business I think about it this way – after I do warm outreach to get my pool of customers going – if I have more time than money, I move to posting content. If I have more money than time, I go with cold outreach or running ads. But remember, you only need to do one to get engaged leads. So, just pick one. Then, max it out. Do more. Do better. Do new.&lt;/p&gt;
&lt;h2 id="1-customer-referralsword-of-mouth"&gt;#1 Customer Referrals—Word of Mouth&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Pro Tip: Make The Success Activities The Conditions of Your Guarantee
DO NOT DO THIS IF YOU HATE MONEY AND HELPING PEOPLE: As soon as you start getting customers results, note what they did. Then, start guaranteeing new customers those results. But do it on the condition they do what the best customers did. The guarantee sells more people. The conditions get them better results. You win. They win.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Asking for referrals only works when you treat it like an offer. The referrals come when you show the value the customer gets when they refer their friends. Dropbox gave free storage to customers and free storage to the friends they referred.&lt;/p&gt;
&lt;p&gt;Example: Pay your average cost to acquire a customer (CAC) to the referrer or the friend or both.&lt;/p&gt;
&lt;p&gt;I had a new salesman come into one of my portfolio companies and shatter all the sales records for an upcoming event. We didn’t know what was going on. So I hopped on the phone with him-how are you selling more tickets than everyone else? He shrugged and said, “I’m doing the same thing as everyone else. I just make sure I ask them who else they’d want to have come with them. Then ask them to introduce me.” Half his sales were referrals. So simple, and yet no one does it.&lt;/p&gt;
&lt;p&gt;Unlockable Referral Bonuses: Create bonuses for people who 1) refer and 2) leave a testimonial. A few examples: Unlock VIP bonuses, courses, tokens, status, training, merchandise, service levels, premium support, additional hours of service, etc.&lt;/p&gt;
&lt;h2 id="3-agencies"&gt;#3 Agencies&lt;/h2&gt;
&lt;p&gt;Agencies can play a valuable role in business growth. But not the way they want you to. I don&amp;rsquo;t want anyone else falling into the same trap.&lt;/p&gt;
&lt;p&gt;If I want to learn new ways to do content, outreach, or paid ads, then I hire agencies offering new ways to do them. They’ve already made the big mistakes.&lt;/p&gt;
&lt;p&gt;Here’s how I use agencies now. Rather than believe the lie that “I’ll never have to learn this stuff because they can do it,” I start every agency relationship with a purpose and a deadline to fulfill it. I open by saying: “I want to do what you do in my business, but I don’t know how. I’d like to work with you for 6 months so I can learn how you do it. Plus, I’ll pay extra for you to break down why you make the decisions you do and the steps you take to make them. Then, after I get a good idea of how it all works, I’ll start training my team on it. And once they can do it well enough, I’d like to change to a lower cost consulting arrangement. This way, you can still help us if we run into problems. Are you opposed to this?” In my experience, most agencies are not opposed to this.&lt;/p&gt;
&lt;p&gt;I’ve used this method again and again. I hire one “good enough” agency to learn the ropes of a new platform. Then, I hire a more elite agency to learn how to maximize it – and I cannot recommend this strategy enough.&lt;/p&gt;
&lt;h2 id="4-affiliates-and-partners"&gt;#4 Affiliates and Partners&lt;/h2&gt;
&lt;p&gt;An affiliate is a lead-getter. They are an independent business that tells their audience to buy your stuff. Affiliates seem like referrals on the outside, but are much different under the hood. First, they have their own businesses and do their own advertising. Second, they agree to offer your stuff to their engaged leads in exchange for money, free stuff, or both.&lt;/p&gt;
&lt;p&gt;Scenario # 1: You sell ten customers per month worth $10,000 each. Your business caps at $100,000 per month. In twelve months you’ve made 1.2 million.&lt;/p&gt;
&lt;p&gt;Scenario # 2: For the same effort, you sell ten affiliates per month. Each month, those affiliates bring you one of those $10,000 customers. Now, every single month you add an extra $100,000 in revenue. In twelve months you’ve made 7.8 million. And it grows every month thereafter.&lt;/p&gt;
&lt;p&gt;The ideal affiliate has a business with a warm audience full of people like your customers.&lt;/p&gt;
&lt;p&gt;We make the affiliate-offer and advertise it the same way we would any other offer. We call out our audience, show our value elements, and then call them to action.&lt;/p&gt;
&lt;p&gt;Call outs for potential affiliates often include: 
- The affiliate business owners themselves-ATTENTION SPA OWNERS 
- The affiliate’s customers-Do you work with busy professionals who spend all day in meetings?&lt;/p&gt;
&lt;p&gt;we don&amp;rsquo;t need to reinvent the wheel. Most affiliate money making offers show value like this: Make more money from your current customers and get more leads than your current offer (dream outcome) … with a high chance of working since your customers already want the product (perceived likelihood of achievement)&amp;hellip; without needing to build, deliver, or provide customer support for the product yourself (effort and sacrifice)&amp;hellip; so you can start selling it tomorrow (time delay).&lt;/p&gt;
&lt;p&gt;The whisper-tease-shout method: During the whisper phase of my book launch: I posted content, reached out to friends, emailed my list, and told potential affiliates about major updates to the book. I showed what draft I was on. I took pictures behind the scenes of me printing out drafts. I showed the many versions of the frameworks I drew. I shared videos of myself editing the book early in the morning and late at night, etc … all of it made people who want leads get curious and pay attention. Tease: Think “Elements Of Value.” It’s time to start satisfying all the curiosity you created during the whisper phase. Reveal your product, make the date of the launch public, and start showing the elements of value. Shout: Think “Call to Action.” Give specific actions for the audience to take when the product launches. Now you start pounding the audience with bonuses, scarcity, urgency, and guarantees around being “the first ones.” You shout to get as many people exposed to your offer as you can.&lt;/p&gt;
&lt;h2 id="section-iv-conclusion-get-lead-getters"&gt;Section IV Conclusion: Get Lead Getters&lt;/h2&gt;
&lt;p&gt;Once you find something that works for you – stick to what you pick. Those are the best words of encouragement I can offer. The longer you play the game, the better you will get, and the more success you will have. Just don&amp;rsquo;t quit or switch methods after seeing a few losses. It’s normal to lose in the beginning. In fact, I expect to crack a new lead source in three to six months (and this isn’t my first rodeo). So if your expectations are faster than that, do you think your expectations are reasonable?&lt;/p&gt;
&lt;h2 id="advertising-in-real-life-open-to-goal"&gt;Advertising in Real Life: Open To Goal&lt;/h2&gt;
&lt;p&gt;Waking up early, getting right to work, and working 8 hours straight has been my highest ROI “habit stack.”&lt;/p&gt;</content><category term="book-notes"/><category term="business"/><category term="startups"/><category term="marketing"/></entry><entry><title>Guided Generation with LLMs: How to Fully Control LLM Outputs</title><link href="https://ammar-alyousfi.com/2024/Guided-Generation-with-LLMs-How-to-Fully-Control-LLM-Outputs.html" rel="alternate"/><published>2024-02-16T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2024-02-16:/2024/Guided-Generation-with-LLMs-How-to-Fully-Control-LLM-Outputs.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2024/llm-guided-gen-img.jpeg" style="max-width:800px; width:100%;"&gt;&lt;/p&gt;
&lt;p&gt;Large Language Models (LLMs) have revolutionized the AI world in the past few months. There are commercial ones like OpenAI&amp;rsquo;s GPT-4 and Anthropic&amp;rsquo;s Claude 2.1, and open-source ones like Llama 2 and Mistral and their many fine-tunes. &lt;/p&gt;
&lt;p&gt;With OpenAI&amp;rsquo;s models, you can control the output to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2024/llm-guided-gen-img.jpeg" style="max-width:800px; width:100%;"&gt;&lt;/p&gt;
&lt;p&gt;Large Language Models (LLMs) have revolutionized the AI world in the past few months. There are commercial ones like OpenAI&amp;rsquo;s GPT-4 and Anthropic&amp;rsquo;s Claude 2.1, and open-source ones like Llama 2 and Mistral and their many fine-tunes. &lt;/p&gt;
&lt;p&gt;With OpenAI&amp;rsquo;s models, you can control the output to a good extent using &lt;a href="https://platform.openai.com/docs/guides/function-calling"&gt;function calling&lt;/a&gt; and get structured data back from the models.&lt;/p&gt;
&lt;p&gt;With many open-source LLMs, you can have even greater control over the outputs. In this post, I will talk about great libraries that can be used to fully control the outputs of LLMs using what&amp;rsquo;s being called &amp;ldquo;guided generation.&amp;rdquo; They all have similar capabilities, so I&amp;rsquo;ll mention some of the interesting or unique features of each one with some examples to give you an idea of how they work. For more details, you can check their documentation via the links provided below.&lt;/p&gt;
&lt;p&gt;If you want to see my conclusion and the tool I ended up using, you can skip to the end of the post.&lt;/p&gt;
&lt;h2 id="what-is-guided-generation"&gt;What is Guided Generation?&lt;/h2&gt;
&lt;p&gt;Guided generation in large language models (LLMs) is an advanced approach that allows you to steer the model to generate text in the format and patterns you need. This method involves guiding the language model&amp;rsquo;s text generation using specific techniques like regular expressions, JSON schemas, context-free grammars (CFGs), etc. &lt;/p&gt;
&lt;p&gt;With guided generation, you can be sure that the LLM will adhere to your predefined patterns or structures, enhancing both its relevance and accuracy.&lt;/p&gt;
&lt;h2 id="tools-for-guided-generation"&gt;Tools for Guided Generation&lt;/h2&gt;
&lt;p&gt;Luckily we have many open-source tools that support guided generation, and most of them are actively maintained. Below are the most prominent ones at the time of writing this post.&lt;/p&gt;
&lt;h3 id="guidance-by-guidance-ai"&gt;Guidance by guidance-ai&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: center;"&gt;# of stars&lt;/th&gt;
&lt;th style="text-align: center;"&gt;# of commits&lt;/th&gt;
&lt;th style="text-align: center;"&gt;# of contributors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: center;"&gt;16.1K&lt;/td&gt;
&lt;td style="text-align: center;"&gt;1,177&lt;/td&gt;
&lt;td style="text-align: center;"&gt;54&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;a href="https://github.com/guidance-ai/guidance"&gt;Guidance on Github&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It allows users to constrain generation (e.g. with regex and CFGs) as well as to &lt;strong&gt;interleave control (conditional, loops) and generation seamlessly&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Compatible with Transformers, llama.cpp, VertexAI, and OpenAI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="examples"&gt;Examples&lt;/h4&gt;
&lt;p&gt;The following example shows how you can make the model choose from a list of predefined options and then generate text based on the choice.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;guidance&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gen&lt;/span&gt;

&lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LlamaCpp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;path/to/llama2.gguf&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_gpu_layers&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_ctx&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4096&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# capture the selection under the name &amp;#39;answer&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Do you want a joke or a poem? A &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;joke&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;poem&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;answer&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# make a choice based on the model&amp;#39;s previous selection&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lm&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;answer&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;joke&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Here is a one-line joke about cats: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;gen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;output&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Here is a one-line poem about dogs: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;gen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;output&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The output will be something like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;Do&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;you&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;want&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;joke&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;poem&lt;/span&gt;?&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;A&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;poem&lt;/span&gt;.
&lt;span class="nv"&gt;Here&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;one&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;poem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;dogs&lt;/span&gt;:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Dogs are the best.&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Another example showing how to use functions with Guidance:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;guidance&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gen&lt;/span&gt;

&lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LlamaCpp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;path/to/llama2.gguf&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_gpu_layers&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_ctx&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4096&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@guidance&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;qa_bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="s1"&gt;    Q: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="s1"&gt;    Now I will choose to either SEARCH the web or RESPOND.&lt;/span&gt;
&lt;span class="s1"&gt;    Choice: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;SEARCH&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;RESPOND&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;choice&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="s1"&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lm&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;choice&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;SEARCH&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;A: I don&amp;#39;t know, Google it!&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;A: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;gen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Q:&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;answer&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;lm&lt;/span&gt;

&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Who won the last Kentucky derby and by how much?&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;lm&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;qa_bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;which will output something like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;Q&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Who&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;won&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Kentucky&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;derby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;by&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;much&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;
&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;will&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;choose&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;either&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SEARCH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;RESPOND&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;Choice&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SEARCH&lt;/span&gt;
&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;don&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;know&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Google&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Notice how you can mix model generations with Python logic. For example, model selection between &amp;ldquo;SEARCH&amp;rdquo; and &amp;ldquo;RESPOND&amp;rdquo; is saved in &lt;code&gt;choice&lt;/code&gt; variable, then it&amp;rsquo;s used to decide what to do next. This can be a powerful feature that allows seamless integration of LLMs within your code.&lt;/p&gt;
&lt;h3 id="outlines-by-outlines-dev"&gt;Outlines by outlines-dev&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: center;"&gt;# of stars&lt;/th&gt;
&lt;th style="text-align: center;"&gt;# of commits&lt;/th&gt;
&lt;th style="text-align: center;"&gt;# of contributors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: center;"&gt;4.4K&lt;/td&gt;
&lt;td style="text-align: center;"&gt;483&lt;/td&gt;
&lt;td style="text-align: center;"&gt;51&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;a href="https://github.com/outlines-dev/outlines"&gt;Outlines on Github&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Allows you to control model outputs using a Pydantic model or a JSON schema.&lt;/li&gt;
&lt;li&gt;Compatible with OpenAI, transformers, llama.cpp, exllama2, and mamba.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="examples_1"&gt;Examples&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;outlines&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outlines&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transformers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;mistralai/Mistral-7B-v0.1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outlines&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;generate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Blue&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Red&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Yellow&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;generator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;What is the closest color to Indigo? &amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;which will output something like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Blue
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Another example showing how to use Pydantic models with Outlines:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;enum&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Enum&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;pydantic&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;constr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conint&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;outlines&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;Armor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Enum&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;leather&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;leather&amp;quot;&lt;/span&gt;
    &lt;span class="n"&gt;chainmail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;chainmail&amp;quot;&lt;/span&gt;
    &lt;span class="n"&gt;plate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;plate&amp;quot;&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;Character&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;constr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;conint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;armor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Armor&lt;/span&gt;
    &lt;span class="n"&gt;strength&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;conint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outlines&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transformers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;mistralai/Mistral-7B-v0.1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outlines&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;generate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Character&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;character&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;generator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;&amp;quot;Generate a new character for my awesome game: &amp;quot;&lt;/span&gt;
    &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;name, age (between 1 and 99), armor and strength. &amp;quot;&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;character&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;which will output something like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;name=&amp;#39;Orla&amp;#39; age=21 armor=&amp;lt;Armor.plate: &amp;#39;plate&amp;#39;&amp;gt; strength=8
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="llamacpp-with-grammars"&gt;llama.cpp with Grammars&lt;/h3&gt;
&lt;p&gt;Llama.cpp is one of the most popular LLM libraries out there. Its development is very active with hundreds of contributors. Its main goal is to &amp;ldquo;enable LLM inference with minimal setup and state-of-the-art performance on a wide variety of hardware - locally and in the cloud&amp;rdquo;.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: center;"&gt;# of stars&lt;/th&gt;
&lt;th style="text-align: center;"&gt;# of commits&lt;/th&gt;
&lt;th style="text-align: center;"&gt;# of contributors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: center;"&gt;&lt;strong&gt;50.4K&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: center;"&gt;2,092&lt;/td&gt;
&lt;td style="text-align: center;"&gt;555&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;a href="https://github.com/ggerganov/llama.cpp"&gt;llama.cpp on Github&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Compatible with many models and their finetunes like: LLaMA 2, Mistral 7B, Yi models, Qwen models, etc. Basically, it works with models in GGUF format which is a format available for almost all models &lt;a href="https://huggingface.co/models?sort=downloads&amp;amp;search=gguf"&gt;on HuggingFace&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;It has bindings for Python, Go, Node.js, and many other languages.&lt;/li&gt;
&lt;li&gt;Robust with many other libraries and tools built on top of it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;llama.cpp supports guided generation to constrain the model&amp;rsquo;s output using &lt;a href="https://github.com/ggerganov/llama.cpp/blob/master/grammars/README.md"&gt;GBNF grammars&lt;/a&gt;. GBNF is a grammar format that allows you to define the structure of the output you want to generate. GBNF might seem intimidating at first, but after you understand its syntax and go through some examples, you will find that it&amp;rsquo;s not that complex really. &lt;/p&gt;
&lt;h4 id="example"&gt;Example&lt;/h4&gt;
&lt;p&gt;The following quick example shows how to guide the model to generate output in the format of a list.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;llama_cpp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Llama&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LlamaGrammar&lt;/span&gt;

&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Llama&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;mistral-7b-instruct-v0.2.Q4_K_M.gguf&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;n_gpu_layers&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;grammar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;LlamaGrammar&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;from_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="sd"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class="sd"&gt;# a grammar for lists&lt;/span&gt;
&lt;span class="sd"&gt;root ::= (&amp;quot;- &amp;quot; item)+&lt;/span&gt;
&lt;span class="sd"&gt;item ::= [^\n]+ &amp;quot;\n&amp;quot;&lt;/span&gt;
&lt;span class="sd"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="s2"&gt;&amp;quot;List the names of some deep learning architectures.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;grammar&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;grammar&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It will output something like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Convolutional Neural Networks (CNN)
- Recurrent Neural Networks (RNN)
- Long Short-Term Memory (LSTM)
- Autoencoder
- Generative Adversarial Networks (GAN)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="other-tools-and-approaches"&gt;Other Tools and Approaches&lt;/h3&gt;
&lt;p&gt;The above tools are the ones that I used extensively and they are the most popular. But there are other tools that might be useful too:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/eth-sri/lmql"&gt;LMQL&lt;/a&gt; from SRI Lab at ETH Zurich. It &amp;ldquo;offers a novel way of interweaving traditional programming with the ability to call LLMs in your code.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/sgl-project/sglang"&gt;SGLang&lt;/a&gt; from sgl-project.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Other than using these tools to force the model to generate text in a specific format, there is an alternative approach I&amp;rsquo;ve seen in some projects. It&amp;rsquo;s about using a powerful model that you instruct in the prompt to respond in a given format. You might provide some examples in the prompt as well. Then you parse the output to make sure it&amp;rsquo;s in the format you need. If not, you prompt the model to generate again, and so on.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Based on my experience with the three tools above (Guidance, Outlines, and llama.cpp), &lt;strong&gt;I ended up using llama.cpp&lt;/strong&gt; for two main reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I found llama.cpp to be more robust and reliable. I encountered some bugs with Guidance and Outlines. For example, I encountered an issue with Outlines that made generation fail randomly. I&amp;rsquo;m sure the maintainers will fix the issues, but with llama.cpp, I didn&amp;rsquo;t encounter any bugs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;llama.cpp is very active and has a large community. It&amp;rsquo;s the most starred LLM library on Github as far as I know. It has a lot of contributors and it&amp;rsquo;s being used by many projects. This means that it&amp;rsquo;s more likely to be maintained and improved in the future.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Plus llama.cpp is pretty fast (especially in the latest releases) and the GBNF grammar offers a lot of flexibility to guide the model&amp;rsquo;s output.&lt;/p&gt;</content><category term="data-science"/><category term="LLM"/><category term="guided-generation"/><category term="llama"/><category term="mistral"/><category term="NLP"/></entry><entry><title>Revolution in Pixels: Comparing the Top AI Image Generation Models</title><link href="https://ammar-alyousfi.com/2024/Revolution-in-Pixels-Comparing-the-Top-AI-Image-Generation-Models.html" rel="alternate"/><published>2024-02-07T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2024-02-07:/2024/Revolution-in-Pixels-Comparing-the-Top-AI-Image-Generation-Models.html</id><summary type="html">&lt;style&gt;
hr {
    margin-top: 2rem;
    margin-bottom: 2rem;
    border: 0;
    /* border-top: 10px solid #bbb; */
    height: 12px;
    background: linear-gradient(to right, #6e40aa,#7140ab,#743fac,#773fad,#7a3fae,#7d3faf,#803eb0,#833eb0,#873eb1,#8a3eb2,#8d3eb2,#903db2,#943db3,#973db3,#9a3db3,#9d3db3,#a13db3,#a43db3,#a73cb3,#aa3cb2,#ae3cb2,#b13cb2,#b43cb1,#b73cb0,#ba3cb0,#be3caf,#c13dae,#c43dad,#c73dac,#ca3dab,#cd3daa,#d03ea9,#d33ea7 …&lt;/style&gt;</summary><content type="html">&lt;style&gt;
hr {
    margin-top: 2rem;
    margin-bottom: 2rem;
    border: 0;
    /* border-top: 10px solid #bbb; */
    height: 12px;
    background: linear-gradient(to right, #6e40aa,#7140ab,#743fac,#773fad,#7a3fae,#7d3faf,#803eb0,#833eb0,#873eb1,#8a3eb2,#8d3eb2,#903db2,#943db3,#973db3,#9a3db3,#9d3db3,#a13db3,#a43db3,#a73cb3,#aa3cb2,#ae3cb2,#b13cb2,#b43cb1,#b73cb0,#ba3cb0,#be3caf,#c13dae,#c43dad,#c73dac,#ca3dab,#cd3daa,#d03ea9,#d33ea7,#d53ea6,#d83fa4,#db3fa3,#de3fa1,#e040a0,#e3409e,#e5419c,#e8429a,#ea4298,#ed4396,#ef4494,#f14592,#f34590,#f5468e,#f7478c,#f9488a,#fb4987,#fd4a85,#fe4b83,#ff4d80,#ff4e7e,#ff4f7b,#ff5079,#ff5276,#ff5374,#ff5572,#ff566f,#ff586d,#ff596a,#ff5b68,#ff5d65,#ff5e63,#ff6060,#ff625e,#ff645b,#ff6659,#ff6857,#ff6a54,#ff6c52,#ff6e50,#ff704e,#ff724c,#ff744a,#ff7648,#ff7946,#ff7b44,#ff7d42,#ff8040,#ff823e,#ff843d,#ff873b,#ff893a,#ff8c38,#ff8e37,#fe9136,#fd9334,#fb9633,#f99832,#f89b32,#f69d31,#f4a030,#f2a32f,#f0a52f,#eea82f,#ecaa2e,#eaad2e,#e8b02e,#e6b22e,#e4b52e,#e2b72f,#e0ba2f,#debc30,#dbbf30,#d9c131,#d7c432,#d5c633,#d3c934,#d1cb35,#cece36,#ccd038,#cad239,#c8d53b,#c6d73c,#c4d93e,#c2db40,#c0dd42,#bee044,#bce247,#bae449,#b8e64b,#b6e84e,#b5ea51,#b3eb53,#b1ed56,#b0ef59,#adf05a,#aaf159,#a6f159,#a2f258,#9ef258,#9af357,#96f357,#93f457,#8ff457,#8bf457,#87f557,#83f557,#80f558,#7cf658,#78f659,#74f65a,#71f65b,#6df65c,#6af75d,#66f75e,#63f75f,#5ff761,#5cf662,#59f664,#55f665,#52f667,#4ff669,#4cf56a,#49f56c,#46f46e,#43f470,#41f373,#3ef375,#3bf277,#39f279,#37f17c,#34f07e,#32ef80,#30ee83,#2eed85,#2cec88,#2aeb8a,#28ea8d,#27e98f,#25e892,#24e795,#22e597,#21e49a,#20e29d,#1fe19f,#1edfa2,#1ddea4,#1cdca7,#1bdbaa,#1bd9ac,#1ad7af,#1ad5b1,#1ad4b4,#19d2b6,#19d0b8,#19cebb,#19ccbd,#19cabf,#1ac8c1,#1ac6c4,#1ac4c6,#1bc2c8,#1bbfca,#1cbdcc,#1dbbcd,#1db9cf,#1eb6d1,#1fb4d2,#20b2d4,#21afd5,#22add7,#23abd8,#25a8d9,#26a6db,#27a4dc,#29a1dd,#2a9fdd,#2b9cde,#2d9adf,#2e98e0,#3095e0,#3293e1,#3390e1,#358ee1,#378ce1,#3889e1,#3a87e1,#3c84e1,#3d82e1,#3f80e1,#417de0,#437be0,#4479df,#4676df,#4874de,#4a72dd,#4b70dc,#4d6ddb,#4f6bda,#5169d9,#5267d7,#5465d6,#5663d5,#5761d3,#595fd1,#5a5dd0,#5c5bce,#5d59cc,#5f57ca,#6055c8,#6153c6,#6351c4,#6450c2,#654ec0,#664cbe,#674abb,#6849b9,#6a47b7,#6a46b4,#6b44b2,#6c43af,#6d41ad,#6e40aa); 
}

div.note {
    padding: 1.2rem 1.3rem;
    background-color: #f1ecc3;
    border: 1px solid #867221;
}
&lt;/style&gt;

&lt;p&gt;&lt;img src="/assets/images/2024/img-gen-comp-cover.jpeg" style="max-width:800px; width:100%"&gt;&lt;/p&gt;
&lt;p&gt;Did you know that AI can now create images that are indistinguishable from those taken by top photographers or created by great designers? Not all AI models are created equal in this regard, this post aims to shed light on those that truly stand out in the world of image generation.&lt;/p&gt;
&lt;p&gt;AI image generation started to take off in January 2022 when OpenAI launched their DALLE-2 model, then Midjourney launched their V4 model and Stability AI introduced and open-sourced Stable Diffusion 1.5. Those were all good models that shocked the world with their capabilities. &lt;/p&gt;
&lt;p&gt;But things got really exciting in 2023 with OpenAI&amp;rsquo;s DALLE-3, Midjourney&amp;rsquo;s V5 then V6, and Stable Diffusion&amp;rsquo;s SDXL. &lt;/p&gt;
&lt;p&gt;In this post, I&amp;rsquo;ll compare &lt;strong&gt;Midjourney V6, Midjourney V5.2, DALLE-3, and SDXL&lt;/strong&gt;. I&amp;rsquo;ll use different prompts (taken from public galleries) that cover many aspects, like photorealism, illustrations, imagining a new concept, logo creation, ability to show text, ability to follow details in the prompt. The comparison is comprised of &lt;strong&gt;52 prompts&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For each prompt, I&amp;rsquo;ll score each model&amp;rsquo;s generation out of 10, a score based on objective factors (like generation quality, following details, etc.) and subjective factors based on how I perceive the image and its aesthetics. I understand that the objective factors can have subjective elements as well, but at the end, these are just my scores :).&lt;/p&gt;
&lt;p&gt;Note that for all the models I show 4 images per prompt except for SDXL where I show 1 image because it was faster for me to do it this way. After testing, I believe this approach doesn&amp;rsquo;t compromise the quality or fairness of the comparison; when you use these models to generate multiple images, the images tend to be similar and of the same quality.&lt;/p&gt;
&lt;p&gt;For the generation, for Midjourney models, I used their Discord interface. For DALLE-3, I used &lt;a href="https://www.bing.com/images/create"&gt;Microsoft Image Creator&lt;/a&gt;. For SDXL, I used &lt;a href="https://replicate.com/stability-ai/sdxl"&gt;the official Stability AI&amp;rsquo;s offering on Replicate&lt;/a&gt; with default settings except for steps (I used 60) and size (I used 1024 x 1024).&lt;/p&gt;
&lt;p&gt;Feel free to skip to the &lt;a href="#conclusion"&gt;end of the post&lt;/a&gt; to see the results, but I encourage you to take a look at the images and enjoy watching the magic of AI image generation.&lt;/p&gt;
&lt;p&gt;Now &lt;strong&gt;let&amp;rsquo;s get started&lt;/strong&gt; with the comparison&amp;hellip;&lt;/p&gt;
&lt;h3 id="prompt-1"&gt;Prompt #1&lt;/h3&gt;
&lt;p&gt;zen modern bauhaus abstract design with boho influence. Minimalistic and symmetrical, abundance of consistently-equal lines and only 1 shape, yellow-garnet and cream colour balance, spacious and breathability&lt;/p&gt;
&lt;h3 id="midjourney-v6-810"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-mj-1" src="/assets/images/2024/gc-mj-1.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-610"&gt;Midjourney V5.2 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-mj5-1" src="/assets/images/2024/gc-mj5-1.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-310"&gt;SDXL (3/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-sdxl-1" src="/assets/images/2024/gc-sdxl-1.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-510"&gt;DALLE-3 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-dl-1" src="/assets/images/2024/gc-dl-1.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-2"&gt;Prompt #2&lt;/h3&gt;
&lt;p&gt;Sad alien smoking, sitting on a ground, An alien ship crashed into the ground, desert &lt;/p&gt;
&lt;h3 id="midjourney-v6-710"&gt;Midjourney V6 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-mj-2" src="/assets/images/2024/gc-mj-2.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-610_1"&gt;Midjourney V5.2 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-mj5-2" src="/assets/images/2024/gc-mj5-2.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-410"&gt;SDXL (4/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-sdxl-2" src="/assets/images/2024/gc-sdxl-2.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="gc-dl-2" src="/assets/images/2024/gc-dl-2.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-3"&gt;Prompt #3&lt;/h3&gt;
&lt;p&gt;minimalism ,a delicate golden sailboat, sailing on translucent jade water with fluorescent purple, 3D,fluorescent green, light blue, light green, gold accents,spathoid, color gradients, fusion, flowing water pattern shapes, overhead, ultra wide Angle, Bright colors, color art, detail UHD,16K&lt;/p&gt;
&lt;h3 id="midjourney-v6-9510"&gt;Midjourney V6 (9.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="53-gc-mj6" src="/assets/images/2024/53-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-6510"&gt;DALLE-3 (6.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="53-gc-dl" src="/assets/images/2024/53-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-4"&gt;Prompt #4&lt;/h3&gt;
&lt;p&gt;fried egg flowers in the bacon garden shallow depth of field, highly detailed, high budget, bokeh, film grain, grainy&lt;/p&gt;
&lt;h3 id="midjourney-v6-610"&gt;Midjourney V6 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="4-gc-mj6" src="/assets/images/2024/4-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-510"&gt;Midjourney V5.2 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="4-gc-mj5" src="/assets/images/2024/4-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-510"&gt;SDXL (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="4-gc-sdxl" src="/assets/images/2024/4-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="4-gc-dl" src="/assets/images/2024/4-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-5"&gt;Prompt #5&lt;/h3&gt;
&lt;p&gt;Illuminated (&amp;ldquo;The moon, a silver boat, sails through the sea of stars, painting dreams on the night sky.&amp;rdquo;:1.2) , Suffering, hillside, Cubism, side lit, Selective focus, Kodachrome, gilded technique, Batik&lt;/p&gt;
&lt;h3 id="midjourney-v6-710_1"&gt;Midjourney V6 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="5-gc-mj6" src="/assets/images/2024/5-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-810"&gt;Midjourney V5.2 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="5-gc-mj5" src="/assets/images/2024/5-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-410_1"&gt;SDXL (4/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="5-gc-sdxl" src="/assets/images/2024/5-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-410"&gt;DALLE-3 (4/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="5-gc-dl" src="/assets/images/2024/5-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-6"&gt;Prompt #6&lt;/h3&gt;
&lt;p&gt;circuitboard egyptian pyramid, ((focus))&lt;/p&gt;
&lt;h3 id="midjourney-v6-910"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="6-gc-mj6" src="/assets/images/2024/6-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-710"&gt;Midjourney V5.2 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="6-gc-mj5" src="/assets/images/2024/6-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-510_1"&gt;SDXL (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="6-gc-sdxl" src="/assets/images/2024/6-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_1"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="6-gc-dl" src="/assets/images/2024/6-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-7"&gt;Prompt #7&lt;/h3&gt;
&lt;p&gt;A man stands in the wilderness, blue dot light spinning, Vincent van Gogh&amp;rsquo;s painting style, pointillism style, magnificent landscapes, illustrations, negative space, intagliography, art, minimalism&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_1"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="7-gc-mj6" src="/assets/images/2024/7-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-810_1"&gt;Midjourney V5.2 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="7-gc-mj5" src="/assets/images/2024/7-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-310_1"&gt;SDXL (3/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="7-gc-sdxl" src="/assets/images/2024/7-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_1"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="7-gc-dl" src="/assets/images/2024/7-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-8"&gt;Prompt #8&lt;/h3&gt;
&lt;p&gt;An illustration of an avocado sitting in a therapist&amp;rsquo;s chair, saying &amp;lsquo;I just feel so empty inside&amp;rsquo; with a pit-sized hole in its center. The therapist, a spoon, scribbles notes.&lt;/p&gt;
&lt;h3 id="midjourney-v6-610_1"&gt;Midjourney V6 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="8-gc-mj6" src="/assets/images/2024/8-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-310"&gt;Midjourney V5.2 (3/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="8-gc-mj5" src="/assets/images/2024/8-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-310_2"&gt;SDXL (3/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="8-gc-sdxl" src="/assets/images/2024/8-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_2"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="8-gc-dl" src="/assets/images/2024/8-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-9"&gt;Prompt #9&lt;/h3&gt;
&lt;p&gt;A 2D animation of a folk music band composed of anthropomorphic autumn leaves, each playing traditional bluegrass instruments, amidst a rustic forest setting dappled with the soft light of a harvest moon. &lt;/p&gt;
&lt;h3 id="midjourney-v6-6510"&gt;Midjourney V6 (6.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="9-gc-mj6" src="/assets/images/2024/9-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-510_1"&gt;Midjourney V5.2 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="9-gc-mj5" src="/assets/images/2024/9-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-2510"&gt;SDXL (2.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="9-gc-sdxl" src="/assets/images/2024/9-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-1010"&gt;DALLE-3 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="9-gc-dl" src="/assets/images/2024/9-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-10"&gt;Prompt #10&lt;/h3&gt;
&lt;p&gt;Photo of a lychee-inspired spherical chair, with a bumpy white exterior and plush interior, set against a tropical wallpaper.&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_1"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="10-gc-mj6" src="/assets/images/2024/10-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="midjourney-v52-6510"&gt;Midjourney V5.2 (6.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="10-gc-mj5" src="/assets/images/2024/10-gc-mj5.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="sdxl-410_2"&gt;SDXL (4/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="10-gc-sdxl" src="/assets/images/2024/10-gc-sdxl.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-910"&gt;DALLE-3 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="10-gc-dl" src="/assets/images/2024/10-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;div class="note"&gt;
Looking at the results of the 10 prompts above, I thought that I can proceed with Midjourney V6 and DALLE-3 only. SDXL generations seem ugly or very low quality compared to others. Midjourney V5.2 is almost always inferior to its successor (V6). So it makes sense to exclude these two for the rest of this comparison and focus on the top models.
&lt;/div&gt;

&lt;h3 id="prompt-11"&gt;Prompt #11&lt;/h3&gt;
&lt;p&gt;An expressive oil painting of a basketball player dunking, depicted as an explosion of a nebula&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_2"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="11-gc-mj6" src="/assets/images/2024/11-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_3"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="11-gc-dl" src="/assets/images/2024/11-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-12"&gt;Prompt #12&lt;/h3&gt;
&lt;p&gt;An ink sketch style illustration of a small hedgehog holding a piece of watermelon with its tiny paws, taking little bites with its eyes closed in delight.&lt;/p&gt;
&lt;h3 id="midjourney-v6-710_2"&gt;Midjourney V6 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="12-gc-mj6" src="/assets/images/2024/12-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-8510"&gt;DALLE-3 (8.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="12-gc-dl" src="/assets/images/2024/12-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-13"&gt;Prompt #13&lt;/h3&gt;
&lt;p&gt;A vintage travel poster for Venus in portrait orientation. The scene portrays the thick, yellowish clouds of Venus with a silhouette of a vintage rocket ship approaching. Mysterious shapes hint at mountains and valleys below the clouds. The bottom text reads, &amp;lsquo;Explore Venus: Beauty Behind the Mist&amp;rsquo;. The color scheme consists of golds, yellows, and soft oranges, evoking a sense of wonder.&lt;/p&gt;
&lt;h3 id="midjourney-v6-510"&gt;Midjourney V6 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="13-gc-mj6" src="/assets/images/2024/13-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="13-gc-dl" src="/assets/images/2024/13-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-14"&gt;Prompt #14&lt;/h3&gt;
&lt;p&gt;Tiny potato kings wearing majestic crowns, sitting on thrones, overseeing their vast potato kingdom filled with potato subjects and potato castles.&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_3"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="14-gc-mj6" src="/assets/images/2024/14-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-6510_1"&gt;DALLE-3 (6.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="14-gc-dl" src="/assets/images/2024/14-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-15"&gt;Prompt #15&lt;/h3&gt;
&lt;p&gt;A stylized portrait-oriented depiction where a tiger serves as the dividing line between two contrasting worlds. To the left, fiery reds and oranges dominate as flames consume trees. To the right, a rejuvenated forest flourishes with fresh green foliage. The tiger, depicted with exaggerated and artistic features, stands tall and undeterred, symbolizing nature’s enduring spirit amidst chaos and rebirth.&lt;/p&gt;
&lt;h3 id="midjourney-v6-8510"&gt;Midjourney V6 (8.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="15-gc-mj6" src="/assets/images/2024/15-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-5510"&gt;DALLE-3 (5.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="15-gc-dl" src="/assets/images/2024/15-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-16"&gt;Prompt #16&lt;/h3&gt;
&lt;p&gt;A 3D render of a coffee mug placed on a window sill during a stormy day. The storm outside the window is reflected in the coffee, with miniature lightning bolts and turbulent waves seen inside the mug. The room is dimly lit, adding to the dramatic atmosphere.&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_4"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="16-gc-mj6" src="/assets/images/2024/16-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="16-gc-dl" src="/assets/images/2024/16-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-17"&gt;Prompt #17&lt;/h3&gt;
&lt;p&gt;An illustration of a human heart made of translucent glass, standing on a pedestal amidst a stormy sea. Rays of sunlight pierce the clouds, illuminating the heart, revealing a tiny universe within. The quote &amp;lsquo;Find the universe within you&amp;rsquo; is etched in bold letters across the horizon. &lt;/p&gt;
&lt;h3 id="midjourney-v6-7510"&gt;Midjourney V6 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="17-gc-mj6" src="/assets/images/2024/17-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510_1"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="17-gc-dl" src="/assets/images/2024/17-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-18"&gt;Prompt #18&lt;/h3&gt;
&lt;p&gt;An antique botanical illustration drawn with fine lines and a touch of watercolour whimsy, depicting a strange lily crossed with a Venus flytrap, its petals poised as if ready to snap shut on any unsuspecting insects.&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_2"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="18-gc-mj6" src="/assets/images/2024/18-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_1"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="18-gc-dl" src="/assets/images/2024/18-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-19"&gt;Prompt #19&lt;/h3&gt;
&lt;p&gt;A vibrant yellow banana-shaped couch sits in a cozy living room, its curve cradling a pile of colorful cushions. on the wooden floor, a patterned rug adds a touch of eclectic charm, and a potted plant sits in the corner, reaching towards the sunlight filtering through the window. &lt;/p&gt;
&lt;h3 id="midjourney-v6-8510_1"&gt;Midjourney V6 (8.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="19-gc-mj6" src="/assets/images/2024/19-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510_2"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="19-gc-dl" src="/assets/images/2024/19-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-20"&gt;Prompt #20&lt;/h3&gt;
&lt;p&gt;A minimalist, logo featuring a sleek and stylized black falcon head against a white background awesome, professional, vector logo, simple&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="20-gc-mj6" src="/assets/images/2024/20-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-8510_1"&gt;DALLE-3 (8.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="20-gc-dl" src="/assets/images/2024/20-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-21"&gt;Prompt #21&lt;/h3&gt;
&lt;p&gt;Create cool Asian Design red white black with tress and The Moon&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_1"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="21-gc-mj6" src="/assets/images/2024/21-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_2"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="21-gc-dl" src="/assets/images/2024/21-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-22"&gt;Prompt #22&lt;/h3&gt;
&lt;p&gt;ornaments on a manuscript, cohesive colors of crimson and golden, geometry art, sacred ratios&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_2"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="22-gc-mj6" src="/assets/images/2024/22-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510_3"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="22-gc-dl" src="/assets/images/2024/22-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-23"&gt;Prompt #23&lt;/h3&gt;
&lt;p&gt;a chicken in a suit&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_3"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="23-gc-mj6" src="/assets/images/2024/23-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_4"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="23-gc-dl" src="/assets/images/2024/23-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-24"&gt;Prompt #24&lt;/h3&gt;
&lt;p&gt;a real photo of a Luminescent radiant sun, black background &lt;/p&gt;
&lt;h3 id="midjourney-v6-910_3"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="24-gc-mj6" src="/assets/images/2024/24-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_5"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="24-gc-dl" src="/assets/images/2024/24-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-25"&gt;Prompt #25&lt;/h3&gt;
&lt;p&gt;A man standing in the street, golden hour, 1990s&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_4"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="25-gc-mj6" src="/assets/images/2024/25-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_2"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="25-gc-dl" src="/assets/images/2024/25-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-26"&gt;Prompt #26&lt;/h3&gt;
&lt;p&gt;STICKER, popping art, company building collage art, white background,.jpeg transparent, colorful, color shading&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_4"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="26-gc-mj6" src="/assets/images/2024/26-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510_4"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="26-gc-dl" src="/assets/images/2024/26-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-27"&gt;Prompt #27&lt;/h3&gt;
&lt;p&gt;mindface electrical diagram. Cellular marble cutaway by junji ito, Akira toriyama, Jean Leon Gerome&lt;/p&gt;
&lt;h3 id="midjourney-v6-9510_1"&gt;Midjourney V6 (9.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="27-gc-mj6" src="/assets/images/2024/27-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_3"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="27-gc-dl" src="/assets/images/2024/27-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-28"&gt;Prompt #28&lt;/h3&gt;
&lt;p&gt;Anthropomorphic lion wearing a ski jumpsuit and gloves standing in the snow&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_5"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="28-gc-mj6" src="/assets/images/2024/28-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_3"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="28-gc-dl" src="/assets/images/2024/28-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-29"&gt;Prompt #29&lt;/h3&gt;
&lt;p&gt;a man in high-fashion campaign for Balmain jewelry, glittercore long exposure beauty shot in gigantic mirror prism, hundreds of reflections. Utilize 50mm lens, full-frame camera with a depth of field set to 16f and shutter speed at 4 seconds, dynamic compositions and storytelling, ensuring the scene captivates with both fashion finesse and narrative intrigue&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_6"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="29-gc-mj6" src="/assets/images/2024/29-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_4"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="29-gc-dl" src="/assets/images/2024/29-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-30"&gt;Prompt #30&lt;/h3&gt;
&lt;p&gt;ultramodern minimal living room with colorful ammolite stone pattern floor, colorful ammolite stone pattern floor&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_7"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="30-gc-mj6" src="/assets/images/2024/30-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510_5"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="30-gc-dl" src="/assets/images/2024/30-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-31"&gt;Prompt #31&lt;/h3&gt;
&lt;p&gt;colorful dark baroque-inspired graphic fantasy novel illustration on rough paper, vintage poster style oil on canvas with expressive brush strokes and visible canvas weave texture minimalist cartoon illustration surrealism&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_5"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="31-gc-mj6" src="/assets/images/2024/31-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_5"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="31-gc-dl" src="/assets/images/2024/31-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-32"&gt;Prompt #32&lt;/h3&gt;
&lt;p&gt;Floral bouquet ornament frame background with Watercolor, isolated white background ,cartoon style, thick line,low detail,no shading&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_5"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="32-gc-mj6" src="/assets/images/2024/32-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_6"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="32-gc-dl" src="/assets/images/2024/32-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-33"&gt;Prompt #33&lt;/h3&gt;
&lt;p&gt;Based on the movie - Ferris Beuller’s Day Off - Cameron&amp;rsquo;s House - Model: Teen boy, pensive look, dark hair. - Clothing: Preppy sweater, collared shirt, khakis. - Shoes: Classic loafers. - Background: Darker, moody room, 80s memorabilia. - Mood: Reluctant, worried. - Camera: Nikon Z7, full-body shot. - Lighting: Dim, soft light. - Angle: Slightly high, showing the room&amp;rsquo;s depth. Shot should be hyper-realistic and cinematic, capturing the essence of the iconic film while showcasing the 80s inspired fashion in a full-body, distance photograph. HYPER REALISTIC PHOTOGRAPH - FULL BODY IMAGE - MUST SHOW SHOES&lt;/p&gt;
&lt;h3 id="midjourney-v6-8510_2"&gt;Midjourney V6 (8.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="33-gc-mj6" src="/assets/images/2024/33-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-510_1"&gt;DALLE-3 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="33-gc-dl" src="/assets/images/2024/33-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-34"&gt;Prompt #34&lt;/h3&gt;
&lt;p&gt;sheep pasture, portrait of a young man, small geometrically cut photo collage, distorted, broken, fragmented maximalist, Picasso, very detailed&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_8"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="34-gc-mj6" src="/assets/images/2024/34-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_7"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="34-gc-dl" src="/assets/images/2024/34-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-35"&gt;Prompt #35&lt;/h3&gt;
&lt;p&gt;ethereal, contemporary portrait photograph, a man&amp;rsquo;s contemplative face partially emerges from deep shadows, surrounded by a soft blur. The muted orange tones envelop the subject, while a prism-like rainbow spectrum highlights his eye, invoking a sense of mystery. The composition leverages the interplay of light and shadow, creating a dynamic yet introspective mood&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_9"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="35-gc-mj6" src="/assets/images/2024/35-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_4"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="35-gc-dl" src="/assets/images/2024/35-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-36"&gt;Prompt #36&lt;/h3&gt;
&lt;p&gt;abstract art by Mondrian with solid lines and blocks of color, there are illustrated cats placed in the colored boxes in various cute poses&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_10"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="36-gc-mj6" src="/assets/images/2024/36-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_5"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="36-gc-dl" src="/assets/images/2024/36-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-37"&gt;Prompt #37&lt;/h3&gt;
&lt;p&gt;mushrooms different varieties watercolor&lt;/p&gt;
&lt;h3 id="midjourney-v6-9510_2"&gt;Midjourney V6 (9.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="37-gc-mj6" src="/assets/images/2024/37-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_6"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="37-gc-dl" src="/assets/images/2024/37-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-38"&gt;Prompt #38&lt;/h3&gt;
&lt;p&gt;the most beautiful picture on earth&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_6"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="38-gc-mj6" src="/assets/images/2024/38-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-510_2"&gt;DALLE-3 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="38-gc-dl" src="/assets/images/2024/38-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-39"&gt;Prompt #39&lt;/h3&gt;
&lt;p&gt;logo of two letters &amp;ldquo;AI&amp;rdquo; in Knitted STYLE&lt;/p&gt;
&lt;h3 id="midjourney-v6-7510_1"&gt;Midjourney V6 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="39-gc-mj6" src="/assets/images/2024/39-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-8510_2"&gt;DALLE-3 (8.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="39-gc-dl" src="/assets/images/2024/39-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-40"&gt;Prompt #40&lt;/h3&gt;
&lt;p&gt;Gold coins were scattered on the wet rock steps, and a golden sunshine shone down on an area, reflecting the glittering gold,Photorealistic, Global Illumination, 32k, Ray Tracing Ambient Occlusion, Hyperrealistic&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_11"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="40-gc-mj6" src="/assets/images/2024/40-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_7"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="40-gc-dl" src="/assets/images/2024/40-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-41"&gt;Prompt #41&lt;/h3&gt;
&lt;p&gt;this logo won the best logo of all time award&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_7"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="41-gc-mj6" src="/assets/images/2024/41-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_8"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="41-gc-dl" src="/assets/images/2024/41-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-42"&gt;Prompt #42&lt;/h3&gt;
&lt;p&gt;a logo for a software for quality managers using the quality colorus red, green and orange as well as underline the brand values: undestanding, relationship and dependability as well as the characteristics friendly, easy, masculine, serious and industrial&lt;/p&gt;
&lt;h3 id="midjourney-v6-710_3"&gt;Midjourney V6 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="42-gc-mj6" src="/assets/images/2024/42-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-310"&gt;DALLE-3 (3/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="42-gc-dl" src="/assets/images/2024/42-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-43"&gt;Prompt #43&lt;/h3&gt;
&lt;p&gt;a simple vector art symbol logo for a flower and fire,, and war. No color. No watermark. White background, black lines only. Simple line art.&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_6"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="43-gc-mj6" src="/assets/images/2024/43-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_8"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="43-gc-dl" src="/assets/images/2024/43-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-44"&gt;Prompt #44&lt;/h3&gt;
&lt;p&gt;a sharply-focused black and white painting based on a squared-shaped face with various surrounding geometric shapes, in the style of hundertwasser, in the style of elke trittel, mechanical whimsy, columns and totems, mixed-media sculptor, folk art painting, yaka art, collage and mixed media&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_7"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="44-gc-mj6" src="/assets/images/2024/44-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-510_3"&gt;DALLE-3 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="44-gc-dl" src="/assets/images/2024/44-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-45"&gt;Prompt #45&lt;/h3&gt;
&lt;p&gt;a complex logo for a university named Princess X for Science&lt;/p&gt;
&lt;h3 id="midjourney-v6-710_4"&gt;Midjourney V6 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="45-gc-mj6" src="/assets/images/2024/45-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_6"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="45-gc-dl" src="/assets/images/2024/45-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-46"&gt;Prompt #46&lt;/h3&gt;
&lt;p&gt;Risographic style geometric&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_12"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="46-gc-mj6" src="/assets/images/2024/46-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-6510_2"&gt;DALLE-3 (6.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="46-gc-dl" src="/assets/images/2024/46-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-47"&gt;Prompt #47&lt;/h3&gt;
&lt;p&gt;An abstract work of art consisting of various geometric figures, vignetting photography, photo grade, 2K, hyper quality&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_13"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="47-gc-mj6" src="/assets/images/2024/47-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-610_9"&gt;DALLE-3 (6/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="47-gc-dl" src="/assets/images/2024/47-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-48"&gt;Prompt #48&lt;/h3&gt;
&lt;p&gt;Create an illustration of a protractor, a triangle, and a square. Use simple shapes and clear lines.&lt;/p&gt;
&lt;h3 id="midjourney-v6-810_8"&gt;Midjourney V6 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="48-gc-mj6" src="/assets/images/2024/48-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-710_7"&gt;DALLE-3 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="48-gc-dl" src="/assets/images/2024/48-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-49"&gt;Prompt #49&lt;/h3&gt;
&lt;p&gt;universe&lt;/p&gt;
&lt;h3 id="midjourney-v6-910_8"&gt;Midjourney V6 (9/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="49-gc-mj6" src="/assets/images/2024/49-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-810_9"&gt;DALLE-3 (8/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="49-gc-dl" src="/assets/images/2024/49-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-50"&gt;Prompt #50&lt;/h3&gt;
&lt;p&gt;There is a yellow bird in the middle of the black flock, comic&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_14"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="50-gc-mj6" src="/assets/images/2024/50-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-7510_6"&gt;DALLE-3 (7.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="50-gc-dl" src="/assets/images/2024/50-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-51"&gt;Prompt #51&lt;/h3&gt;
&lt;p&gt;Pareidolia, scifi pulp magazine style, by Lisa Frank&lt;/p&gt;
&lt;h3 id="midjourney-v6-710_5"&gt;Midjourney V6 (7/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="51-gc-mj6" src="/assets/images/2024/51-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-510_4"&gt;DALLE-3 (5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="51-gc-dl" src="/assets/images/2024/51-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="prompt-52"&gt;Prompt #52&lt;/h3&gt;
&lt;p&gt;Drawing on paper with colored pencils. The kitten is cute cartoon, smiling and sitting on the grass. Against the background of the landscape&lt;/p&gt;
&lt;h3 id="midjourney-v6-1010_15"&gt;Midjourney V6 (10/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="52-gc-mj6" src="/assets/images/2024/52-gc-mj6.jpeg"&gt;&lt;/p&gt;
&lt;h3 id="dalle-3-6510_3"&gt;DALLE-3 (6.5/10)&lt;/h3&gt;
&lt;p&gt;&lt;img alt="52-gc-dl" src="/assets/images/2024/52-gc-dl.jpeg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;div id="conclusion"&gt;&lt;/div&gt;
&lt;h1 id="conclusion"&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;My rating of the tested models:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;🥇Midjourney V6&lt;/strong&gt;: What a great model! I still can&amp;rsquo;t believe we are at a time where we can generate such beautiful and high quality images using AI. If you are looking for beauty, quality, and/or photorealism, this model is your first choice.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DALLE-3&lt;/strong&gt;: This model has less aesthetic outputs than Midjourney but its power lies in its ability to 1) follow details in the prompt which it does better than Midjourney in some cases and 2) deal with text almost perfectly. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Midjourney V5.2&lt;/strong&gt;: Good model but in most cases, V6 gives better images.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SDXL&lt;/strong&gt;: I was a fan of Stability AI&amp;rsquo;s models since 1.5 because they&amp;rsquo;re open source, but when I compare SDXL to Midjourney and DALLE-3, especially the former, the quality gap is VERY wide. However, because SDXL is open source, there are some powerful things you can do with it that you can&amp;rsquo;t do with the other models. For example, you can fine-tune it to generate images in a specific style or you can use Controlnet to control the generation process in many ways.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h5 id="disclaimers"&gt;Disclaimers&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;I don&amp;rsquo;t claim to compare all top models available. For example, I&amp;rsquo;m using SDXL which is at the pinnacle of open-source models. I know that there are so many SDXL fine-tunings out there that might be better in some areas, but my thinking is that SDXL will capture the essence of those fine-tunings because it&amp;rsquo;s their base.&lt;/li&gt;
&lt;li&gt;As mentioned above, I used prompts collected from different communities. I don&amp;rsquo;t understand every single term used in these prompts, but I understand most of them after spending a lot of time generating images with these models since their launch.&lt;/li&gt;
&lt;/ul&gt;</content><category term="data-science"/><category term="midjourney"/><category term="stable diffusion"/><category term="dalle"/></entry><entry><title>My notes from The Hundred Years' War on Palestine</title><link href="https://ammar-alyousfi.com/2024/the-hundred-years-war-on-palestine-book-notes.html" rel="alternate"/><published>2024-01-06T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2024-01-06:/2024/the-hundred-years-war-on-palestine-book-notes.html</id><summary type="html">&lt;p&gt;Book Full Title: The Hundred Years&amp;rsquo; War on Palestine: A History of Settler-Colonial Conquest and Resistance, 1917-2017.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2024/the-hundre-years-war-cover.jpeg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/en/book/show/41812831"&gt;The Hundred Years&amp;rsquo; War on Palestine: A History of Settler-Colonial Conquest and Resistance, 1917-2017&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in A Paragraph&lt;/h2&gt;
&lt;p&gt;The book talks about the history of the conflict in today …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Book Full Title: The Hundred Years&amp;rsquo; War on Palestine: A History of Settler-Colonial Conquest and Resistance, 1917-2017.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2024/the-hundre-years-war-cover.jpeg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/en/book/show/41812831"&gt;The Hundred Years&amp;rsquo; War on Palestine: A History of Settler-Colonial Conquest and Resistance, 1917-2017&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in A Paragraph&lt;/h2&gt;
&lt;p&gt;The book talks about the history of the conflict in today&amp;rsquo;s Palestine and Israel since its beginning in the 19th century. The author is a professor of modern Arab studies at Columbia university; the book cites many authentic sources and archival materials. The book is divided into parts where each part talks about a significant period of time in the conflict. &lt;/p&gt;
&lt;h2 id="impressions"&gt;Impressions&lt;/h2&gt;
&lt;p&gt;I started reading the book after the current episode of the conflict started in October 2023. Although I&amp;rsquo;m familiar with the situation as I&amp;rsquo;m from the region, this book gave me a lot of new information about the history of the conflict. I liked that it cites many references including many western and Israeli sources and archives, not only Palestinian and Arabic sources. I think it&amp;rsquo;s a must-read for anyone who wants to understand the conflict and its important history.&lt;/p&gt;
&lt;h2 id="my-notes"&gt;My Notes&lt;/h2&gt;
&lt;p&gt;I took a lot of notes while reading the book: it was filled with important details and historical material that are essential to understanding the conflict as a whole with the right context. So I ended up with 64 pages of notes! I thought it&amp;rsquo;s not practical to share all of them here in a blog post. So I used GPT-4 on ChatGPT to summarize the notes of each chapter in quick bullet points. They give a good idea about what the chapter is about. However, they are definitely not a replacement for reading the book.&lt;/p&gt;
&lt;p&gt;Here are the AI summarized notes from each chapter.&lt;/p&gt;
&lt;h3 id="introduction"&gt;Introduction&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Early Zionist Congresses&lt;/strong&gt;: The first two Zionist congresses occurred in Basel, Switzerland, in 1897 and 1898, marking the formal beginning of the Zionist movement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;European Jewish Settlers in Palestine&lt;/strong&gt;: The earliest European Jewish settlers arrived in Palestine in the late 1870s and early 1880s, beginning the process of Jewish immigration to the region.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Theodore Herzl&amp;rsquo;s Views&lt;/strong&gt;: Theodore Herzl, the founder of Zionism, contemplated the colonization of Palestine as early as 1895. He considered the gentle expropriation of private property and the discreet removal of the impoverished local population to facilitate Jewish settlement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestine as a Colonial War Zone&lt;/strong&gt;: The author shows the history of Palestine as a colonial war against the indigenous population, driven by various parties aiming to establish another people in the region against the will of the locals.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Zionism&amp;rsquo;s Biblical Appeal&lt;/strong&gt;: Zionism, seen as a colonial-national movement, gained support particularly in Great Britain and the United States due to its biblical connections, which overshadowed its modern, colonial nature.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Misrepresentation of Palestine&amp;rsquo;s History&lt;/strong&gt;: There is a significant amount of literature attempting to portray pre-Zionist colonization Palestine as barren, empty, and backward, often riddled with historical inaccuracies and bigotry.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Herzl&amp;rsquo;s Reference to Palestinian Arabs&lt;/strong&gt;: In a letter to Yusuf Diya, Herzl referred to Palestinian Arabs, who constituted about 95% of the local population, as the &amp;ldquo;non-Jewish population.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The 1917 Balfour Declaration&lt;/strong&gt;: This British cabinet declaration committed to the creation of a Jewish homeland in Palestine but failed to mention the Palestinian majority. This omission set the course for the region&amp;rsquo;s future.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Denial of Palestinian Existence in Literature and Culture&lt;/strong&gt;: The denial or negation of Palestinian existence is a recurrent theme in some Western and Israeli popular culture, literature, and political discourse.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Zionism&amp;rsquo;s Colonial Roots&lt;/strong&gt;: Many early Zionists, including Ze’ev Jabotinsky, openly acknowledged the colonial nature of their project. This perspective was dominant until the post-World War II era, when colonialism became widely discredited.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Zionism&amp;rsquo;s Institutional Foundations&lt;/strong&gt;: The social and economic institutions established by early Zionists, essential to the movement&amp;rsquo;s success, were understood and described as colonial. The Jewish Colonization Association was a key example.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rebranding of Zionism&lt;/strong&gt;: Following World War II, in an era of decolonization, Zionism and Israel distanced themselves from their colonial origins. Zionism, previously supported by British colonialism, rebranded itself as an anti-colonial movement, especially after the British limited Jewish immigration with the 1939 White Paper.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="1-the-first-declaration-of-war-19171939"&gt;1. The First Declaration of War, 1917–1939&lt;/h3&gt;
&lt;p&gt;The chapter &amp;ldquo;The First Declaration of War, 1917–1939&amp;rdquo; from the book &amp;ldquo;The Hundred Years&amp;rsquo; War on Palestine&amp;rdquo; discusses the impacts of World War I and subsequent British policies on Palestine, leading to a prolonged conflict with the Palestinian people.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ottoman Empire&amp;rsquo;s Heavy Losses in WWI:&lt;/strong&gt; The Ottoman Empire suffered the heaviest losses of any major combatant in WWI, with over three million deaths, mostly civilians. This included the Armenian, Assyrian, and other Christian massacres.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Experience of Ottoman Rule&amp;rsquo;s End:&lt;/strong&gt; Palestinians, after 400 years under Ottoman rule, faced the disconcerting shift to alien rule and learned of the Balfour Declaration amidst great suffering and loss.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Balfour Declaration (1917):&lt;/strong&gt; The British cabinet, led by Arthur James Balfour, expressed support for a Jewish national home in Palestine, promising only civil and religious rights to the non-Jewish communities. This declaration ignored the political or national rights of the Arab majority, who constituted 94% of the population.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;British Strategic Interests and Zionist Support:&lt;/strong&gt; Britain&amp;rsquo;s support for the Zionist movement was motivated by geopolitical strategic interests, religious sentiments, and the desire to reduce Jewish immigration to Britain. This was not an act of altruism but served Britain&amp;rsquo;s imperial ambitions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Colonial Conflict Initiated:&lt;/strong&gt; The Balfour Declaration effectively started a colonial conflict, aiming to establish a Jewish majority at the expense of the Arab population.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Reaction to Balfour Declaration:&lt;/strong&gt; The news of the declaration reached Palestinians slowly, causing shock and protest. They began to organize politically, opposing both British rule and Zionist movement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian National Identity Emergence:&lt;/strong&gt; Palestinian identity emerged in response to various stimuli, including opposition to European control and Zionism. Local newspapers and memoirs of the time reflect this growing national consciousness.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Political Efforts:&lt;/strong&gt; Palestinians held a series of congresses and established an Arab executive to demand independence and oppose the Balfour Declaration, but their efforts were largely ignored by the British.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Popular Palestinian Resistance:&lt;/strong&gt; There were multiple instances of spontaneous popular resistance against British support for Zionist aspirations, leading to demonstrations, strikes, and riots.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;League of Nations Mandate for Palestine (1922):&lt;/strong&gt; This mandate formalized British governance and amplified the Balfour Declaration, further marginalizing Palestinians by ignoring their historical connection to the land.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jewish Population Growth and Nazi Persecution:&lt;/strong&gt; The Jewish population in Palestine grew, particularly with the rise of the Nazis in Germany and the resulting Jewish immigration.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Revolt (1936-1939):&lt;/strong&gt; A massive grassroots uprising, including a six-month general strike, led to the formation of the Arab Higher Committee. The British, however, suppressed this revolt with severe force, weakening the Palestinian position significantly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;British Attempt at Appeasement (1939):&lt;/strong&gt; In response to the revolt and international pressure, Britain issued a White Paper proposing limits on Jewish immigration and land sales and promising self-determination, but these promises were not fully implemented.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Persistent British Reluctance to Modify Policy:&lt;/strong&gt; Despite Palestinian protests, British policies remained largely unchanged, influenced by obligations to the Zionists under the League of Nations Mandate.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="2-the-second-declaration-of-war-19471948"&gt;2. The Second Declaration of War, 1947–1948&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Displacement&lt;/strong&gt;: By 1949, a large portion of the Palestinian population, approximately 720,000 out of 1.3 million, became refugees due to forced displacement, with the new state of Israel emerging in the territory.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Global Power Shifts&lt;/strong&gt;: Post-World War II, the United States and the USSR emerged as dominant powers in the Middle East, influencing the Palestinian situation. The U.S., in particular, became a significant external actor in the region.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Zionist Movement and the Biltmore Program&lt;/strong&gt;: The Zionist movement, under David Ben-Gurion, anticipated this power shift. The 1942 Biltmore Program marked a pivotal moment, openly advocating for a Jewish state in Palestine, gaining significant American support and public opinion, partly due to the Holocaust&amp;rsquo;s impact.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Anglo-American Committee of Inquiry (1946)&lt;/strong&gt;: This committee&amp;rsquo;s formation and its recommendations, favoring the entry of Jewish refugees into Palestine, indicated a shift in control from Britain to the United States in the region. The Palestinians, lacking a central state system and effective allies, were at a disadvantage against the organized Jewish Agency.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;British Withdrawal and UN Intervention&lt;/strong&gt;: Britain&amp;rsquo;s diminishing role led to the UN&amp;rsquo;s involvement, with the United States and the USSR playing dominant roles. The UN&amp;rsquo;s partition plan in 1947 favored the Jewish minority, igniting further conflict.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Nakba&lt;/strong&gt;: This period saw the systematic expulsion and flight of Palestinians, termed the Nakba. Notable events included the ethnic cleansing of major Arab urban centers and massacres, such as the one in Dayr Yasin.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Israeli State Formation and Arab Response&lt;/strong&gt;: The formation of Israel on May 15, 1948, led to further military confrontations, with the new Israeli army defeating the Arab armies. The Palestinians&amp;rsquo; military and diplomatic weakness was evident.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Personal Accounts&lt;/strong&gt;: The author shares personal stories, like that of his grandparents being displaced from their home.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Israel and International Dynamics&lt;/strong&gt;: Post-1948, Israel did not immediately receive extensive American support. The United States often condemned Israeli military actions at the UN, reflecting a complex international stance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinians in Israel&lt;/strong&gt;: The minority of Palestinians who remained in Israel faced martial law and land expropriation, transforming Palestine into a predominantly Jewish state.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jordan&amp;rsquo;s Role and Regional Fear of Israel&lt;/strong&gt;: Jordan&amp;rsquo;s Arab Legion was the only effective Arab force against Israel in 1948. The Arab world&amp;rsquo;s fear of Israel&amp;rsquo;s military strength was profound.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Israeli Military Actions and International Reactions&lt;/strong&gt;: Israeli reprisals and attacks on Palestinians and their neighbors often led to UN condemnations. Notable incidents include the Qibya massacre and the Suez War of 1956, where Israel, alongside Britain and France, attacked Egypt.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Aftermath of the Suez War&lt;/strong&gt;: The Suez War&amp;rsquo;s political outcomes were unfavorable to the aggressors, with superpower pressure leading to their withdrawal. Israeli actions in Gaza during this time were condemned internationally.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="3-the-third-declaration-of-war-1967"&gt;3. The Third Declaration of War, 1967&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Misconception of Israeli Vulnerability (1967):&lt;/strong&gt; Contrary to the prevalent myth of Israel being a small, vulnerable state in 1967, the reality was different. U.S. officials, including McNamara and Johnson, acknowledged Israel&amp;rsquo;s military superiority over Arab states.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;1967 War and Military Superiority:&lt;/strong&gt; The war unfolded as predicted by the CIA and Pentagon, with Israel&amp;rsquo;s air force striking first and gaining air superiority. This advantage allowed Israel to swiftly conquer territories including the Sinai Peninsula, Gaza Strip, West Bank, Arab East Jerusalem, and the Golan Heights in six days.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Causes of the War:&lt;/strong&gt; The war&amp;rsquo;s roots lay in various factors, including the rise of Palestinian commando groups and Israel&amp;rsquo;s diversion of Jordan River waters, leading to regional tensions. Fatah&amp;rsquo;s attack on a water-pumping station in 1965 was a significant event.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Egypt’s Provocation and Israel’s Response:&lt;/strong&gt; Despite its military being stretched in the Yemeni civil war, Egypt provoked Israel by moving troops into the Sinai Peninsula and expelling UN peacekeepers, which Israel used as a casus belli for its preemptive strike.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;US and Soviet Union Roles:&lt;/strong&gt; The U.S. realigned its Middle Eastern priorities, moving closer to Israel, while the Soviet Union sought to protect its interests and allies in the region, as seen in the Security Council&amp;rsquo;s actions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security Council Resolution 242:&lt;/strong&gt; This resolution, which followed the war, emphasized the &amp;ldquo;inadmissibility of the acquisition of territory by war&amp;rdquo; but linked Israeli withdrawal to peace treaties with Arab states. Its ambiguous language left loopholes regarding the territories Israel could retain.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Erasure and Israeli Diplomacy:&lt;/strong&gt; Post-war, Israeli and international narratives often ignored or denied Palestinian identity and rights. The Palestinian struggle for recognition and rights faced significant challenges.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Resistance and PLO&amp;rsquo;s Role:&lt;/strong&gt; Palestinian resistance groups like Fatah and the PFLP played significant roles in regional politics and the evolution of the Palestinian identity. The PLO, under Arafat&amp;rsquo;s leadership, gained prominence but also faced complex strategic and diplomatic challenges.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Israeli and US Strategies:&lt;/strong&gt; Both Israel and the U.S. worked to divide and weaken Arab unity and influence, often exploiting internal Arab rivalries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assassinations and Political Violence:&lt;/strong&gt; The period saw numerous assassinations and acts of violence, including those targeting Palestinian leaders and figures by various parties, including Israel&amp;rsquo;s Mossad and conflicting Arab regimes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Palestinian Diplomacy and Struggle for Recognition:&lt;/strong&gt; Despite challenges, the PLO achieved some diplomatic successes, gaining recognition and presenting the Palestinian cause on international platforms.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shifts in Palestinian Objectives:&lt;/strong&gt; Over time, Palestinian political objectives evolved, moving from the idea of a single democratic state to the concept of a Palestinian state alongside Israel.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Arab States’ Stance and SC 242:&lt;/strong&gt; Arab states gradually accepted Security Council Resolution 242, which indirectly amounted to recognizing Israel within its 1949 armistice lines.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Complex Regional Dynamics:&lt;/strong&gt; The chapter also highlights the intricate and often conflicting interests of regional players like Egypt, Jordan, Syria, and Lebanon, and their interactions with Palestinian groups and Israel.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="4-the-fourth-declaration-of-war-1982"&gt;4. The Fourth Declaration of War, 1982&lt;/h3&gt;
&lt;p&gt;This chapter focuses on Israel&amp;rsquo;s invasion of Lebanon in 1982, particularly against the Palestine Liberation Organization (PLO).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Initial Assault&lt;/strong&gt;: Israel&amp;rsquo;s invasion began with an intense aerial bombardment of Beirut and southern Lebanon, followed by a massive ground assault on June 6, leading to the occupation of much of Lebanon.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Casualties and Scale&lt;/strong&gt;: The invasion resulted in nearly 50,000 casualties in Beirut and Lebanon. Israel mobilized over 120,000 troops, its largest since the 1973 war, engaging in battles with Palestinian, Lebanese, and Syrian forces.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Israeli Military Casualties&lt;/strong&gt;: Israel suffered significant military casualties, with more than 2,700 injured and 364 killed. The occupation of southern Lebanon lasted until 2000.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Intensity of the Siege&lt;/strong&gt;: The siege of Beirut was described as intense and ferocious, with heavy Israeli artillery and aerial bombardments. It was more severe than previous conflicts in the region.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Strategic Advancements&lt;/strong&gt;: Israeli forces reached strategic locations around Beirut by mid-June, encircling West Beirut and starting a siege.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Characterization of Bombardment&lt;/strong&gt;: The Israeli bombardment was sometimes described as indiscriminate, causing massive destruction in Beirut, particularly in the western part.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PLO&amp;rsquo;s Forced Evacuation&lt;/strong&gt;: The PLO, under pressure from Israel, the US, and Lebanese allies, and without support from Arab governments, was forced to evacuate Beirut.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;US-Israeli Cooperation&lt;/strong&gt;: The US fully endorsed Israel&amp;rsquo;s demand for the PLO&amp;rsquo;s withdrawal and provided significant military aid. Arab governments failed to effectively support the PLO.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Failed Diplomatic Initiatives&lt;/strong&gt;: The US&amp;rsquo;s Reagan Plan for Middle Eastern peace, emerging from the conflict, ultimately failed to gain traction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pre-War Negotiations and Provocations&lt;/strong&gt;: Israeli Defense Minister Ariel Sharon had detailed war plans to US Secretary of State Alexander Haig, who indicated a need for a provocation to justify the invasion. The attempted assassination of Israel’s ambassador in London provided this pretext.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Eroded Support for PLO in Lebanon&lt;/strong&gt;: The PLO&amp;rsquo;s behavior over the preceding decade had eroded its support among the Lebanese population.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Final Evacuation and Bombardment&lt;/strong&gt;: The PLO&amp;rsquo;s departure from Beirut was negotiated under intense bombardment, with the US pressuring Israel to stop the attacks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Withdrawal of International Forces&lt;/strong&gt;: International forces overseeing the evacuation were withdrawn suddenly under US decision, influenced by Israel, leaving the civilian population unprotected.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sabra and Shatila Massacre&lt;/strong&gt;: Israeli forces facilitated a massacre in Sabra and Shatila refugee camps by LF militias, leading to over a thousand deaths. An Israeli inquiry later found senior Israeli officials responsible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;US and Israeli Responsibility&lt;/strong&gt;: The US government&amp;rsquo;s support and Israel&amp;rsquo;s actions during the invasion are viewed as a joint military endeavor, with significant blame attributed to both for the atrocities and casualties.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="5-the-fifth-declaration-of-war-19871995"&gt;5. The Fifth Declaration of War, 1987–1995&lt;/h3&gt;
&lt;p&gt;The chapter &amp;ldquo;The Fifth Declaration of War, 1987–1995&amp;rdquo; from &amp;ldquo;The Hundred Years&amp;rsquo; War on Palestine&amp;rdquo; covers a significant period in Palestinian-Israeli history, focusing on the First Intifada and its aftermath. Here&amp;rsquo;s a summary of the key points and events:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Background and Invasion of Lebanon (1982):&lt;/strong&gt; Ariel Sharon and Menachem Begin launched an invasion of Lebanon aiming to weaken the PLO and end Palestinian nationalist opposition in the West Bank and Gaza. This was part of the broader goal of Zionism to create a Jewish state in all of Palestine. The war did weaken the PLO but ironically strengthened Palestinian nationalism within Palestine, leading to increased resistance against Israeli colonization.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The First Intifada (1987-1993):&lt;/strong&gt; The Intifada erupted spontaneously across the Occupied Territories after an Israeli army vehicle killed four Palestinians in Gaza. It was a significant uprising against the Israeli occupation, with Gaza being a central point of unrest. Israeli Defense Minister Yitzhak Rabin&amp;rsquo;s harsh response, including the policy of breaking the bones of protestors, led to international backlash against Israel.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Colonization of the Occupied Territories:&lt;/strong&gt; Post-1967, Israel rapidly colonized the West Bank and Gaza, creating settlements and imposing harsh measures against any form of Palestinian nationalism. This included suppression of trade unions, prohibitions on displaying Palestinian symbols, and severe penalties for resisting occupation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shift in Palestinian Resistance:&lt;/strong&gt; A new generation of Palestinians, having grown up under occupation, showed less acquiescence and more resistance, expressing support for the PLO despite the risks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Casualties and Media Coverage:&lt;/strong&gt; Throughout the First Intifada, Israeli forces and settlers killed 1,422 Palestinians, including many minors, while 175 Israelis were killed by Palestinians. The eight-to-one casualty ratio was not accurately reflected in much of the American media.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nature of the Intifada:&lt;/strong&gt; The uprising was largely a nonviolent campaign of civil disobedience, including strikes, boycotts, and tax withholding, although some protests turned violent, often ignited by soldiers inflicting heavy casualties with live ammunition and rubber bullets used against unarmed demonstrators or youths throwing stones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Influence of Palestinian Activists and Intellectuals:&lt;/strong&gt; Figures such as Hanan &amp;lsquo;Ashrawi, Edward Said, and others played significant roles in raising awareness and advocating for the Palestinian cause.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rise of Hamas:&lt;/strong&gt; Hamas, founded in 1987 and initially supported by Israel to counter the PLO, began to gain significant influence, causing concern within the PLO leadership.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PLO&amp;rsquo;s Diplomatic Efforts:&lt;/strong&gt; The PLO sought to engage in peace negotiations, but the frameworks, such as SC 242, were seen as disadvantageous to the Palestinians, lacking recognition of key Palestinian issues.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Oslo Accords (1993):&lt;/strong&gt; The landmark agreement between the PLO and Israel, facilitated by direct negotiations, led to mutual recognition but did not equate to the establishment of a Palestinian state. The PLO recognized the state of Israel without achieving liberation or statehood in return.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Oslo II Agreement (1995):&lt;/strong&gt; This agreement further fragmented the West Bank and Gaza into different administrative areas, with Israel retaining significant control. It led to increased restrictions on Palestinian movement and life.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Consequences of the Oslo Accords:&lt;/strong&gt; The agreements were seen as flawed, leading to a deterioration in the situation for Palestinians in the Occupied Territories. They were criticized for failing to address key Palestinian demands and for effectively maintaining Israeli control.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Impact on Palestinian Authority (PA):&lt;/strong&gt; The PA, formed as an interim self-governing body, had limited authority and was largely responsible for security, often serving the interests of Israel and the U.S.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Second Intifada (2000s):&lt;/strong&gt; The ongoing occupation and the limitations of the Oslo Accords contributed to the outbreak of the Second Intifada, marked by intense violence and further Israeli control measures.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="6-the-sixth-declaration-of-war-20002014"&gt;6. The Sixth Declaration of War, 2000–2014&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Disappointment with Oslo Accords&lt;/strong&gt;: Palestinians were disillusioned with the Oslo Accords soon after their 1993 signing, as hopes of restored freedoms and economic opportunities were unmet.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Restrictions and Separation&lt;/strong&gt;: Israel enforced stringent movement restrictions, creating a complex system of permits, checkpoints, and walls. Gaza was isolated from the West Bank and Jerusalem, exacerbating economic and social hardships.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Economic Strangulation&lt;/strong&gt;: The confinement, especially in Gaza, led to economic struggles due to restricted work opportunities in Israel and limited export capabilities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Impact on Jerusalem&lt;/strong&gt;: The closure of Jerusalem to West Bank and Gaza Palestinians devastated the city&amp;rsquo;s economy and deepened hardships.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rise of Hamas&lt;/strong&gt;: Hamas emerged as a significant force, promoting a militant Islamist approach as an alternative to the PLO, and emphasizing armed struggle over diplomacy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Failures Post-Oslo and Camp David Summit&lt;/strong&gt;: The extended interim period of the Oslo Accords, the failure of final status negotiations, and the unsuccessful Camp David summit in 2000 fueled Palestinian disappointment and furthered Hamas&amp;rsquo;s position.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Second Intifada&lt;/strong&gt;: Triggered by Ariel Sharon&amp;rsquo;s provocative visit to the Haram al-Sharif in 2000, the Second Intifada marked a severe escalation in violence and conflict.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Suicide Bombings and Israeli Responses&lt;/strong&gt;: Some Palestinian groups carried out suicide bombings in Israel as a response to the Oslo process. The Palestinian Authority (PA) repressed these groups to maintain the peace process, leading to internal conflicts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Targeted Killings and Gaza Assaults&lt;/strong&gt;: Israel conducted targeted killings and major offensives in Gaza in 2008, 2012, and 2014, leading to significant Palestinian casualties and infrastructure damage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hamas&amp;rsquo;s Electoral Victory and International Reactions&lt;/strong&gt;: Hamas won the 2006 elections, altering the political landscape. This led to international boycotts and stringent conditions for Palestinian aid, further entrenching the conflict.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Internal Palestinian Dynamics&lt;/strong&gt;: The struggle for power between Fatah and Hamas, including violent clashes, led to a divided Palestinian polity, with Hamas controlling Gaza and Fatah the West Bank.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gaza&amp;rsquo;s Deteriorating Conditions&lt;/strong&gt;: The Israeli blockade of Gaza resulted in severe economic and humanitarian crises.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;US and International Policies&lt;/strong&gt;: The chapter discusses the complexity of U.S. and international policies towards Israel and Palestine, noting the influence of political and donor interests, and the challenges faced by those seeking a peaceful resolution.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="conclusion-a-century-of-war-on-the-palestinians"&gt;Conclusion: A Century of War on the Palestinians&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;British and American Stances&lt;/strong&gt;: The chapter begins by highlighting the disregard for Palestinian wishes in the establishment of Israel. In 1917, British leader Arthur James Balfour admitted to ignoring the desires of Palestinians during the creation of Israel. Fast forward to a century later, U.S. President Donald Trump recognized Jerusalem as Israel’s capital, indicating a continuation of Western powers’ indifference to Palestinian perspectives.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Settler-Colonial Dynamics&lt;/strong&gt;: The chapter compares the Palestinian situation to historical settler-colonial confrontations, noting three outcomes: subjugation or elimination of natives (as in North America), expulsion of colonizers (rare, as in Algeria), or compromise and reconciliation (like in South Africa). The Israeli advantage is partly due to the Western perception of Israel as a normal state facing irrational hostility, masking the colonial nature of the conflict.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Understanding the Conflict&lt;/strong&gt;: Three approaches have helped to expand understanding of the conflict: comparing Palestine to other colonial-settler situations, focusing on the power imbalance between Israel and the Palestinians, and emphasizing the issue of inequality. However, making these comparisons is challenging, especially in the U.S., which struggles with acknowledging its own colonial past.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Perceptions and Realities&lt;/strong&gt;: The chapter challenges the common narrative of Israel as a peace-seeking victim, pointing out its historical military superiority and support from major powers. The issue of inequality is underscored as central to the conflict and its resolution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Trump’s Approach&lt;/strong&gt;: President Trump&amp;rsquo;s actions, such as recognizing Jerusalem as Israel&amp;rsquo;s capital and the proposed &amp;ldquo;deal of the century,&amp;rdquo; are critiqued for favoring Israel and undermining Palestinian rights. This includes a plan for a non-contiguous, non-sovereign Palestinian entity, lacking full control and sovereignty.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Contradiction with Democratic Ideals&lt;/strong&gt;: The chapter asserts that modern Zionism&amp;rsquo;s discriminatory essence is increasingly at odds with the principles of Western democracies, notably equality.&lt;/li&gt;
&lt;/ul&gt;</content><category term="books"/><category term="book-summary"/><category term="history"/></entry><entry><title>The E-Myth Revisited - Book Notes</title><link href="https://ammar-alyousfi.com/2021/the-e-myth-revisited-book-notes.html" rel="alternate"/><published>2021-02-15T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2021-02-15:/2021/the-e-myth-revisited-book-notes.html</id><summary type="html">&lt;p&gt;Book Full Title: The E-Myth Revisited: Why Most Small Businesses Don&amp;rsquo;t Work and What to Do About It.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2021/emyth-bc.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/81948.The_E_Myth_Revisited"&gt;The E-Myth Revisited: Why Most Small Businesses Don&amp;rsquo;t Work and What to Do About It&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in A Paragraph&lt;/h2&gt;
&lt;p&gt;The main two ideas in the book …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Book Full Title: The E-Myth Revisited: Why Most Small Businesses Don&amp;rsquo;t Work and What to Do About It.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2021/emyth-bc.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/81948.The_E_Myth_Revisited"&gt;The E-Myth Revisited: Why Most Small Businesses Don&amp;rsquo;t Work and What to Do About It&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in A Paragraph&lt;/h2&gt;
&lt;p&gt;The main two ideas in the book for me are: 1) Having a business is not only about the technical work that produces the business product. The &amp;ldquo;technician&amp;rdquo; inside us should be accompanied with a manager and an entrepreneur for the business to grow and succeed. 2) The importance of systematizing the business, of making the business systems-dependent rather than expert-dependent. In that case, you need employees who follow great detailed systems to offer the same quality of service every time.&lt;/p&gt;
&lt;h2 id="impressions"&gt;Impressions&lt;/h2&gt;
&lt;p&gt;The book opened my eyes on two great ideas mentioned above. However, I think the book could use more organization of its contents. And I&amp;rsquo;d like to see a similar book about software business and startups specifically.&lt;/p&gt;
&lt;h2 id="notes"&gt;Notes&lt;/h2&gt;
&lt;p&gt;Entrepreneurial Seizure: Inside your mind it sounded something like this: &amp;ldquo;What am I doing this for? Why am I working for this guy? Hell, I know as much about this business as he does. If it weren’t for me, he wouldn’t have a business. Any dummy can run a business. I’m working for one.&amp;rdquo; Here lies a &lt;strong&gt;fatal assumption&lt;/strong&gt;: if you understand the technical work of a business, you understand a business that does that technical work. And the reason it’s fatal is that it just isn’t true. In fact, it’s the root cause of most small business failures!&lt;/p&gt;
&lt;h3 id="the-entrepreneur-the-manager-and-the-technician"&gt;The Entrepreneur, the Manager, and the Technician&lt;/h3&gt;
&lt;p&gt;We all have an Entrepreneur, Manager, and Technician inside us. And if they were equally balanced, we’d be describing an incredibly competent individual. The Entrepreneur would be free to forge ahead into new areas of interest; The Manager would be solidifying the base of operations; and The Technician would be doing the technical work.&lt;/p&gt;
&lt;p&gt;An entrepreneurial business, without a Manager to give it order and without a Technician to put it to work, is doomed to suffer an early, and probably very dramatic, death. A Manager-driven business, without an Entrepreneur or a Technician to play their absolutely critical roles, will put things into little gray boxes over and over again, only to realize too late that there’s no reason for the things or the boxes she put them into! Such a business will die very neatly. A Technician-driven business, without The Entrepreneur to lead her and The Manager to supervise her, The Technician will work until she drops, only to wake up the next morning to go to work even harder, and the next, and the next. Only to discover, long after it’s too late, that while she was working someone moved a freeway through the store!&lt;/p&gt;
&lt;h3 id="business-infancy-and-adolescence"&gt;Business Infancy and Adolescence&lt;/h3&gt;
&lt;p&gt;Infancy of a business ends when the owner realizes that the business cannot continue to run the way it has been; that, in order for it to survive, it will have to change.&lt;/p&gt;
&lt;p&gt;It’s only a problem when The Technician consumes all the other personalities. When The Technician fills your day with work. When The Technician avoids the challenge of learning how to grow a business. When The Technician shrinks from the entrepreneurial role so necessary to the lifeblood, the momentum, of a truly extraordinary small business, and from the managerial role so critical to the operational balance or grounding of a small business on a day-to-day basis.&lt;/p&gt;
&lt;p&gt;You might say: &amp;ldquo;But I can’t even imagine what my business would be like without me doing the work. It has always depended on me. If it weren’t for me, my customers would go someplace else.&amp;rdquo; If your business depends on you, you don’t own a business—you have a job. And it’s the worst job in the world because you’re working for a lunatic! You might then say: &amp;ldquo;But what if I want to do the technical work in my business? What if I don’t want to do anything else but that?&amp;rdquo; Then for God’s sake, get rid of your business! And get rid of it as quickly as you can. Because you can’t have it both ways. You can’t ignore the financial accountabilities, the marketing accountabilities, the sales and administrative accountabilities. You can’t ignore your future employees’ need for leadership, for purpose, for responsible management, for effective communication, for something more than just a job in which their sole purpose is to support you doing your job.&lt;/p&gt;
&lt;p&gt;Once your Technician begins to let go, once you make room for the rest of you to flourish, the game becomes more rewarding than you can possibly imagine at this point in your business’s life.&lt;/p&gt;
&lt;p&gt;A dolescence begins at the point in the life of your business when you decide to get some help.&lt;/p&gt;
&lt;p&gt;Every Adolescent business reaches a point where it pushes beyond its owner’s Comfort Zone—the boundary within which he feels secure in his ability to control his environment, and outside of which he begins to lose that control.&lt;/p&gt;
&lt;p&gt;And as the business grows beyond the owner’s Comfort Zone, there are only three courses of action to be taken, only three ways the business can turn. It can return to Infancy. It can go for broke. Or it can hang on for dear life.&lt;/p&gt;
&lt;p&gt;One of the most consistent and predictable reactions of The Technician-turned-business-owner to Adolescent chaos is the decision to &amp;ldquo;get small&amp;rdquo; again. According to the Small Business Administration, more than 400,000 such businesses close their doors in the United States every year.&lt;/p&gt;
&lt;p&gt;The Adolescent business has another alternative that is certainly less painful and decidedly more dramatic than &amp;ldquo;getting small.&amp;rdquo; It can just keep growing faster and faster until it self-destructs of its own momentum.&lt;/p&gt;
&lt;h3 id="the-turn-key-revolution"&gt;The Turn-Key Revolution&lt;/h3&gt;
&lt;p&gt;At the heart of the Turn-Key Revolution is a way of doing business that has the power to dramatically transform any small business from a condition of chaos and dis ease to a condition of order, excitement, and continuous growth. It is the Turn-Key Revolution that provides us with that illusive key to the development of an extraordinary business: the ultimately balanced model of a business that works.&lt;/p&gt;
&lt;p&gt;&amp;hellip;But the genius of McDonald’s isn’t franchising itself. The franchise has been around for more than a hundred years. The true genius of Ray Kroc’s McDonald’s is the Business Format Franchise.&lt;/p&gt;
&lt;p&gt;According to studies conducted by the U.S. Commerce Department from 1971 to 1987, less than 5 percent of franchises have been terminated on an annual basis, or 25 percent in five years. Compare that statistic to the more than 80-percent failure rate of independently owned businesses, and you can immediately understand the power of the Turn-Key Revolution in our economy, and the contribution that the Business Format Franchise has made to it and the future success of your business. The Business Format Franchise is built on the belief that the true product of a business is not what it sells but how it sells it. The true product of a business is the business itself. You should build a systems-dependent business, not a people-dependent business. A business that could work without you.&lt;/p&gt;
&lt;h3 id="the-franchise-prototype"&gt;The Franchise Prototype&lt;/h3&gt;
&lt;p&gt;The reason for the success of Business Format Franchises is the Franchise Prototype. To the franchisor, the Prototype becomes the working model of the dream; it is the dream in microcosm. Once having completed his Prototype, the franchisor then turns to the franchisee and says, “Let me show you how it works.&amp;rdquo; And work it does. The system runs the business. The people run the system.&lt;/p&gt;
&lt;p&gt;In the Franchise Prototype, the system becomes the solution to the problems that have beset all businesses and all human organizations since time immemorial. The system integrates all the elements required to make a business work.&lt;/p&gt;
&lt;p&gt;At Ray Kroc’s McDonald’s, every possible detail of the business system was first tested in the Prototype, and then controlled to a degree never before possible in a people-intensive business. The french fries were left in the warming bin for no more than seven minutes to prevent sogginess. Hamburgers were removed from the hot trays in no more than ten minutes to retain the proper moisture&amp;hellip;&lt;/p&gt;
&lt;p&gt;Unlike the trade name franchise before it, Ray Kroc’s system left the franchisee with as little operating discretion as possible. This was accomplished by sending him through a rigorous training program before ever being allowed to operate the franchise. If the franchisor has designed the business well, every problem has been thought through. All that’s left for the franchisee to do is learn how to manage the system.&lt;/p&gt;
&lt;p&gt;The Franchise Prototype is the answer to the perpetual question: &amp;ldquo;How do I give my customer what he wants while maintaining control of the business that’s giving it to him?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The Franchise Prototype is the model of a business that works. The balanced model that will satisfy The Entrepreneur, The Manager, and The Technician all at once. And it’s been there all the time! It’s been there at McDonald’s. And at Federal Express. And at Disney World. And at Mrs. Field’s Cookies. It’s been there at Subway Sandwiches and Domino’s Pizza and Kentucky Fried Chicken and Pizza Hut. It’s been there at Taco Bell and UPS and Universal Studios.&lt;/p&gt;
&lt;h3 id="working-on-your-business-not-in-it"&gt;Working on Your Business, Not in It&lt;/h3&gt;
&lt;p&gt;Pretend that the business you own—or want to own—is the prototype, or will be the prototype, for 5,000 more just like it. That your business is going to serve as the model for 5,000 more just like it.&lt;/p&gt;
&lt;p&gt;You should assume that the model will be operated by people with the lowest possible level of skill. Because if your model depends on highly skilled people, it’s going to be impossible to replicate. Such people are at a premium in the marketplace. They’re also expensive. You should ask: How can I create a business whose results are systems-dependent rather than people-dependent? Systems-dependent rather than expert-dependent.&lt;/p&gt;
&lt;p&gt;All work in the model should be documented in Operations Manuals.&lt;/p&gt;
&lt;p&gt;The model should utilize a uniform color, dress, and facilities code. &lt;/p&gt;
&lt;p&gt;Go to work on your business rather than in it, and ask yourself the following questions: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How can I get my business to work, but without me? &lt;/li&gt;
&lt;li&gt;How can I get my people to work, but without my constant interference? &lt;/li&gt;
&lt;li&gt;How can I systematize my business in such a way that it could be replicated 5,000 times, so the 5,000th unit would run as smoothly as the first?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="building-a-small-business-that-works"&gt;Building a Small Business That Works!&lt;/h2&gt;
&lt;h3 id="your-business-development-program"&gt;Your Business Development Program&lt;/h3&gt;
&lt;p&gt;Your Business Development Program is the step-by-step process through which you convert your existing business—or the one you’re about to create—into a perfectly organized model for thousands more just like it. The Program is composed of seven distinct steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Your Primary Aim &lt;/li&gt;
&lt;li&gt;Your Strategic Objective &lt;/li&gt;
&lt;li&gt;Your Organizational Strategy &lt;/li&gt;
&lt;li&gt;Your Management Strategy &lt;/li&gt;
&lt;li&gt;Your People Strategy &lt;/li&gt;
&lt;li&gt;Your Marketing Strategy &lt;/li&gt;
&lt;li&gt;Your Systems Strategy&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="your-strategic-objective"&gt;Your Strategic Objective&lt;/h3&gt;
&lt;p&gt;Your Strategic Objective is a very clear statement of what your business has to ultimately do for you to achieve your Primary Aim. In this context, your business is a means rather than an end, a vehicle to enrich your life rather than one that drains the life you have.&lt;/p&gt;
&lt;p&gt;The first standard of your Strategic Objective is money. Gross revenues. How big is your vision? How big will your company be when it’s finally done? Will it be a \$300,000 company? A million-dollar company? A \$500-million company? If you don’t know the answer, how can you possibly know whether your business can help you realize your Primary Aim?&lt;/p&gt;
&lt;h3 id="your-organizational-strategy"&gt;Your Organizational Strategy&lt;/h3&gt;
&lt;p&gt;The organizational development reflected in the Organization Chart can have a more profound impact on a small company than any other single Business Development step.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If everybody’s doing everything, then who’s accountable for anything?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Without an Organization Chart, everything hinges on luck and good feelings, on the personalities of the people and the goodwill they share.&lt;/p&gt;
&lt;p&gt;An example Organization Chart might require the following positions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;President and Chief Operating Officer (COO), accountable for the overall achievement of the Strategic Objective and reporting to the shareholders. &lt;/li&gt;
&lt;li&gt;Vice-President/Marketing, accountable for finding customers and finding new ways to provide customers with satisfaction, at lower cost, and with greater ease, and reporting to the COO.&lt;/li&gt;
&lt;li&gt;Vice-President/Operations, accountable for keeping customers by delivering to them what is promised by Marketing, and for discovering new ways of producing the business products, at lower cost, and with greater efficiency so as to provide the customer with better service, reporting to the COO.&lt;/li&gt;
&lt;li&gt;Vice-President/Finance, accountable for supporting both Marketing and Operations in the fulfillment of their accountabilities by achieving the company’s profitability standards, and by securing capital whenever it’s needed, and at the best rates, also reporting to the COO. &lt;/li&gt;
&lt;li&gt;Reporting to the Vice-President/Marketing are two positions: Sales Manager and Advertising/Research Manager. &lt;/li&gt;
&lt;li&gt;Reporting to the Vice-President/Operations are three positions: Production Manager, Service Manager, and Facilities Manager.&lt;/li&gt;
&lt;li&gt;Reporting to the Vice-President/Finance are two positions: Accounts Receivable Manager and Accounts Payable Manager.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Names should fill all the boxes in the Organization Chart even if the business consists of two people only; these two persons will be the shareholders and the employees. The next job is writing a Position Contract for each position on the Organization Chart. A Position Contract is a summary of the results to be achieved by each position in the company, the work the occupant of that position is accountable for, a list of standards by which the results are to be evaluated, and a line for the signature of the person who agrees to fulfill those accountabilities.&lt;/p&gt;
&lt;h3 id="your-management-strategy"&gt;Your Management Strategy&lt;/h3&gt;
&lt;p&gt;You may think that the successful implementation of a management strategy is dependent on finding amazingly competent managers—people with finely honed &amp;ldquo;people skills,&amp;rdquo; with degrees from management schools, with highly sophisticated techniques for dealing with and developing their people. It isn’t. You don’t need such people. Nor can you afford them. What you need, instead, is a Management System. Create your Management System, and teach your up-and-coming managers to use it.&lt;/p&gt;
&lt;h3 id="your-people-strategy"&gt;Your People Strategy&lt;/h3&gt;
&lt;p&gt;People do not simply want to work for exciting people. They want to work for people who have created a clearly defined structure for acting in the world. A structure through which they can test themselves and be tested. &lt;/p&gt;
&lt;h3 id="your-marketing-strategy"&gt;Your Marketing Strategy&lt;/h3&gt;
&lt;p&gt;In the development of your Marketing Strategy, it is absolutely imperative that you forget about your dreams, forget about your visions, forget about your interests, forget about what you want— forget about everything but your customer! &lt;/p&gt;
&lt;p&gt;There is a famous dictum that says, “Find a need and fill it.&amp;rdquo; It&amp;rsquo;s inaccurate. It should say, “Find a perceived need and fill it.&amp;rdquo; Because if your customer doesn’t perceive he needs something, he doesn’t, even if he actually does. Get it? Those perceptions are at the heart of your customer’s decision-making process. And if you know his demographics, you can understand what those perceptions are, and then figure out what you must do to satisfy them and the expectations they produce.&lt;/p&gt;
&lt;p&gt;Each demographic model has a specific set of perceptions that are identifiable in advance. Women of a certain age, with a certain amount of education, with a certain size family, living in a certain geography, buy for very specific psychographic reasons. Those unconsciously held reasons will be different from another group of women, of a different age and marital status, with a different educational background, living in a different part of the country.&lt;/p&gt;
&lt;p&gt;&amp;hellip;An age in which your customer is deluged by so many products and promises that he becomes swamped in confusion and indecision. The challenge of our age is to learn our customer’s language. And then to speak that language clearly and well so that your voice can be heard above the din.&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Who are my customers, specifically? What is their Demographic Profile?&amp;rdquo; How do you answer these questions? You ask them! You ask each and every one of them, by having them complete a questionnaire in return for a free gift! The free gift is the price you pay for that information. The answers you get will prove to be a bonanza! But, while you’re at it, you might as well get the psychographic data you need, as well as the geographic data you need. How do you do that? You find out on your questionnaire what colors they prefer, what shapes, what words. You find out the brands of perfume they buy, automobiles, clothes, jewelry, food. You match those brands to the ads and commercials that sell them&amp;hellip;&lt;/p&gt;
&lt;p&gt;&amp;hellip;How do you find them, those people you have not yet met? You buy a list of those who fit your Central Demographic Model in what you’ve now determined to be your Trading Zone! What’s your Trading Zone? It’s the geographic perimeter within which your current customers mainly live. You take their addresses from your questionnaire&amp;hellip;&lt;/p&gt;
&lt;h3 id="your-systems-strategy"&gt;Your Systems Strategy&lt;/h3&gt;
&lt;p&gt;What is a selling system? It’s a fully orchestrated interaction between you and your customer that follows six primary steps: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Identification of the specific Benchmarks—or consumer decision points—in your selling process. &lt;/li&gt;
&lt;li&gt;The literal scripting of the words that will get you to each one successfully (yes, written down like the script for a play!). &lt;/li&gt;
&lt;li&gt;The creation of the various materials to be used with each script. &lt;/li&gt;
&lt;li&gt;The memorization of each Benchmark’s script. &lt;/li&gt;
&lt;li&gt;The delivery of each script by your salespeople in identical fashion.&lt;/li&gt;
&lt;li&gt;Leaving your people to communicate more effectively, by articulating, watching, listening, hearing, acknowledging, understanding, and engaging each and every prospect as fully as he needs to be. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At E-Myth Worldwide, we call it the Power Point Selling System. A career development company we worked with put it in the hands of people with no experience, and revenues increased 300 percent in one year.&lt;/p&gt;
&lt;p&gt;Let’s look more specifically at the most important component of the Power Point Selling System, the Power Point Selling Process. It consists of: 1) The Appointment Presentation 2) The Needs Analysis Presentation 3) The Solutions Presentation. &lt;/p&gt;
&lt;p&gt;The purpose of an Appointment Presentation is one thing and one thing only: to make an appointment. It is a series of words, delivered on the telephone or in person, that engage the prospect’s unconscious by speaking primarily about the product you have to sell rather than the commodity. For example: &amp;ldquo;Hi, Mr. Jackson. I’m Johnny Jones with Walter Mitty Company. Have you seen the remarkable new things that are being done to control money these days?&amp;rdquo; 
&amp;ldquo;What new things?&amp;rdquo; 
&amp;ldquo;Well, that’s exactly why I called. May I have a moment of your time?&amp;rdquo; &lt;/p&gt;
&lt;p&gt;The Needs Analysis Presentation: The first thing you do in a Needs Analysis Presentation is repeat what you said in the Appointment Presentation to reestablish the emotional commitment: &amp;ldquo;Remember, Mr. Jackson, when we first talked I mentioned that some remarkable new things were going on in the world to control money?&amp;rdquo; 
The second thing you do is tell the prospect how you would like to proceed to fulfill your promise to him: &amp;ldquo;Well, what I’d like to do is to tell you about those things. At the same time, I’d like to show you some incredibly effective ways my firm, Walter Mitty Company, has developed to help you to control money here in your business Okay?&amp;rdquo; 
The third thing you do is to establish your credibility in the prospect’s mind by communicating two things. First, your company’s expertise is such matters: &amp;ldquo;We are Money-Controlling Specialists&amp;rdquo;. And second, your personal willingness to do whatever is necessary to utilize that expertise on his behalf: &amp;ldquo;Let me tell you why we created our company, Mr. Jackson. We’ve found that people like yourself are continually frustrated by not being able to get the most out of their money. Frustrated by paying higher interest rates than they have to. By working with financial experts who don’t seem to know what they’re doing. By banking with a bank that doesn’t seem to have their best interest at heart&amp;rdquo; And so on. &amp;ldquo;Do these things ever frustrate you. Mr Jackson? Of course they do And that’s why Walter Mitty Company has created a Money-Controlling System that makes it possible for you to get the most preferential treatment in the financial arena while paying the least for it. Now I know that sounds too good to be true. But let me explain how we propose to go about doing that for you…. &amp;rdquo; 
The fourth thing you do in a Needs Analysis Presentation is describe the Walter Mitty Company’s Money-Controlling System and why it works so well. Not what it does but the impact it will have on the prospect: &amp;ldquo;&amp;hellip;In order to do that we’ve created what we call at Walter Mitty Company a Money Management Questionnaire&amp;hellip; So let’s review the Questionnaire together, and when we’re done I’ll provide you with a summary of some of the remarkable new things that are happening in the world to control money. And then I’ll take your information back so we can prepare your Financial Report&amp;hellip;&amp;rdquo;
The fifth thing Johnny Jones does in the Needs Analysis Presentation is complete the Money Management Questionnaire. 
The sixth thing Johnny Jones does is provide the prospective customer with the information he promised and show him how relevant it is to the Financial Report he will be preparing for him.
The seventh thing Johnny Jones does in the Needs Analysis Presentation is make an appointment with the prospective customer to return with the Financial Report, reminding him that Johnny Jones will have some valuable solutions for him—at no cost!&lt;/p&gt;
&lt;p&gt;The Solutions Presentation simply provides the rational armament for the emotional commitment. Here Johnny Jones brings the prospect up-to-date by reviewing everything he said and did during the Needs Analysis Presentation. The prospect has forgotten all those psychographically compelling things by now. But he won’t for long— they’re a part of him. Then Johnny Jones reviews in great, patient, and earnest detail every last word, comma, and number in his prospective customer’s Financial Report! He asks questions to make certain that the prospect feels that this is his Financial Report, not Walter Mitty Company’s. And when Johnny Jones is done, when he’s reviewed all of the components of the Financial Report prepared just for his prospect, Mr. asks him this question: &amp;ldquo;Of the options we’ve suggested here, Mr. Jackson, which do you feel would best serve you right now?&amp;rdquo; And then waits for the answer! Because the next person who speaks is going to make a purchase. If that’s Johnny Jones, he’s going to buy a &amp;ldquo;no sale.&amp;rdquo;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Beautiful quote from the book unrelated to the main topic of the book: &amp;ldquo;I’m a little girl again. When I still had my hiding places. Before I lost my spirit. It’s summer, and I’m lying in bed looking up at the ceiling in my room, feeling the cool summer breeze floating through the open window. There’s nothing I have to do; there’s no place I have to be. It’s the most wonderful feeling of my life, lying here like this, opening my eyes, closing them, dreaming, smelling the wonderful summer smells, the smell of cut grass, the smell of the water sprinkling on the lawn, the fullness of it.&amp;rdquo;&lt;/p&gt;</content><category term="books"/><category term="book-summary"/><category term="entrepreneurship"/></entry><entry><title>Storyworthy - Book Notes</title><link href="https://ammar-alyousfi.com/2021/storyworthy-book-notes.html" rel="alternate"/><published>2021-01-20T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2021-01-20:/2021/storyworthy-book-notes.html</id><summary type="html">&lt;p&gt;Book Full Title: Storyworthy: Engage, Teach, Persuade, and Change Your Life through the Power of Storytelling.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2021/storyworthy-bc.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/en/book/show/37786022"&gt;Storyworthy: Engage, Teach, Persuade, and Change Your Life through the Power of Storytelling&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in a Paragraph&lt;/h2&gt;
&lt;p&gt;The book talks about the art of finding, forming, and creating stories that …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Book Full Title: Storyworthy: Engage, Teach, Persuade, and Change Your Life through the Power of Storytelling.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2021/storyworthy-bc.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/en/book/show/37786022"&gt;Storyworthy: Engage, Teach, Persuade, and Change Your Life through the Power of Storytelling&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in a Paragraph&lt;/h2&gt;
&lt;p&gt;The book talks about the art of finding, forming, and creating stories that you can tell on a stage, at dinner with friends, etc. The book introduces the &amp;ldquo;homework for life&amp;rdquo; where you write a brief description every day about the most story-worthy moment of that day. This helps you find stories and make time slow down for you; you will stop feeling that days and years go by in a flash. The book discusses that each story is really about a 5-second moment in which change happens and heart moves. The best beginning of a story is at the opposite state of that 5-second moment. The book talks about strategies to make the audience more interested and engaged with your story (The Elephant, Backpacks, Breadcrumbs, Hourglasses, and Crystal Balls). The book also shows how to create a cinema in the minds of your listeners by simply providing a physical location for every moment of your story. It talks how surprise is the only way to elicit an emotional reaction from your audience. It states that the present tense is the best tense to tell stories because it makes audience more &amp;ldquo;present&amp;rdquo; in your story. It teaches you how to tell a success story.&lt;/p&gt;
&lt;h2 id="impressions"&gt;Impressions&lt;/h2&gt;
&lt;p&gt;Good book that contains some useful techniques to be a better story teller. The techniques mentioned in the book could have been told in a much shorter book. However, it was enjoyable to read the author unique stories throughout the book.&lt;/p&gt;
&lt;h2 id="who-should-read-it"&gt;Who Should Read it?&lt;/h2&gt;
&lt;p&gt;Anyone interested in becoming a better story teller.&lt;/p&gt;
&lt;h2 id="notes"&gt;Notes&lt;/h2&gt;
&lt;p&gt;Let’s also be clear that when I talk about storytelling, I am speaking about personal narrative. True stories told by the people who lived them. &lt;/p&gt;
&lt;p&gt;Your story must reflect change over time. A story cannot simply be a series of remarkable events. Regardless of whether your change is infinitesimal or profound, positive or negative, your story must reflect change.&lt;/p&gt;
&lt;p&gt;If you wouldn’t tell your story at dinner that way, for goodness’ sake don’t tell it onstage that way. Storytelling is not theater. It is not poetry. It should be a slightly more crafted version of the story you would tell your buddies over beers.&lt;/p&gt;
&lt;h3 id="homework-for-life"&gt;Homework for Life&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;What is &amp;ldquo;Homework for Life&amp;rdquo;?&lt;/strong&gt; I decided that at the end of every day, I’d reflect upon my day and ask myself one simple question: If I had to tell a story from today — a five-minute story onstage about something that took place over the course of this day — what would it be? As benign and boring and inconsequential as it might seem, what was the most storyworthy moment from my day? I decided not to write the entire story down, because to do so would require too much time and effort.&lt;/p&gt;
&lt;p&gt;There’s an added bonus to Homework for Life. It might just be the most important reason to do the exercise. As you begin to take stock of your days, find those moments — see them and record them — &lt;strong&gt;time will begin to slow down for you&lt;/strong&gt;. The pace of your life will relax. &lt;/p&gt;
&lt;p&gt;This change (resulting from doing the Homework for Life) won’t happen instantly, and in this world, most people want their results instantaneously.&lt;/p&gt;
&lt;h3 id="dreaming-at-the-end-of-your-pen"&gt;Dreaming at the End of Your Pen&lt;/h3&gt;
&lt;p&gt;Stream of consciousness is the act of speaking or writing down whatever thought that enters your mind, regardless of how strange, incongruous, or even embarrassing it may be. People have been utilizing stream-of-consciousness strategies for a long time. It helps in generating new ideas and resurrecting old memories.&lt;/p&gt;
&lt;p&gt;Rules for doing the stream of consciousness exercise: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You must not get attached to any one idea. &lt;/li&gt;
&lt;li&gt;You must not judge any thought or idea that appears in your mind. &lt;/li&gt;
&lt;li&gt;You cannot allow the pen to stop moving. You must continue writing words even when your mind is empty. To make this happen, I use colors. When I have no other thought in my mind, I begin listing colors on the page until one of them triggers a thought or memory. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That’s it. Set a timer for ten minutes, follow these three rules, and go. I always launch my sessions with an object in the room, but you can start any way you want.&lt;/p&gt;
&lt;h3 id="first-last-best-worst"&gt;First Last Best Worst&lt;/h3&gt;
&lt;p&gt;All you need for this exercise is pen and paper. Fill the &amp;ldquo;First&amp;rdquo;, &amp;ldquo;Last&amp;rdquo;, &amp;ldquo;Best&amp;rdquo;, and &amp;ldquo;Worst&amp;rdquo; columns for each prompt as you can see in the example image below:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2021/storyworthy-1.png"&gt;&lt;/p&gt;
&lt;h3 id="every-story-takes-only-five-seconds-to-tell"&gt;Every Story Takes Only Five Seconds to Tell&lt;/h3&gt;
&lt;p&gt;Every great story ever told is essentially about a five-second moment in the life of a human being, and the purpose of the story is to bring that moment to the greatest clarity possible. So dig. Search. Hunt. Fight for the five-second moment. Allow yourself to recall the entire event. Don’t get hung up on the big moments, the unbelievable circumstances, or the hilarious details. Seek out the moments when you felt your heart move. When something changed forever, even if that moment seems minuscule compared to the rest of the story. &lt;/p&gt;
&lt;h3 id="finding-your-beginning"&gt;Finding Your Beginning&lt;/h3&gt;
&lt;p&gt;Once you’ve distilled your five-second moment down to its essence, ask yourself: What is the opposite of your five-second moment? Simply put, &lt;strong&gt;the beginning of the story should be the opposite of the end&lt;/strong&gt;. Find the opposite of your transformation, revelation, or realization, and this is where your story should start. This is what creates an arc in your story. This is how a story shows change over time. &lt;/p&gt;
&lt;p&gt;Try to start your story with forward movement whenever possible.&lt;/p&gt;
&lt;p&gt;In 2016, humorist Mo Rocca delivered a commencement speech at Sarah Lawrence College and provided one granular bit of wisdom that is both applicable and memorable:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Some perspective: Your great-grandparents — and some of you may be lucky enough to have known them — survived the Great Depression and defended freedom during World War II, defeating Hitler and the forces of darkness, ensuring that their progeny could also enjoy life, liberty, and the pursuit of happiness. There’s a very good reason the women and men of that generation are known in history as the Greatest Generation. Well, I did some research, and it turns out that the life expectancy of that generation was just 54. Your life expectancy is 76. That means that you can take a deep breath, chill out — catch up on House of Cards and Narcos — and spend the next twenty-two years figuring out what you want to do — and you could still end up matching the achievements of the Greatest Generation.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id="stakes-five-ways-to-keep-your-story-compelling"&gt;Stakes: Five Ways to Keep Your Story Compelling&lt;/h3&gt;
&lt;p&gt;I use five different strategies to infuse stories with stakes:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Elephant&lt;/strong&gt;: The Elephant is the thing that everyone in the room can see. It is large and obvious. It is a clear statement of the need, the want, the problem, the peril, or the mystery. It signifies where the story is headed. When a storyteller begins speaking, whether in a theater or a dining room or a conference room, the audience often has no idea of what to expect. The Elephant tells the audience what to expect. It gives them a reason to listen, a reason to wonder. The Elephant is the difference between these two beginnings of a story: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Version #1&lt;/strong&gt;: My mother was the kind of woman whom everyone adored. The model of decorum and civility. She served as PTO president and treasurer of the ladies’ auxiliary. She was the only female umpire in our town’s Little League. She baked and knit and grew vegetables by the pound. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Version #2&lt;/strong&gt;: I don’t care how perfect my mother was. When I was nine years old, I wanted to disown her. Leave home and never return. Forget she ever existed. My mother was the kind of woman whom everyone adored. The model of decorum and civility. She served as PTO president and treasurer of the ladies’ auxiliary. She was the only female umpire in our town’s Little League. She baked and knit and grew vegetables by the pound.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Elephants can also change color. That is, the need, want, problem, peril, or mystery stated in the beginning of the story can change along the way. Don’t switch Elephants. Simply change the color.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Backpacks&lt;/strong&gt;: A Backpack is a strategy that increases the stakes of the story by increasing the audience’s anticipation about a coming event. It’s when a storyteller loads up the audience with all the storyteller’s hopes and fears in that moment before moving the story forward. In “&lt;a href="https://www.youtube.com/watch?v=YjrlGhAB4a4"&gt;Charity Thief&lt;/a&gt;,” I stick a Backpack on my audience when I describe my plan for begging for money before entering the gas station. Backpacks are most effective when a plan does not work.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Breadcrumbs&lt;/strong&gt;: Storytellers use Breadcrumbs when we hint at a future event but only reveal enough to keep the audience guessing. In “Charity Thief,” I drop a Breadcrumb when I say: &amp;ldquo;But as I climb back into the car, I see my crumpled McDonald’s uniform on the backseat, and I suddenly have an idea.&amp;rdquo; The trick is to choose the Breadcrumbs that create the most wonder in the minds of your audience without giving them enough to guess correctly. Breadcrumbs are particularly effective when the truly unexpected is coming.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hourglasses&lt;/strong&gt;: There comes a time in many stories when you reached a moment (or the moment) that the audience has been waiting for. This is the moment to use an Hourglass. It’s time to slow things down. Grind them to a halt when possible. We all know what a McDonald’s uniform looks like, yet (in “Charity Thief”) I choose to describe it anyway, in the greatest detail. This is because I have my audience now. I own them. They cannot wait for that blue door to open so the unknown can become known.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Crystal Balls&lt;/strong&gt;: A Crystal Ball is a false prediction made by a storyteller to cause the audience to wonder if the prediction will prove to be true. In “Charity Thief,” I say: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[The man] points his finger at me and says, “You stay right there.” Then he walks back into his house, and I know what he’s doing. He’s calling the police, and they will come and arrest me for stealing money from McDonald’s.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In storytelling, deploy Crystal Balls strategically: Only when your prediction seems possible. Only when your guess is reasonable. And only when your prediction presents an intriguing or exciting possibility.&lt;/p&gt;
&lt;h3 id="permissible-lies-of-storytelling"&gt;Permissible Lies of Storytelling&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Lie #1: Omission&lt;/strong&gt;: If a person doesn’t fill a role in your story, simply pretend that person wasn’t there.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lie #2: Compression&lt;/strong&gt;: &amp;hellip;In reality, my sister and I planned the jump on one day and I executed it the next. But why stretch out a story over the course of two days when nothing of consequence happens between the planning and execution? It’s easier for an audience to see and understand my story if all the events take place within a single afternoon. My Saturday-Sunday story becomes a Saturday-afternoon story.&lt;/p&gt;
&lt;p&gt;There are more 3 lies mentioned in the book.&lt;/p&gt;
&lt;h3 id="cinema-of-the-mind"&gt;Cinema of the Mind&lt;/h3&gt;
&lt;p&gt;A great storyteller creates a movie in the mind of the audience. At no point should the story become visually obscured or impossible to see. In order to achieve this lofty goal, storytellers must do one thing, and happily for you, it’s exceedingly simple: Always &lt;strong&gt;provide a physical location for every moment of your story&lt;/strong&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Version #1: My grandmother’s name is Odelie Dicks, which probably explains why she is who she is. She’s a crooked old lady in both body and mind. She wears only dark colors and likes to serve food that has stewed in pots for days. I like to imagine that there was a time in her life when she smiled — or at least didn’t scowl — but if that time existed, it was long before me. &lt;/p&gt;
&lt;p&gt;Version #2 I’m standing at the edge of my grandmother’s garden, watching her relentlessly pull weeds from the unforgiving soil. My grandmother’s name is Odelie Dicks, which probably explains why she is who she is. She’s a crooked old lady in both body and mind. She wears only dark colors and likes to serve food that has stewed in pots for days. I like to imagine that there was a time in her life when she smiled — or at least didn’t scowl — but if that time existed, it was long before me. &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;One of these versions is the beginning of a story. The other sounds more like the beginning of an essay.&lt;/p&gt;
&lt;h3 id="the-principle-of-but-and-therefore"&gt;The Principle of But and Therefore&lt;/h3&gt;
&lt;p&gt;A clear majority of human beings tend to connect their sentences, paragraphs, and scenes together with the word &lt;em&gt;and&lt;/em&gt;. This is a mistake. The ideal connective tissue in any story are the words &lt;em&gt;but&lt;/em&gt; and &lt;em&gt;therefore&lt;/em&gt;, along with all their glorious synonyms. These buts and therefores can be either explicit or implied.&lt;/p&gt;
&lt;h3 id="there-is-only-one-way-to-make-someone-cry"&gt;There Is Only One Way to Make Someone Cry&lt;/h3&gt;
&lt;p&gt;When it comes to storytelling, I believe that &lt;strong&gt;surprise is the only way to elicit an emotional reaction from your audience&lt;/strong&gt;. Whether it’s laughter, tears, anger, sadness, outrage, or any other emotional response, the key is surprise.&lt;/p&gt;
&lt;p&gt;In “&lt;a href="https://www.youtube.com/watch?v=N3J4Q5c1C1w"&gt;This Is Going to Suck&lt;/a&gt;”, I enhance the collision surprise through contrast. I paint a very different picture (beautiful and calm picture) of the world right before the collision.&lt;/p&gt;
&lt;p&gt;Common mistakes that storytellers make that ruin surprise include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Presenting a thesis statement prior to the surprise. This often takes the form of an opening sentence that gives away all that is surprising about the story like “This is a story about a time in my life when my friends became my family.” and “This is a story about a car accident so serious that it took my life, if only for a moment.”&lt;/li&gt;
&lt;li&gt;Failing to hide critical information in a story. As storytellers, we must hide pertinent information from our audiences to allow the surprise to pay off later. You can hide important moment in two ways: &lt;/li&gt;
&lt;li&gt;Hiding the Bomb in the Clutter: Hide important moments by making them seem unimportant.&lt;/li&gt;
&lt;li&gt;Camouflage: Laughter is an excellent way to hide something important. The laugh line makes the moment feel like a storyteller’s attempt at a joke instead of the conveying of a critical bit of information.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="milk-cans-and-baseballs-babies-and-blenders-simple-effective-ways-to-be-funny-in-storytelling"&gt;Milk Cans and Baseballs, Babies and Blenders: Simple, Effective Ways to Be Funny in Storytelling&lt;/h3&gt;
&lt;p&gt;Even non-funny stories can have funny moments like &amp;ldquo;This is Going to Suck&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Milk Cans and a Baseball&lt;/strong&gt;: The trick is to work to the laugh by using language that carefully builds your tower while saving the funniest thing for last. Sadly, the instinct of most people is to say the funniest thing first. For example, in a story entitled “Homeless and the Goat,” I tell the story about the period of my life when I was homeless. Near the end I say, “I was rescued from the streets by a family of Jehovah’s Witnesses. I sleep in a pantry off their kitchen that they’ve converted into a tiny bedroom. I share this room with a Jehovah’s Witness named Rick, a guy who speaks in tongues in his sleep, and the family’s indoor pet goat.” Goat is funny, but it’s only funny when said properly. When my friends tell this story on my behalf, they kill the humor. They kill it because they can’t wait to say the word goat.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Babies and Blenders&lt;/strong&gt;: Babies and Blenders is the idea that when two things that rarely or never go together are pushed together, humor often results. &amp;hellip;This always gets a laugh, because three-year-old boys are rarely described as assholes, especially after being described as sweet, angelic, and little. In the story about the way that my grandmother pulled my loose teeth, I refer to her as a sadist. Grandmother and sadist are rarely seen together, so it’s funny.&lt;/p&gt;
&lt;h3 id="the-present-tense-is-king"&gt;The Present Tense Is King&lt;/h3&gt;
&lt;p&gt;&amp;hellip;Do you feel as if you’re on the train with me? I’m loading you up with sensory information. The sounds and sights and feel of the train. Another strategy that I’m using to put you on this train with me is the use of the present tense.&lt;/p&gt;
&lt;p&gt;Some storytellers are able to see their stories. As they tell it, they almost relive the moments. Rather than staring into the eyes of their audience, their minds recreate a vision of the events as they unfold.&lt;/p&gt;
&lt;h3 id="the-two-ways-of-telling-a-hero-story"&gt;The Two Ways of Telling a Hero Story&lt;/h3&gt;
&lt;p&gt;There is nothing wrong with sharing your success stories, but they are hard stories to tell well. The truth is this: failure is more engaging than success. Nevertheless, there are times when you might want to tell a success story, and when you do, there are two strategies that I suggest you employ. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Malign yourself. &lt;/li&gt;
&lt;li&gt;Marginalize your accomplishment.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;hellip;Why do I open my story with this moment? I want to be sure that my audience knows that I’m not perfect, nor am I pretending to be. I’m not the best teacher in the world. Not even close. I may save a girl’s life, but I also struck a child with flying footwear. I marginalize myself. I cast myself as the underdog by sharing a highly imperfect moment of teaching, so I can tell you about the closer-to-perfect one later. I maligned myself by admitting I’d thrown a shoe at a student. I marginalized my accomplishment by pointing out that while I may have saved Lisa, I had failed to save the many who came before her.&lt;/p&gt;
&lt;p&gt;Human beings love underdog stories. The love for the underdog is universal. Underdogs are supposed to lose, so when they manage to pull out an unexpected or unbelievable victory, our sense of joy is more intense than if that same underdog suffers a crushing defeat.&lt;/p&gt;
&lt;p&gt;&amp;hellip;This is how to tell a success story: Rather than telling a story of your full and complete accomplishment, tell the story of a small part of the success.&lt;/p&gt;
&lt;h3 id="time-to-perform"&gt;Time to Perform&lt;/h3&gt;
&lt;p&gt;It’s hard to be authentic and vulnerable when you’re reciting lines. It’s also obvious to an audience when a storyteller is simply reciting a story instead of telling a story. Instead of memorizing your story word-for-word, memorize three parts to a story: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The first few sentences. Always start strong. &lt;/li&gt;
&lt;li&gt;The last few sentences. Always end strong. &lt;/li&gt;
&lt;li&gt;The scenes of your story.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When you can see your audience — in a classroom, a conference room, your aunt’s kitchen, a reception hall, or a faculty meeting — eye contact is important. You can’t speak to the middle distance and expect your audience to connect. My suggestion is this: Find a person on your left, a person on your right, and a person dead center who likes you. These will be the people who are smiling. Nodding. Laughing. Use these three people as your guideposts. Make eye contact with them, and the people in each of those areas will feel you are attending to them as well.&lt;/p&gt;</content><category term="books"/><category term="book-summary"/><category term="storytelling"/></entry><entry><title>Science Set Free - Book Notes</title><link href="https://ammar-alyousfi.com/2020/science-set-free-book-notes.html" rel="alternate"/><published>2020-12-30T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-12-30:/2020/science-set-free-book-notes.html</id><summary type="html">&lt;p&gt;Book Full Title: Science Set Free: 10 Paths to New Discovery.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2020/science-set-free-bc.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/13330465-science-set-free"&gt;Science Set Free: 10 Paths to New Discovery&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in a Paragraph&lt;/h2&gt;
&lt;p&gt;The book criticizes materialism and provides evidences that contradict materialism principles. Materialism is not based on science; it is a belief that achieved …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Book Full Title: Science Set Free: 10 Paths to New Discovery.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2020/science-set-free-bc.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/13330465-science-set-free"&gt;Science Set Free: 10 Paths to New Discovery&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="book-in-a-paragraph"&gt;Book in a Paragraph&lt;/h2&gt;
&lt;p&gt;The book criticizes materialism and provides evidences that contradict materialism principles. Materialism is not based on science; it is a belief that achieved its dominance within institutional science in the second half of the nineteenth century. Many scientists use multiverse theories like superstring theory which are untestable theories to explain why the conditions and constants at the time of the Big Bang were suitable (fine tuned) for biological life to be possible. If they were slightly different, biological life could never have emerged. They use these theories to avoid believing in a creator God. The book talks, with supporting evidence, about telepathy, hypnosis, inedia phenomenon (not eating nor drinking for years), and other experiences that challenge the materialistic view of the world. The book discusses, with examples, how scientists are normal humans who might be corrupted and do unethical deeds. The book shows how modern science is so focused on material matter; it downplays and don&amp;rsquo;t give a way to other sciences that might prove to be of great benefits like alternative medicine. The book talks about the vast gulf between the rhetoric about the powers of genes and what they actually do and the disappointment that occurred after the results of the Human Genome Project had appeared.&lt;/p&gt;
&lt;h2 id="impressions"&gt;Impressions&lt;/h2&gt;
&lt;p&gt;It was a little annoying that the author mentions &amp;ldquo;morphic resonance&amp;rdquo; a lot as an explanation of some phenomena although it seems to not have a strong proof. He refers us to another book of him where he explains more about it.&lt;/p&gt;
&lt;h2 id="who-should-read-it"&gt;Who Should Read it?&lt;/h2&gt;
&lt;p&gt;People idolizing modern scientists and thinking that &amp;ldquo;modern science&amp;rdquo; is the only way to know. People who use science as a religion.&lt;/p&gt;
&lt;h2 id="notes"&gt;Notes&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Cosmological Anthropic Principle&lt;/strong&gt; asserts that if the laws and constants of nature had been slightly different at the moment of the Big Bang, biological life could never have emerged, and hence we would not be here to think about it. So did a divine mind fine-tune the laws and constants in the beginning? To avoid a creator God emerging in a new guise, most leading cosmologists prefer to believe that our universe is one of a vast, and perhaps infinite, number of parallel universes, all with different laws and constants, as M-theory also suggests. We just happen to exist in the one that has the right conditions for us. This multiverse theory is the ultimate violation of Occam’s Razor, the philosophical principle that “entities must not be multiplied beyond necessity,” or in other words, that we should make as few assumptions as possible. It also has the major disadvantage of being untestable. And it does not even succeed in getting rid of God. An infinite God could be the God of an infinite number of universes.&lt;/p&gt;
&lt;p&gt;According to the Anthropic Cosmological Principle, the fact that the “laws” and “constants” of nature are just right for human life on this planet requires an explanation. If these laws and constants had been even slightly different, carbon-based life would not exist. One response is to suggest that an Intelligent Designer fine-tuned the laws and constants of nature at the moment of the Big Bang so they were exactly right for the emergence of life and human beings. This is a modern version of deism. But an appeal to a divine mind, albeit of a remote, mathematical kind, is contrary to the atheistic spirit of much modern science. Instead many cosmologists prefer to think that there are innumerable actually existing universes besides our own, each with different laws and constants. In these “multiverse” models the fact that we occupy a universe that is just right for us is explained very simply. This is the only universe that we can actually observe precisely because it is the only one right for us. The other theoretical reason for the popularity of the multiverse is superstring theory. This ten-dimensional theory and the related eleven-dimensional M-theory generate far too many possible solutions, which could correspond to different universes, as many as 10500.&lt;/p&gt;
&lt;p&gt;Multiverse theories assume that particular laws and constants are built into each separate universe at the moment of its origin or Big Bang. They are somehow “imprinted” in each universe. But how are they remembered? How does an individual universe “know” what laws and constants are governing it, as opposed to the different laws and constants of other universes? As the cosmologist Martin Rees expressed it, “The physical laws were themselves ‘laid down’ in the Big Bang.” But, he admitted, “The mechanisms that might ‘imprint’ the basic laws and constants in a new universe are obviously far beyond anything we understand.” Some physicists and cosmologists are unhappy with these speculations. A vast number of unobserved universes violates the canon of scientific testability. Multiverse supporters claim that mathematics itself, in the form of string and M-theories, provides evidence in favor of their speculations. But string and M-theories themselves, on which many of these speculations are based, are untestable. One critic, Peter Woit, called his book on the subject &lt;strong&gt;Not Even Wrong&lt;/strong&gt;. Even generic predictions that superstring theory shares with other theories, such as supersymmetry, have not fared well.&lt;/p&gt;
&lt;p&gt;The founders of mechanistic science in the seventeenth century, including Johannes Kepler, Galileo Galilei, René Descartes, Francis Bacon, Robert Boyle and Isaac Newton, were all &lt;strong&gt;practicing Christians&lt;/strong&gt;. Newton calculated that the Day of Judgment would occur &lt;strong&gt;between the years 2060 and 2344&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Materialists recognized only one reality: the material world. The spiritual realm did not exist. Gods, angels and spirits were figments of the human imagination, and human minds were nothing but aspects or by-products of brain activity. The materialist philosophy achieved its dominance within institutional science in the second half of the nineteenth century, and was closely linked to the rise of atheism in Europe. Twenty-first-century atheists, like their predecessors, take the doctrines of materialism to be established scientific facts, not just assumptions. When it was combined with the idea that the entire universe was like a machine running out of steam, according to the second law of thermodynamics, materialism led to the cheerless worldview expressed by the philosopher Bertrand Russell: &amp;ldquo;That man is the product of causes which had no prevision of the end they were achieving; that his origin, his growth, his hopes and fears, his loves and beliefs, are but the outcome of accidental collisions of atoms; that no fire, no heroism, no intensity of thought and feeling, can preserve an individual life beyond the grave; that all the labors of the ages, all the devotion, all the inspiration, all the noonday brightness of human genius, are destined to extinction in the vast death of the solar system; and that the whole temple of Man’s achievement must inevitably be buried beneath the debris of a universe in ruins—all these things, if not quite beyond dispute, are yet so nearly certain, that no philosophy which rejects them can hope to stand. Only within the scaffolding of these truths, only on the firm foundation of unyielding despair, can the soul’s habitation henceforth be built.”&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Big Bang theory&lt;/strong&gt;: It was not until 1927 that Georges Lemaître, a cosmologist and Roman Catholic priest, advanced a scientific hypothesis like Hume’s idea of the origin of the universe in an egg or seed. Lemaître suggested that the universe began with a “creation-like event,” which he described as “the cosmic egg exploding at the moment of creation.” Later called the Big Bang, this new cosmology echoed many archaic stories of origins, like the Orphic creation myth of the Cosmic Egg in ancient Greece, or the Indian myth of Hiranyagarbha, the primal Golden Egg. Lemaître’s theory predicted the expansion of the universe, and was supported by the discovery that galaxies outside our own are moving away from us with a speed proportional to their distance. In 1964, the discovery of a faint background glow everywhere in the universe, the cosmic microwave background radiation, revealed what seemed to be fossil light left over from the early universe, soon after the Big Bang. The evidence for an initial “creation-like event” became overwhelming, and by 1966 the Big Bang theory became orthodox.&lt;/p&gt;
&lt;p&gt;According to the theory of quantum electrodynamics, brilliantly expounded by the physicist Richard Feynman, virtual particles, such as electrons and photons, appear and disappear from the quantum vacuum field, also known as the zero-point field, that pervades the universe. Feynman called this theory the “&lt;strong&gt;jewel of physics&lt;/strong&gt;” because of its extremely accurate predictions, correct to many decimal places. The price that is paid for this accuracy is the &lt;strong&gt;acceptance of invisible, unobservable&lt;/strong&gt; particles and interactions, and of the mysterious quantum vacuum field. According to quantum electrodynamics, all electrical and magnetic forces are mediated by virtual photons that appear from the quantum vacuum field and then disappear into it again. When you look at a compass to find out where north is, the compass needle interacts with the earth’s magnetic field through virtual photons. When you switch on a fan, its electric motor makes it go round because it is suddenly filled with virtual photons that exert forces.&lt;/p&gt;
&lt;p&gt;We have come a long way from a simple belief in atoms of matter as tiny solid objects that persist unchanged through time. According to current theories, matter itself is an energetic process, and mass depends on interactions with fields that pervade the vacuum. Mass, the quantitative measure of matter, turns out to be deeply mysterious. According to the Standard Model of particle physics, the mass of a particle like an electron or a proton is not inherent in the particle itself but depends on its interaction with a field called a Higgs field. The mass of an electron, for example, arises through its interaction with the Higgs field, and this interaction depends on special &lt;strong&gt;Higgs particles&lt;/strong&gt;, called Higgs bosons. And no Higgs boson has so far been detected, despite the expenditure of billions of euros to look for them.&lt;/p&gt;
&lt;p&gt;Dark matter helps to explain the structures of galaxies and the relations between galaxies within clusters, but it does so at a heavy price: &lt;strong&gt;nobody knows what it is&lt;/strong&gt;. Detailed observations of distant supernovas—exploding stars in faraway galaxies—showed that the expansion of the universe was speeding up. Gravitation ought to be slowing it down. So something else must account for accelerating growth. Physicists were forced to conclude that there must be an antigravity force, called dark energy.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inedia phenomenon&lt;/strong&gt;: people who seem to be able to live for months or years without eating. This phenomenon is known as inedia (Latin for “fasting”). Many people who did this long fasting were monitored to verify that they were not eating or drinking during their fasting.&lt;/p&gt;
&lt;p&gt;The Australian astronomer John Webb studied the fine structure constant, α, to see if it was always constant or not. He found that it wasn&amp;rsquo;t. As Webb and his colleague John Barrow pointed out, “If α is susceptible to change, other constants should vary as well, making the inner workings of nature more fickle than scientists ever suspected.&lt;/p&gt;
&lt;p&gt;The neuroscientist Benjamin Libet and his team in San Francisco measured changes in the brain and the timing of conscious experiences. First, Libet’s group stimulated their human subjects either by flashes of light or by a rapid sequence of mild electric pulses applied to the back of the hand. If the stimulus was short, less than about half a second (500 milliseconds), the subjects were unconscious of it, even though the sensory cortex of their brains responded. But if the stimulus went on for more than 500 milliseconds, the subjects became consciously aware of it. So far, so good. The need for a minimum duration of stimulus is not in itself surprising. What is surprising is that the subjects’ conscious awareness of the stimulus began &lt;strong&gt;not after 500 milliseconds but when the stimulus started&lt;/strong&gt;. In other words, it took half a second for the stimulus to be experienced subjectively, but this subjective experience moved backward to when the stimulus was first applied. Second, Libet investigated what happened when people made free conscious choices. The subjects sat quietly, and were asked to flex one of their fingers or push a button whenever they felt like doing so. They also noted when they decided or felt the wish to do so. This conscious decision occurred about 200 milliseconds before the finger movement. This seems straightforward—the choice preceded the action. What was remarkable was that electrical changes began in the brain about 300 milliseconds before any conscious decision was made. For some neuroscientists and philosophers, Libet’s finding seemed like the ultimate experimental proof that free will is an illusion. The brain changed first, and about a third of a second later, conscious awareness followed the choice, rather than initiating it.&lt;/p&gt;
&lt;p&gt;The materialist denial of purposes in evolution is not based on evidence but is an assumption. Materialists are forced to attribute evolutionary creativity to chance on ideological grounds.&lt;/p&gt;
&lt;p&gt;The usual assumption is that genes somehow control or “program” the development of form, as if the nucleus, containing the genes, is a kind of brain controlling the cell. But Acetabularia shows that morphogenesis can take place without genes. If the rhizoid containing the nucleus is cut off, the alga can stay alive for months, and if the cap is cut off, it can regenerate a new one. Even more remarkable, if a piece is cut out of the stem, after the cuts have healed, a new tip grows from the end where the cap used to be and makes a new cap. The image below illustrates these scenarios.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/science-set-free-acet.png"&gt;&lt;/p&gt;
&lt;p&gt;Mechanists &lt;strong&gt;expel purposive vital factors&lt;/strong&gt; from living animals and plants, but then they &lt;strong&gt;reinvent them in molecular guises&lt;/strong&gt;. One form of molecular vitalism is to treat the genes as purposive entities with goals and powers that go far beyond those of a mere chemical like DNA. The genes become molecular entelechies. In his book The Selfish Gene, Richard Dawkins endowed them with life and intelligence. In Dawkins’s words, “DNA moves in mysterious ways.” The DNA molecules are not only intelligent, they are also selfish, ruthless and competitive. If challenged, most biologists will admit that genes merely specify the sequence of amino acids in proteins, or are involved in the control of protein synthesis. They are not really programs; they are not selfish, they do not mold matter, or shape form, or aspire to immortality. &lt;/p&gt;
&lt;p&gt;There is a &lt;strong&gt;vast gulf&lt;/strong&gt; between rhetoric about the powers of genes and what they actually do. Investors in biotechnology are swept along by the metaphors, as are readers of popular science. The problem goes right back to Weismann, who made the determinants an active agency, controlling and directing the organism’s development. In effect, he endowed a special kind of matter, the germ-plasm, with the properties of the soul. Genetic programs and selfish genes are similarly endowed with vital powers, including the ability to “mould matter” and “create form.” Thanks to the discoveries of molecular biology, we know what genes actually do. They code for the sequences of amino acids that are strung together in polypeptide chains, which then fold up into protein molecules. Also, some genes are involved in the control of protein synthesis. DNA molecules are molecules. They are not “determinants” of particular structures. Richard Dawkins has probably done more than any other author to popularize genes. Unfortunately, his vivid metaphors are highly misleading.&lt;/p&gt;
&lt;p&gt;If genetic programs were carried in the genes, then all the cells of the body would be programmed identically, because in general they contain exactly the same genes. The cells of your arms and legs, for example, are genetically identical. Your limbs contain exactly the same kinds of protein molecules, as well as chemically identical bone, cartilage and nerves. Yet arms and legs have different shapes. Clearly, the genes alone cannot explain these differences. They must depend on formative influences that act differently in different organs and tissues as they develop. These influences cannot be inside the genes: they extend over entire tissues and organs. At this stage, in most conventional explanations, the concept of the genetic program fades out.&lt;/p&gt;
&lt;p&gt;High hopes about the &lt;strong&gt;Human Genome Project&lt;/strong&gt; were transformed into disappointment by the actual project results. One manifestation of those hopes happened at the press conference in the White House on June 26, 2000, President Clinton said, “We are here today to celebrate the completion of the first survey of the entire human genome. Without a doubt this is the most important, most wondrous map ever produced by mankind. It will revolutionize the diagnosis, prevention and treatment of most, if not all, human diseases … Humankind is on the verge of gaining immense, new power to heal.” The optimism that life would be understood if molecular biologists knew the “programs” of an organism gave way to the realization that there is a huge gap between gene sequences and actual human beings. In practice, the predictive value of human genomes turned out to be small, in some cases less than that achieved with a measuring tape. Recent “genome-wide association studies” compared the genomes of 30,000 people and identified about fifty genes associated with tallness or shortness. To everyone’s surprise, taken together, these genes accounted for only about 5 percent of the inheritance of height. In other words, the “height” genes did not account for 75 to 85 percent of the heritability of height. Most of the heritability was missing. Many other examples of missing heritability are now known, including the heritability of many diseases, making “personal genomics” of very questionable value. Since 2008, in scientific literature this phenomenon has been called the “&lt;strong&gt;missing heritability problem&lt;/strong&gt;.”&lt;/p&gt;
&lt;p&gt;There is a growing recognition that some acquired characteristics can indeed be inherited. This kind of inheritance is now called “epigenetic inheritance.”&lt;/p&gt;
&lt;p&gt;I carried out many further filmed observations of Jaytee’s behavior, and did similar experiments with other dogs, notably a Rhodesian Ridgeback called Kane. Again and again, on film and under controlled conditions, these dogs anticipated their owners’ returns. The most remarkable animal I have come across is an African gray parrot, N’kisi. Its owner and I set up a controlled experiment in which she viewed a series of photographs in a random sequence while she was in a different room on a separate floor, being filmed continuously. The pictures were in a random order and represented twenty words in N’kisi’s vocabulary, like “flower,” “hug” and “phone.” Meanwhile, N’kisi, who was alone, was also filmed continuously. He often said words that corresponded to the image she was viewing, and did so much more frequently than expected by chance. The results were highly significant statistically.&lt;/p&gt;
&lt;p&gt;In an attempt to find out more about telepathy in modern societies, I launched a series of appeals for information through the media in Europe, North America and Australia. Over a period of fifteen years, I built up a database of human experiences, similar to my database on unexplained powers of animals, with more than four thousand case histories, classified into more than sixty categories.&lt;/p&gt;
&lt;p&gt;I designed a simple procedure to test both the chance-coincidence theory and the unconscious-knowledge theory experimentally. I recruited subjects who said they quite frequently knew who was calling before answering the phone. I asked them for the names and telephone numbers of four people they knew well, friends or family members. The subjects were then filmed continuously throughout the period of the experiment alone in a room with a landline telephone, without a caller ID system. If there was a computer in the room, it was switched off, and the subjects had no mobile phone. My research assistant or I selected one of the four callers at random by the throw of a die. We rang up the selected person and asked him to phone the subject in the next couple of minutes. He did so. The subject’s phone rang, and before answering it she had to say to the camera who, out of the four possible callers, she felt was on the line. She could not have known through knowledge of the caller’s habits and daily routines because, in this experiment, the callers rang at times randomly selected by the experimenter. By guessing at random, subjects would have been right about one time in four, or 25 percent. In fact, the average hit rate was 45 percent, very significantly above the chance level. This above-chance effect has been replicated independently in telephone telepathy tests at the universities of Freiburg, Germany, and Amsterdam, Holland.&lt;/p&gt;
&lt;p&gt;One of the very few systematic observations of animal behavior before, during and after an earthquake concerns toads in Italy. A British biologist, Rachel Grant, was carrying out a study of mating behavior in toads for her PhD project at San Ruffino Lake in central Italy in the spring of 2009. To her surprise, soon after the beginning of the mating season in late March, the number of male toads in the breeding group suddenly fell. From more than ninety being active on March 30, there were almost none on March 31 and in early April. As Grant and her colleague Tim Halliday observed, “This is highly unusual behavior for toads; once toads have appeared to breed, they usually remain active in large numbers at the breeding site until spawning has finished.” On April 6, Italy was shaken by a 6.4-magnitude earthquake, followed by a series of aftershocks. The toads did not resume their normal breeding behavior for another ten days, two days after the last aftershock. Grant and Halliday looked in detail at the weather records for this period but found nothing unusual. They were forced to the conclusion that the toads were somehow detecting the impending earthquake some six days in advance.&lt;/p&gt;
&lt;p&gt;Skeptical organizations are the principal defenders of the belief that psychic phenomena are illusory: they seek to debunk or deny any evidence that suggests they might be wrong. The best established of these groups is the US Committee for Skeptical Inquiry (CSI). The effects of these well-organized and well-funded skeptical campaigns are not simply intellectual, but political and economic. Through maintaining the taboo against the “paranormal,” they ensure that most universities avoid this controversial area altogether, despite great public interest in the subject.&lt;/p&gt;
&lt;p&gt;The physiologist Hermann von Helmholtz, who played such an important part in the establishment of the principle of conservation of energy in living organisms, dismissed the possibility of telepathy out of hand: “Neither the testimony of all the fellows of the Royal Society, nor even the evidence of my own sense, would lead me to believe in the transmission of thought from one person to another independently of the recognized channels of sense. It is clearly impossible.”&lt;/p&gt;
&lt;p&gt;Discovering and testing new drugs is a lengthy and increasingly expensive process, and drug companies try to make as much money as possible from their drugs while patents last. They inevitably devote enormous amounts of money to advertising and promotion. In order to bolster the drugs’ scientific credibility, they offer large fees to scientists to put their names to articles that have been ghostwritten by authors paid by the drug company, or else the scientists are given other inducements to lend their names to studies they have not done. Medical ghostwriting takes many forms, but a recent case gives some insight into what is involved. In 2009, around fourteen thousand women who developed breast cancer while taking Prempro, a hormone replacement therapy (HRT), sued the drug’s manufacturer, Wyeth. In court, it turned out that many of the medical research papers supporting HRT had been ghostwritten by a commercial medical communications company called DesignWrite.&lt;/p&gt;
&lt;p&gt;&amp;hellip;In several other clinical trials, Prozac was no better than the placebo&amp;hellip; However, the drug company, Eli Lilly, did not publish the results of unsuccessful trials, which were revealed only because an independently minded researcher, Irving Kirsch, managed to obtain the data using the US Freedom of Information Act. He found that when all the data were taken into account, not just the positive results published by the manufacturers, Prozac and several other antidepressants turned out to be no more effective than placebos, or than a herbal remedy, St. John’s wort, which is far cheaper. &lt;/p&gt;
&lt;p&gt;When I was studying at Cambridge, one of our physiology lecturers, Fergus Campbell, gave a demonstration of the powers of hypnosis using one of my fellow students as a subject. Campbell told the subject that he was carrying out a scientific experiment on the response of skin to heat, and would be touching the subject’s arm with a lighted cigarette. In fact he touched it with the flat end of a pencil. Soon afterward, the skin reddened and a blister appeared where the cool pencil had touched. I later learned that many other hypnotists had shown the same thing, and that it had been studied, but not explained, by medical researchers. Nerves that control small arteries in the skin mediate this burn response. People cannot will themselves to activate these nerves, which are under the control of the autonomic or involuntary nervous system. Yet the hypnotic induction of burns shows that suggestion can work through the autonomic nervous system.&lt;/p&gt;
&lt;p&gt;Hypnosis can also produce “miracle cures,” as it did in the case of a boy in London in the 1950s. He was born with a thick, dark skin, and as he grew, most of his body was covered with a black, rough casing. Doctors said he had been born with ichthyosis, “fish-scale disease.” Treatment at some of London’s best hospitals did no good. Even a skin transplant from his normal chest to his hands proved worse than useless: the skin blackened and then shrank, stiffening his fingers. Albert Mason, a young doctor interested in hypnosis, heard of the case and, watched by a dozen skeptical colleagues, put the boy into a hypnotic trance. He told him, “Your left arm will clear.” It did. About five days later the coarse outer layer of skin became crumbly and fell off. The skin underneath soon became pink and soft. Through repeated hypnosis, Mason cleared other parts of the body, limb by limb. In a follow-up study three years later, Mason and a team of dermatologists confirmed that “not only has there been no relapse, but his skin has continued to improve.”&lt;/p&gt;
&lt;p&gt;Numerous studies in the United States and elsewhere have shown that people who are religious, especially those who regularly attend religious services, live significantly longer, and have better health and less depression than people without religious faith. These effects were found with Christian and non-Christian groups. For example, in a study in North Carolina, Harold Koenig and his colleagues tracked 1,793 subjects who were over sixty-five years old with no physical impairments at the beginning of the study. Six years later, those who prayed had survived 66 percent more than those who did not pray, after correcting for age differences between the two groups.&lt;/p&gt;
&lt;p&gt;In a recent systematic study, some Dutch psychologists at the University of Amsterdam contacted the authors of 141 papers published in leading psychology journals, asking for access to the raw data for the sake of reanalysis. All these journals required authors to sign an undertaking that they “would not withhold the data on which their conclusions are based from other competent professionals.” After six months and four hundred emails, the Amsterdam researchers received sets of data from only 29 percent of the authors.&lt;/p&gt;
&lt;p&gt;One of the biggest cases of fraud to be exposed in physics in the twenty-first century concerned Jan Hendrik Schön, a young researcher on nanotechnology at Bell Laboratories, in New Jersey. He seemed brilliantly successful and amazingly productive, making breakthrough after breakthrough and receiving three prestigious awards. But in 2002, several physicists noticed that the same data appeared in different papers, apparently from different experiments. An investigating committee found sixteen instances of scientific misconduct, mostly the making up or recycling of data. Significantly, none of these instances of fraud was detected in the peer-review process. In another recent case, Marc Hauser, a Harvard professor of biology, was found guilty of scientific misconduct by an official inquiry at Harvard in 2010. He had falsified or invented data in experiments on monkeys. Again, his dishonesty was not detected by peer reviewers, but came to light when a graduate student blew the whistle. Hauser is the author of a book called Moral Minds: The Nature of Right and Wrong (2007), in which he claims that morality is an inherited instinct, produced by evolution and independent of religion. Hauser is an atheist, and claims his findings support an atheist point of view.&lt;/p&gt;</content><category term="books"/><category term="book-summary"/><category term="science"/></entry><entry><title>Analysis of YouTube Trending Videos of 2019 (US)</title><link href="https://ammar-alyousfi.com/2020/youtube-trending-videos-analysis-2019-us.html" rel="alternate"/><published>2020-07-06T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-07-06:/2020/youtube-trending-videos-analysis-2019-us.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2020/yta2-cover.png" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p class="text-box-3"&gt;This analysis was featured on: &lt;a style="color:inherit;" href="https://thehustle.co/what-you-can-learn-from-youtubes-trending-videos/" target="_blank"&gt;&lt;b&gt;The Hustle newsletter&lt;/b&gt;&lt;/a&gt; (lead story), &lt;a style="color:inherit;" href="https://techcrunch.com/2020/08/18/piggyback-on-popular-tweets-to-get-brand-awareness/" target="_blank"&gt;&lt;b&gt;TechCrunch&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://news.ycombinator.com/item?id=23762180" target="_blank"&gt;&lt;b&gt;Hacker News&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://www.demandcurve.com/newsletter#t77r4ayu03tun5215smc" target="_blank"&gt;&lt;b&gt;The Growth Newsletter&lt;/b&gt;&lt;/a&gt; (issue #021), &lt;a style="color:inherit;" href="https://twitter.com/SocialBlade/status/1281299735572332546" target="_blank"&gt;&lt;b&gt;Social Blade&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://www.datascienceweekly.org/" target="_blank"&gt;&lt;b&gt;Data Science Weekly newsletter&lt;/b&gt;&lt;/a&gt; (Jul 09 2020's issue), &lt;a style="color:inherit;" href="https://www.weekly.gg/beer-talk/big-data-youtube-trending-list" target="_blank"&gt;&lt;b&gt;Weekly&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://www.tubefilter.com/2020/07/10/what-makes-a-youtube-video-trending-2019-ammar-alyousfi/" target="_blank"&gt;&lt;b&gt;Tubefilter&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://anchor.fm/benamara-younes/episodes/ep-egms16" target="_blank"&gt;&lt;b&gt;Younes Talk&lt;/b&gt;&lt;/a&gt;, and more.&lt;/p&gt;

&lt;!--


&lt;div class='sub-form-cont'&gt;
  &amp;lt;!-- &lt;div class="sub-img"&gt;&lt;img src="/assets/images/2021/lb4.png" &gt;&lt;/div&gt; --&amp;gt;
  &lt;p&gt;&lt;span class="sub-sp1"&gt;Hey! 👋&lt;/span&gt;&lt;br&gt; If you like this analysis, I have good news for you: Recently I launched Trendflow, &lt;strong&gt;a tool to study and discover 
  YouTube trends&lt;/strong&gt;. With an interactive dashboard and many data visualizations, you can do most of the analyses in this page with regularly updated data and thousands of trending videos. &lt;a href="https://www.trendflow.in/?src=yt_analysis_2_post" target="_blank"&gt;Click here&lt;/a&gt; to know more and access the tool.&lt;/p&gt;
&lt;/div&gt;
--&gt;

&lt;!-- {%- include mailchimp_form.html -%} --&gt;

&lt;p&gt;Around 1.5 years ago, I did an &lt;a href="https://www.kaggle.com/ammar111/youtube-trending-videos-analysis"&gt;analysis of YouTube trending videos&lt;/a&gt; in US. That …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2020/yta2-cover.png" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p class="text-box-3"&gt;This analysis was featured on: &lt;a style="color:inherit;" href="https://thehustle.co/what-you-can-learn-from-youtubes-trending-videos/" target="_blank"&gt;&lt;b&gt;The Hustle newsletter&lt;/b&gt;&lt;/a&gt; (lead story), &lt;a style="color:inherit;" href="https://techcrunch.com/2020/08/18/piggyback-on-popular-tweets-to-get-brand-awareness/" target="_blank"&gt;&lt;b&gt;TechCrunch&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://news.ycombinator.com/item?id=23762180" target="_blank"&gt;&lt;b&gt;Hacker News&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://www.demandcurve.com/newsletter#t77r4ayu03tun5215smc" target="_blank"&gt;&lt;b&gt;The Growth Newsletter&lt;/b&gt;&lt;/a&gt; (issue #021), &lt;a style="color:inherit;" href="https://twitter.com/SocialBlade/status/1281299735572332546" target="_blank"&gt;&lt;b&gt;Social Blade&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://www.datascienceweekly.org/" target="_blank"&gt;&lt;b&gt;Data Science Weekly newsletter&lt;/b&gt;&lt;/a&gt; (Jul 09 2020's issue), &lt;a style="color:inherit;" href="https://www.weekly.gg/beer-talk/big-data-youtube-trending-list" target="_blank"&gt;&lt;b&gt;Weekly&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://www.tubefilter.com/2020/07/10/what-makes-a-youtube-video-trending-2019-ammar-alyousfi/" target="_blank"&gt;&lt;b&gt;Tubefilter&lt;/b&gt;&lt;/a&gt;, &lt;a style="color:inherit;" href="https://anchor.fm/benamara-younes/episodes/ep-egms16" target="_blank"&gt;&lt;b&gt;Younes Talk&lt;/b&gt;&lt;/a&gt;, and more.&lt;/p&gt;

&lt;!--


&lt;div class='sub-form-cont'&gt;
  &amp;lt;!-- &lt;div class="sub-img"&gt;&lt;img src="/assets/images/2021/lb4.png" &gt;&lt;/div&gt; --&amp;gt;
  &lt;p&gt;&lt;span class="sub-sp1"&gt;Hey! 👋&lt;/span&gt;&lt;br&gt; If you like this analysis, I have good news for you: Recently I launched Trendflow, &lt;strong&gt;a tool to study and discover 
  YouTube trends&lt;/strong&gt;. With an interactive dashboard and many data visualizations, you can do most of the analyses in this page with regularly updated data and thousands of trending videos. &lt;a href="https://www.trendflow.in/?src=yt_analysis_2_post" target="_blank"&gt;Click here&lt;/a&gt; to know more and access the tool.&lt;/p&gt;
&lt;/div&gt;
--&gt;

&lt;!-- {%- include mailchimp_form.html -%} --&gt;

&lt;p&gt;Around 1.5 years ago, I did an &lt;a href="https://www.kaggle.com/ammar111/youtube-trending-videos-analysis"&gt;analysis of YouTube trending videos&lt;/a&gt; in US. That analysis was performed on trending videos of some months in 2017 and 2018. The analysis received a lot of interest on &lt;a href="https://www.kaggle.com/ammar111/youtube-trending-videos-analysis"&gt;Kaggle&lt;/a&gt; and &lt;a href="https://www.reddit.com/r/datascience/comments/9kpmcn/i_analyzed_more_than_40000_youtube_trending/"&gt;Reddit&lt;/a&gt;; I also received some emails praising the work done. That was 1.5 years ago.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Today&lt;/strong&gt;, I present an improved and expanded version of that analysis. This analysis is more advanced and contains new interesting elements. In this analysis, &lt;strong&gt;All trending videos for the whole year of 2019&lt;/strong&gt; were analyzed (More than &lt;strong&gt;70,000&lt;/strong&gt; videos). &lt;/p&gt;
&lt;p&gt;Titles, descriptions, thumbnails, tags, views, likes/dislikes, and comments were all analyzed to produce the results shown in this post. Continue reading to know more about the analysis and the data or you can &lt;a href="#analysis-res"&gt;jump directly to the results section&lt;/a&gt;.&lt;/p&gt;
&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#summary-of-some-key-results-of-the-analysis"&gt;Summary of Some Key Results of the Analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what-are-youtube-trending-videos"&gt;What are YouTube Trending Videos?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tools-used"&gt;Tools Used&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#code-used"&gt;Code Used&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#data-source"&gt;Data Source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#data-size-and-description"&gt;Data Size and Description&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#analysis-results"&gt;Analysis Results&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#trending-videos-and-views"&gt;Trending Videos and Views&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#how-many-views-videos-had-when-they-first-became-trending"&gt;How Many Views Videos Had When they First Became Trending?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-for-30-days"&gt;Trending for 30 days!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-videos-titles"&gt;Trending Videos Titles&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#number-of-fully-uppercase-words-in-titles"&gt;Number of Fully-Uppercase Words in Titles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what-are-the-most-common-words-in-video-titles"&gt;What are the Most Common Words in Video Titles?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what-are-the-most-common-2-grams-in-video-titles"&gt;What are the Most Common 2-Grams in Video Titles?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#titles-lengths"&gt;Titles Lengths&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-channels"&gt;Trending Channels&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-videos-categories"&gt;Trending Videos Categories&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#when-were-trending-videos-published"&gt;When were Trending Videos Published?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-videos-and-comments"&gt;Trending Videos and Comments&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#how-many-comments-videos-had-when-they-first-became-trending"&gt;How Many Comments Videos Had When they First Became Trending?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-videos-and-likes-and-dislikes"&gt;Trending Videos and Likes.. and Dislikes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#how-long-does-it-take-a-video-to-become-trending"&gt;How Long Does it Take a Video to Become Trending?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-videos-descriptions"&gt;Trending Videos Descriptions&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#how-long-is-the-description"&gt;How Long is the Description?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#most-common-words-in-trending-videos-descriptions"&gt;Most Common Words in Trending Videos Descriptions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#does-trending-videos-descriptions-contain-hashtags"&gt;Does Trending Videos Descriptions Contain Hashtags?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#trending-videos-tags"&gt;Trending Videos Tags&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#most-common-words-in-trending-videos-tags"&gt;Most Common Words in Trending Videos Tags&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#correlations-of-trending-videos"&gt;Correlations of Trending Videos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what-are-the-most-used-colors-in-trending-videos-thumbnails"&gt;What are the Most Used Colors in Trending Videos Thumbnails?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#whats-inside-trending-videos-thumbnails"&gt;What&amp;rsquo;s Inside Trending Videos Thumbnails?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="summary-of-some-key-results-of-the-analysis"&gt;Summary of Some Key Results of the Analysis&lt;/h2&gt;
&lt;p&gt;The main goal of the analysis is to find interesting facts and patterns by exploring the data and by using effective visualizations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If you don&amp;rsquo;t have time&lt;/strong&gt; to read the full analysis, here are some of the insights that were extracted from the data along with links to their sections in the analysis:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Linus Tech Tips (a technology channel) was the channel that &lt;a href="#trending-channels"&gt;produced most trending videos in 2019&lt;/a&gt;. It is a technology (not entertainment nor music) and personal (not corporate) channel. More than that, the 2nd and 3rd channels after Linus Tech Tips were cooking channels.&lt;/li&gt;
&lt;li&gt;While a video might stay on the trending list for one day or less, there are 6 videos that appeared on the list &lt;a href="#trending-for-30-days"&gt;for 30 days&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;BTS&amp;rsquo; song &amp;ldquo;Boy With Luv&amp;rdquo; was the most &lt;a href="#trending-videos-and-views"&gt;viewed&lt;/a&gt;, &lt;a href="#trending-videos-and-likes-and-dislikes"&gt;liked&lt;/a&gt;, and &lt;a href="#trending-videos-and-comments"&gt;commented&lt;/a&gt; video. However, it was also the 5th most &lt;a href="#trending-videos-and-likes-and-dislikes"&gt;disliked&lt;/a&gt; video.&lt;/li&gt;
&lt;li&gt;Some videos appeared on the trending list &lt;a href="#how-many-views-videos-had-when-they-first-became-trending"&gt;when they had only around 50,000 views&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Words like &amp;ldquo;official&amp;rdquo;, &amp;ldquo;video&amp;rdquo;, &amp;ldquo;2019&amp;rdquo;, &amp;ldquo;vs&amp;rdquo;, &amp;ldquo;trailer&amp;rdquo;, &amp;ldquo;music&amp;rdquo;, &amp;ldquo;game&amp;rdquo;, &amp;ldquo;new&amp;rdquo;, &amp;ldquo;highlights&amp;rdquo;, &amp;ldquo;first&amp;rdquo;, and &amp;ldquo;challenge&amp;rdquo; were among the &lt;a href="#what-are-the-most-common-words-in-video-titles"&gt;most common in trending video titles&lt;/a&gt;. So if you include the current year in your title, does that increase trending chances?&lt;/li&gt;
&lt;li&gt;🔥 was the &lt;a href="#what-are-the-most-common-words-in-video-titles"&gt;most common emoji&lt;/a&gt; in trending video titles.&lt;/li&gt;
&lt;li&gt;While the minimum was 3 and the maximum was 100, most trending videos &lt;a href="#titles-lengths"&gt;have titles lengths between 36 and 64 characters&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;There was a video that became trending when it had &lt;a href="#how-many-comments-videos-had-when-they-first-became-trending"&gt;only 7 comments&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;YouTube Rewind videos of 2018 and 2019 were the 1st and 2nd &lt;a href="#trending-videos-and-likes-and-dislikes"&gt;most disliked videos&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;On average, &lt;a href="#how-long-does-it-take-a-video-to-become-trending"&gt;videos take 1.5 days&lt;/a&gt; to appear on the trending list for the first time.&lt;/li&gt;
&lt;li&gt;While the allowed maximum is 5,000 character, most trending videos have their &lt;a href="#how-long-is-the-description"&gt;descriptions length between 500 and 1500 characters&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A lot of trending videos put &lt;a href="#most-common-words-in-trending-videos-descriptions"&gt;social media links&lt;/a&gt; in their descriptions.&lt;/li&gt;
&lt;li&gt;Almost all trending videos &lt;a href="#trending-videos-tags"&gt;use tags&lt;/a&gt;. On average, 21 tags.&lt;/li&gt;
&lt;li&gt;By running an object-detection algorithm on the thumbnails of trending videos, &lt;a href="#whats-inside-trending-videos-thumbnails"&gt;it turned out that a person is the most common object&lt;/a&gt; in the thumbnails. So you might consider adding a person photo in your next video.&lt;/li&gt;
&lt;li&gt;Do you want to see the &lt;a href="#what-are-the-most-used-colors-in-trending-videos-thumbnails"&gt;most common colors&lt;/a&gt; in video thumbnails that were extracted after a lot of processing?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The analysis covers &lt;strong&gt;much more&lt;/strong&gt; as you will see soon&amp;hellip;&lt;/p&gt;
&lt;h2 id="what-are-youtube-trending-videos"&gt;What are YouTube Trending Videos?&lt;/h2&gt;
&lt;p&gt;YouTube, as you know, is the most popular and most used video platform in the world today. YouTube has &lt;a href="https://www.youtube.com/feed/trending"&gt;a list of &lt;strong&gt;trending videos&lt;/strong&gt;&lt;/a&gt;. I&amp;rsquo;ll quote the description of trending videos from &lt;a href="https://support.google.com/youtube/answer/7239739?hl=en"&gt;YouTube itself&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Trending helps viewers see what’s happening on YouTube and in the world. Trending aims to surface videos that a wide range of viewers would find interesting. Some trends are predictable, like a new song from a popular artist or a new movie trailer. Others are surprising, like a viral video. Trending isn&amp;rsquo;t personalized and displays the same list of trending videos in each country to all users.&lt;/p&gt;
&lt;p&gt;The list of trending videos is updated roughly every 15 minutes. With each update, videos may move up, down, or stay in the same position in the list.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="tools-used"&gt;Tools Used&lt;/h2&gt;
&lt;p&gt;This analysis was performed using Python and a powerful group of Python libraries including Pandas, Matplotlib, NLTK, ImageAI, WordCloud, and more.&lt;/p&gt;
&lt;p&gt;The analysis were performed in a Jupyter Notebook.&lt;/p&gt;
&lt;h3 id="code-used"&gt;Code Used&lt;/h3&gt;
&lt;p&gt;You can find all the code used for this analysis in a Jupyter notebook &lt;a href="https://github.com/ammar1y/YouTube-Trending-Videos-Analysis-2019"&gt;on this link&lt;/a&gt;. Feel free to read the code and re-use it however you want. Also note that the notebook contains more analyses than the ones shown here in this post, so if you want to see everything, refer to the notebook after you finish reading this post.&lt;/p&gt;
&lt;h2 id="data-source"&gt;Data Source&lt;/h2&gt;
&lt;p&gt;The data used in this analysis was retrieved using YouTube API. A script was scheduled to run &lt;strong&gt;each day throughout 2019 and fetch data from YouTube API about the trending videos of that day&lt;/strong&gt;. The script would then process the data received from YouTube and store them in text files.&lt;/p&gt;
&lt;p&gt;The scraping script is not my work. It can be found on Github: &lt;a href="https://github.com/mitchelljy/Trending-YouTube-Scraper"&gt; Trending-YouTube-Scraper&lt;/a&gt;. I put the script on a AWS EC2 instance and scheduled it—using Crontab—to run every day at a specific time.&lt;/p&gt;
&lt;p&gt;After 2019 ended, I connected to the AWS instance using FileZilla application and downloaded all the data produced by the script. There was a file for each day of 2019. To perform the analysis, I needed to process the data in order to merge the files into a single CSV file.&lt;/p&gt;
&lt;h2 id="data-size-and-description"&gt;Data Size and Description&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;In this post, United-States trending videos will be analyzed&lt;/strong&gt;, which constitute a total of &lt;strong&gt;72,994&lt;/strong&gt; videos. YouTube usually place 200 videos in the trending list each day which would mean that we should have 73,000 (365 x 200) videos. We have 72,994. This is probably because on a few days, the number of Trending videos was slightly less than 200. &lt;/p&gt;
&lt;p&gt;So we have data on 72,994 trending videos to analyze. On YouTube, &lt;strong&gt;the same video might appear on the trending list for many days. This means that the 72,994 videos are not unique videos&lt;/strong&gt;. In fact, among the 72,994 videos, &lt;strong&gt;we have 11,177 unique videos&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;In other words, 11,177 videos showed on the trending list throughout 2019. Some of them might have stayed on the list for 10 days, some for 20 days, etc. We will see later in the analysis more info about this.&lt;/p&gt;
&lt;p&gt;The following table shows an example of &lt;strong&gt;the data that we have for each video&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-data.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
As we can see, we have the ID of the video which is a unique value for the video across YouTube (No two videos have the same ID). We also have the title of the video, its publishing date and time, the channel that published it, its category, and its description and tags. We also have the number of the views, likes, dislikes, and comments of the video. There are also a few more data shown in the table. &lt;/p&gt;
&lt;p&gt;We can see that there is a field named &amp;ldquo;trending_date&amp;rdquo;. This field specifies the date on which this video was trending. As we said earlier, the same video might appear on the trending-videos list for more than one day. This means that we might find another record in the data for the same video ID but with different &amp;ldquo;trending_date&amp;rdquo; and maybe different number of views, comments, likes, etc. (because those numbers are likely to increase from one day to another).&lt;/p&gt;
&lt;p class="text-box-1"&gt;If you want to &lt;strong&gt;download the data&lt;/strong&gt; used in this analysis which describes 2019's trending videos in the United States, you can buy it securely on Gumroad &lt;u&gt;&lt;strong&gt;&lt;a href="https://gum.co/qEzKK" target="_blank"&gt;on this link&lt;/a&gt;&lt;/strong&gt;&lt;/u&gt; or by using the button below. Along with United States, you'll also get trending-videos data for United Kingdom, Canada, Denmark, Malaysia, Saudi Arabia, and other countries as well.&lt;/p&gt;

&lt;p id="analysis-res"&gt;&lt;/p&gt;

&lt;h2 id="analysis-results"&gt;Analysis Results&lt;/h2&gt;
&lt;p&gt;Now let&amp;rsquo;s start the best part of this post, let&amp;rsquo;s see the analysis results.&lt;/p&gt;
&lt;p&gt;&lt;span id="note-uniq"&gt;&lt;/span&gt;&lt;strong&gt;Please note&lt;/strong&gt; that for the following analyses, &lt;strong&gt;unless otherwise stated&lt;/strong&gt;, we applied the analysis on all of the &lt;strong&gt;72,994&lt;/strong&gt; trending videos, &lt;strong&gt;not&lt;/strong&gt; on the unique trending videos only. The reasoning behind this is that we are interested in videos considered trending by YouTube. So if a video is considered trending for 3 days, then we believe that it has more trending power and more trending characteristics than a video that was trending for 1 day only; thus, it should have more weight. So &lt;strong&gt;we include the 3 occurrences of that video in the analysis&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For some analyses, considering only unique videos is more appropriate. When that is the case, you will see a note telling you about that.&lt;/p&gt;
&lt;h3 id="trending-videos-and-views"&gt;Trending Videos and Views&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;The Trending Video with the Highest Number of Views&lt;/strong&gt; is a song by BTS band named &amp;ldquo;Boy With Luv&amp;rdquo;. The video was published on 12/April/2019 and on 23/04/2019, it appeared on the trending list with 195,376,667 views which is the highest number of views a trending video had in 2019.&lt;/p&gt;
&lt;p&gt;In the table below, you can see &lt;strong&gt;the top 3 trending videos based on the number of views&lt;/strong&gt;. These trending videos had views when they appeared on the trending list more than any other trending video. This table was produced by considering unique trending videos only (&lt;a href="#note-uniq"&gt;For more&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-top-views.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And now we will look at the distribution of views for trending videos. The histogram below shows this distribution:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-view-dist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Notice that the y-axis is &lt;a href="https://www.mathsisfun.com/definitions/logarithmic-scale.html"&gt;log scaled&lt;/a&gt;. It is 10, 100, 1000&amp;hellip; not 10, 20, 30&amp;hellip;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We can see that the vast majority of trending videos had less than 20 million views when they became trending. In fact, when they became trending, around &lt;strong&gt;94% of trending videos had less than 10 million views&lt;/strong&gt; and around 99.9% had less than 100 million views.&lt;/p&gt;
&lt;p&gt;Now, we might ask: &lt;strong&gt;What are the trending videos with the least amount of views?&lt;/strong&gt; The table below shows the 3 trending videos with the lowest number of views when appearing on the trending list. This table was produced by considering unique trending videos only (&lt;a href="#note-uniq"&gt;For more&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-least-views.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;You can see that these three videos appeared on the trending list on the same day they were published on. Maybe they received a high number of views in the first few hours after they were published which sent them to the trending list.&lt;/p&gt;
&lt;h4 id="how-many-views-videos-had-when-they-first-became-trending"&gt;How Many Views Videos Had When they First Became Trending?&lt;/h4&gt;
&lt;p&gt;We mentioned earlier that there were many videos that appeared on the trending list on more than one day. We now want to consider the first appearance only of each video. We want to know how many views a trending video had when it became trending for the first time.&lt;/p&gt;
&lt;p&gt;The following graph shows the distribution of the number of views of trending videos when first appearing on the trending list:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-trendfrv.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Notice that the y-axis is &lt;a href="https://www.mathsisfun.com/definitions/logarithmic-scale.html"&gt;log scaled&lt;/a&gt;. It is 10, 100, 1000&amp;hellip; not 10, 20, 30&amp;hellip;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We can see that there is one video that became trending when it had ~150 million views. We can see another one that became trending when it had ~60 million views. But most of the videos became trending when they had less than ~30 million views.&lt;/p&gt;
&lt;p&gt;In fact: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;90&lt;/strong&gt;% of trending videos became trending for the first time when they had less than &lt;strong&gt;2,752,317&lt;/strong&gt; views. &lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;minimum&lt;/strong&gt; number of views a video had when it first became trending was &lt;strong&gt;53,796&lt;/strong&gt; views.&lt;/li&gt;
&lt;li&gt;The average number of views a video had when it first became trending was &lt;strong&gt;1,387,466&lt;/strong&gt; views. The median (the 50th percentile value) was &lt;strong&gt;777,510&lt;/strong&gt; views.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="trending-for-30-days"&gt;Trending for 30 days!&lt;/h3&gt;
&lt;p&gt;Some videos don&amp;rsquo;t appear on the trending list for only one day, nor for two days. There are some videos that appeared on the trending list for &lt;strong&gt;30 days&lt;/strong&gt;. The following table shows the videos that appeared on the trending list the most. There are 6 videos that appeared for 30 days on the trending list. &lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-trfor.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And this is how these 6 videos appear today on YouTube:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-trfort.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3 id="trending-videos-titles"&gt;Trending Videos Titles&lt;/h3&gt;
&lt;p&gt;Titles constitute an important part of each video. They describe the video for people before deciding to click on the video or not. And because of that, video title is one of the important factors in video success; video title plays an essential role in determining video &lt;a href="https://creatoracademy.youtube.com/page/lesson/analytics-impressions"&gt;click-through-rate&lt;/a&gt; (CTR). Here are some interesting facts about 2019&amp;rsquo;s trending-videos titles.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6% of trending-videos titles are fully uppercase (LIKE THIS)&lt;/strong&gt;. Numbers, symbols, and emojis are not taken into account for this. For example, all the following titles are considered fully uppercase: &amp;ldquo;FIRST TITLE&amp;rdquo;, &amp;ldquo;2ND TITLE&amp;rdquo;, &amp;ldquo;#3 TITLE 🎉&amp;rdquo;.&lt;/p&gt;
&lt;h4 id="number-of-fully-uppercase-words-in-titles"&gt;Number of Fully-Uppercase Words in Titles&lt;/h4&gt;
&lt;p&gt;If we count the number of fully-uppercase words in each of the trending-videos titles we get the following distribution graph:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-uppwords.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;This means that around 50% of trending videos have no fully-uppercase word in their titles, around 20% have 1 fully-uppercase word in their titles, around 10% have 2 fully-uppercase words in their titles, etc.&lt;/p&gt;
&lt;h4 id="what-are-the-most-common-words-in-video-titles"&gt;What are the Most Common Words in Video Titles?&lt;/h4&gt;
&lt;p&gt;Are there some words that occur in trending video titles more than others? To find out the answer, I analyzed the titles of all trending videos and counted the occurrences of each word in those titles.  Before that, symbols were removed from the words and contractions were replaced with their expansions. For example, &amp;ldquo;aren&amp;rsquo;t&amp;rdquo; and &amp;ldquo;we&amp;rsquo;ll&amp;rdquo; were replaced with &amp;ldquo;are not&amp;rdquo; and &amp;ldquo;we will&amp;rdquo; respectively. &lt;/p&gt;
&lt;p&gt;Here is a word cloud of the most common 100 words in the trending titles. The size of the word reflects how common it is:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-commwords.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;You can see that the most common word is &amp;ldquo;the&amp;rdquo; because it is the largest. You can also see large &amp;ldquo;a&amp;rdquo;, &amp;ldquo;to&amp;rdquo;, and &amp;ldquo;in&amp;rdquo;. Such words are called &lt;a href="https://en.wikipedia.org/wiki/Stop_words"&gt;stop words&lt;/a&gt;. Stop words are words that are very common in a given language (English in our case). To get better results, we will exclude stop words from our analysis.&lt;/p&gt;
&lt;p&gt;After excluding stop words, we get this word cloud:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-commwords-exc.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can now see more meaningfully the most common words in trending-videos titles. To see the exact commonness (frequency) values, the following table shows the most common 15 words with their frequencies:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-commtable.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For more details on the process, method used for word tokenization, stop words specifications, etc., please review the code in the project notebook.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now let&amp;rsquo;s see what are the &lt;strong&gt;most common symbols&lt;/strong&gt; in the titles of trending videos. Previously, we ignored symbols to produce the word clouds above. Now, we will consider only symbols. The table below shows the most common symbols:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-commstbl.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that &amp;ldquo;&lt;strong&gt;-&lt;/strong&gt;&amp;rdquo; is the most occurring symbol. It occurred around &lt;strong&gt;23,000&lt;/strong&gt; times in trending titles. After that comes the pipe &amp;ldquo;|&amp;rdquo; which occurred around 21,000 times in trending titles. Then we find &amp;ldquo;.&amp;rdquo; which occurred 16,560 time. &lt;/p&gt;
&lt;p&gt;Now considering only emoji symbols, let&amp;rsquo;s see the &lt;strong&gt;most common emojis&lt;/strong&gt; in the titles of trending videos:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-commem.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;So 🔥 is the most common with frequency of 154 followed by ™️ then ®.&lt;/p&gt;
&lt;!--

&lt;div class='sub-form-cont'&gt;
  &amp;lt;!-- &lt;div class="sub-img"&gt;&lt;img src="/assets/images/2021/lb4.png" &gt;&lt;/div&gt; --&amp;gt;
  &lt;p&gt;&lt;span class="sub-sp1"&gt;Hey! 👋&lt;/span&gt;&lt;br&gt; If you like this analysis, I have good news for you: Recently I launched Trendflow, &lt;strong&gt;a tool to study and discover 
  YouTube trends&lt;/strong&gt;. With an interactive dashboard and many data visualizations, you can do most of the analyses in this page with regularly updated data and thousands of trending videos. &lt;a href="https://www.trendflow.in/?src=yt_analysis_2_post" target="_blank"&gt;Click here&lt;/a&gt; to know more and access the tool.&lt;/p&gt;
&lt;/div&gt;
--&gt;

&lt;h4 id="what-are-the-most-common-2-grams-in-video-titles"&gt;What are the Most Common 2-Grams in Video Titles?&lt;/h4&gt;
&lt;p&gt;But first, what are 2-grams? A 2-gram is a sequence of 2 words. For example, if we have the following sentence: &amp;ldquo;How are you today?&amp;rdquo;, then we can extract three 2-grams out of it: &amp;ldquo;How are&amp;rdquo;, &amp;ldquo;are you&amp;rdquo;, &amp;ldquo;you today?&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;If we extract the 2-grams from all trending-videos titles, what will be the most common ones? The word cloud below answers this question. Notice that the words of each 2-gram are connected with a &amp;ldquo;-&amp;ldquo;.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-comm2g.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And the following table shows the exact frequencies of the 5 most-common 2-grams:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-comm2gt.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;In the word cloud, we can identify some trends: we can see &amp;ldquo;reacts to&amp;rdquo;, &amp;ldquo;react to&amp;rdquo;, &amp;ldquo;avenger endgame&amp;rdquo;, &amp;ldquo;star wars&amp;rdquo;, &amp;ldquo;anwar jibawi&amp;rdquo;, etc.&lt;/p&gt;
&lt;h4 id="titles-lengths"&gt;Titles Lengths&lt;/h4&gt;
&lt;p&gt;How long are trending-videos titles? The following box plot answers this question by showing the distribution of titles lengths.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-titdist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that most trending videos have a title length between 36 and 64 characters. The average title length is 51 characters. The maximum title length is 100 which is the maximum title limit on YouTube and the minimum title length is 3. There is, actually, one video with a title length of 3 which is this video titled &amp;ldquo;DHL&amp;rdquo; which appeared on the trending list for 7 days:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-mintit.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3 id="trending-channels"&gt;Trending Channels&lt;/h3&gt;
&lt;p&gt;Which channels produced more trending videos? The following bar chart tells us the answer:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-topch.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that &lt;a href="https://www.youtube.com/user/LinusTechTips/?source=ammar-alyousfi"&gt;&lt;strong&gt;Linus Tech Tips&lt;/strong&gt;&lt;/a&gt; is the channel with most trending videos (365 videos). And the surprise is that it is a technology channel! This channel started in 2008 and has now (22/June/2020) 5,018 published videos. This is how it looks now:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-linus.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And these are their most popular videos as of now:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-linmostpop.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And this is how &lt;a href="https://www.youtube.com/watch?v=zGJSFTaFJbQ"&gt;their first video&lt;/a&gt; looked like back in 2008:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-linus1st.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The second channel&lt;/strong&gt; with most trending videos is &lt;a href="https://www.youtube.com/user/bgfilms"&gt;Binging with Babish&lt;/a&gt; with 361 trending videos. This channel started in 2006 and has now 311 published videos. This is how it looks now:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-bingwb.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And these are their most popular videos as of now:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-bingmostpop.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And this is how &lt;a href="https://www.youtube.com/watch?v=RwGfqexvlts"&gt;their first video&lt;/a&gt; looked like back in 2007:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-bingfirst.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And finally, &lt;strong&gt;the third&lt;/strong&gt; top channel in the number of trending videos is &lt;a href="https://www.youtube.com/user/BonAppetitDotCom/featured"&gt;Bon Appétit&lt;/a&gt; with 355 trending videos. This channel started back in 2008 and has now 1,149 published videos. This is how the channel page looks like now:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-bona.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And these are their most popular videos as of now:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-bonamostpop.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And this is their &lt;a href="https://www.youtube.com/watch?v=9dJ1ZTS_rv8"&gt;first video&lt;/a&gt; published in 2012:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-bonafirst.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3 id="trending-videos-categories"&gt;Trending Videos Categories&lt;/h3&gt;
&lt;p&gt;YouTube groups videos into categories. Example categories are: Entertainment, Music, Sports, Comedy, Education, etc. The following bar chart shows &lt;strong&gt;the number of trending videos for each category&lt;/strong&gt;. The chart doesn&amp;rsquo;t include all categories because there are some categories with no trending videos in 2019.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-topcat.png"&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Entertainment&lt;/strong&gt; category comes first with 20,849 trending videos (28.6% of 2019&amp;rsquo;s trending videos). After Entertainment comes &lt;strong&gt;Music&lt;/strong&gt; category with 10,236 trending videos (14% of 2019&amp;rsquo;s trending videos). Then at the third place comes &lt;strong&gt;Sports&lt;/strong&gt; category with 7,565 trending videos (10.4% of 2019&amp;rsquo;s trending videos).&lt;/p&gt;
&lt;p&gt;Looking at this graph gives an idea on what types of videos appear on the trending list more than others. &lt;/p&gt;
&lt;h3 id="when-were-trending-videos-published"&gt;When were Trending Videos Published?&lt;/h3&gt;
&lt;p&gt;Were there more trending videos published on Saturday more than on Monday? Were there more trending videos published in the evening more than the morning? Let&amp;rsquo;s answer these questions with nice visualizations.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: The following two graphs show dates/times in GMT time zone which is now 4 hours ahead of Washington, DC.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The following graph shows the number of trending videos published in every day of the week sorted by the number of videos:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-popdays.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that there were more trending videos published on &lt;strong&gt;Tuesday&lt;/strong&gt; (11,986) than the other days of the week. All other days of the week except Saturday are not far behind Tuesday. For Saturday, there were only 7,345 trending videos published on it.&lt;/p&gt;
&lt;p&gt;The following graph shows the number of trending videos published in every hour of the day starting with 0 which represents 12 AM and ending with 23 which represents 11 PM:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-pophours.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that the peak hours for publishing trending videos were between 16 and 18 (i.e. between 4 PM and 6 PM). If we translate this to Washington time (with daylight saving time in effect), we see that &lt;strong&gt;the peak hours were between 12 PM and 2 PM Washington time&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We can also see that much fewer trending videos were published between 6 and 11 (i.e. between 6 AM and 11 AM) which is between 2 AM and 7 AM in Washington time (with daylight saving time in effect).&lt;/p&gt;
&lt;p&gt;The two graphs above don&amp;rsquo;t &lt;em&gt;necessarily&lt;/em&gt; mean that videos published on Tuesday have higher chances of becoming trending because Tuesday might be the day that witnessed more uploaded videos in general than other days. So we need to know the number of all videos (not just trending videos) that were published on each day of the week in 2019 to be able to make such claims. The same applies for hours of the day as well.&lt;/p&gt;
&lt;h3 id="trending-videos-and-comments"&gt;Trending Videos and Comments&lt;/h3&gt;
&lt;p&gt;How many comments trending videos have? The histogram below answers this question by showing the distribution of the number of comments for our trending videos:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-comm-dist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Notice that the y-axis is log scaled. It is 10, 100, 1000… not 10, 20, 30…&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We can see that the vast majority of trending videos have less than 100,000 comments. More precisely, 98.7% of trending videos have less than 100,000 comments and 90% of trending videos have less than 23,926 comments.&lt;/p&gt;
&lt;p&gt;We can notice that there are some videos with huge numbers of comments: we see one video with ~3,100,000 comments; we also see other few videos with numbers of comments ranging between 600,000 and 3,100,000.&lt;/p&gt;
&lt;p&gt;The table below shows the &lt;strong&gt;top 3 trending videos based on the number of comments&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-top3-comm.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that &amp;ldquo;Boy With Luv&amp;rdquo; song by BTS band had the largest number of comments (3,120,684). We saw previously that this song had the largest number of views as well. After this song comes YouTube Rewind 2018 video with 2,439,661 comments then &amp;ldquo;Kill This Love&amp;rdquo; song by BLACKPINK band with 1,051,015 comments.&lt;/p&gt;
&lt;h4 id="how-many-comments-videos-had-when-they-first-became-trending"&gt;How Many Comments Videos Had When they First Became Trending?&lt;/h4&gt;
&lt;p&gt;Like we did with the number of views, we will see the number of comments videos have when whey appear on the trending list for the first time. The following graph shows us that:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-commf-dist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Notice that the y-axis is log scaled. It is 10, 100, 1000… not 10, 20, 30…&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We can see that the vast majority of videos had less than 50,000 comments when they first appeared on the trending list. In fact: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;90&lt;/strong&gt;% of trending videos became trending for the first time when they had less than &lt;strong&gt;14,485&lt;/strong&gt; comments. &lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;minimum&lt;/strong&gt; number of comments a &lt;a href="https://www.youtube.com/watch?v=l_VzDEr_xx0"&gt;video&lt;/a&gt; had when it first became trending was &lt;strong&gt;7&lt;/strong&gt; comments only. &lt;/li&gt;
&lt;li&gt;The average number of comments a video had when it first became trending was &lt;strong&gt;7,718&lt;/strong&gt; comments. The median (the 50th percentile value) was &lt;strong&gt;3,056&lt;/strong&gt; comments.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="trending-videos-and-likes-and-dislikes"&gt;Trending Videos and Likes.. and Dislikes&lt;/h3&gt;
&lt;p&gt;Similar to what we did with views and comments, we want to see the distribution of the number of likes/dislikes for trending videos. The histogram below shows the likes distribution:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-likes-dist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Notice that the y-axis is log scaled. It is 10, 100, 1000… not 10, 20, 30…&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;95% of trending videos have less than 500,000 likes and 72.4% have less than 100,000 likes.&lt;/p&gt;
&lt;p&gt;The table below shows &lt;strong&gt;the 3 most liked trending videos&lt;/strong&gt; in 2019:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-top3-likes.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Then we move to dislikes. This histogram shows the distribution of dislikes of our trending videos:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-dislikes-dist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Notice that the y-axis is log scaled. It is 10, 100, 1000… not 10, 20, 30…&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;99.4% of trending videos have less than 100,000 dislikes and 91.5% have less than 10,000 dislikes.&lt;/p&gt;
&lt;p&gt;The following table shows &lt;strong&gt;the 3 most disliked trending videos&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-top3-dislikes.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that YouTube Rewind videos of 2018 and 2019 are the two most disliked trending videos in 2019. Note that the number of dislikes for the three videos in the table is larger than the number of likes but they became trending despite that.&lt;/p&gt;
&lt;p&gt;And although &amp;ldquo;Boy With Luv&amp;rdquo; song was the most liked trending video as we saw above, it is also the 5th most disliked video with 446,003 dislikes.&lt;/p&gt;
&lt;h3 id="how-long-does-it-take-a-video-to-become-trending"&gt;How Long Does it Take a Video to Become Trending?&lt;/h3&gt;
&lt;p&gt;In other words, how many days are between publishing a video and its appearance on the trending list? The box plot below can answer this question:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-days-trend.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;On average, a video appears on the trending list after 5.6 days of publishing it. Also, 95% of the videos took less than 13 days to appear on the trending list. We can also see that there were some videos that appeared on the trending list in less than a day.&lt;/p&gt;
&lt;p&gt;Now if we consider only the first appearance of a video on the trending list, we get this box plot:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-daysf-trend.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;In this case, the video takes on average 1.5 days to become trending. And 97% of the videos appeared on the trending list in less than 2 days after they were published. &lt;/p&gt;
&lt;h3 id="trending-videos-descriptions"&gt;Trending Videos Descriptions&lt;/h3&gt;
&lt;h4 id="how-long-is-the-description"&gt;How Long is the Description?&lt;/h4&gt;
&lt;p&gt;We know that each YouTube video can have a description and that the maximum length of the description is 5,000 characters. Now we ask: How long are the descriptions of trending videos? The box plot below tells us the answer:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-desclength.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Here are some facts about trending videos descriptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The average description length is &lt;strong&gt;1,129&lt;/strong&gt; characters&lt;/li&gt;
&lt;li&gt;Only 281 videos had no description&lt;/li&gt;
&lt;li&gt;95% of the videos had less than 2,875 characters in their descriptions&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="most-common-words-in-trending-videos-descriptions"&gt;Most Common Words in Trending Videos Descriptions&lt;/h4&gt;
&lt;p&gt;The following word cloud shows the most common words in the descriptions of trending videos similar to what was done for video titles. This word cloud shows the most common 100 words after excluding stop words and after expanding the contractions (See the titles section above for the meaning of that).&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-desc-commwords.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that &amp;ldquo;https&amp;rdquo;, &amp;ldquo;http&amp;rdquo;, &amp;ldquo;com&amp;rdquo;, and &amp;ldquo;www&amp;rdquo; are among the most common words. This indicates that trending videos descriptions contain many URLs. We also can see that names of social media platforms like &amp;ldquo;instagram&amp;rdquo;, &amp;ldquo;twitter&amp;rdquo;, and &amp;ldquo;facebook&amp;rdquo; are quite common also. This indicates that trending videos descriptions contain links to these platforms.&lt;/p&gt;
&lt;p&gt;The following table shows the 10 most common words in the descriptions of trending videos with their exact frequency:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-desc-top15w.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;And the following word cloud shows the most common 2-grams in trending videos descriptions (Again, see the titles section above for the meaning of 2-grams):&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-comm2g-desc.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that websites URLs are very common 2-grams in trending videos descriptions.&lt;/p&gt;
&lt;h4 id="does-trending-videos-descriptions-contain-hashtags"&gt;Does Trending Videos Descriptions Contain Hashtags?&lt;/h4&gt;
&lt;p&gt;How many trending videos contain hashtags (like #abc) in their descriptions? It turns out that 33% of trending videos include hashtags in their descriptions. This leads us to another question: How many hashtags do those descriptions have? The following box plot answers this question. It shows the distribution of the number of hashtags in the description:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-hashdesc.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Note that this plot considers only videos that have hashtags in their descriptions. We can see that most of these videos have less than 6 hashtags. The average number of hashtags in description is 2.7 hashtags. And 94% of those videos have less than 6 hashtags in the description.&lt;/p&gt;
&lt;h3 id="trending-videos-tags"&gt;Trending Videos Tags&lt;/h3&gt;
&lt;p&gt;When you upload a video to YouTube, you can add tags to the video. Tags are not displayed on the video page; you can see them by viewing the source code of the page or by using browser extensions such as &lt;a href="https://www.tubebuddy.com/"&gt;TubeBuddy&lt;/a&gt; and &lt;a href="https://vidiq.com/"&gt;vidIQ&lt;/a&gt;. There is a lot of debate on whether tags affect how YouTube algorithm deals with the video. Does adding effective tags make the algorithm show the video to more people on YouTube? Do tags affect where a video appears in the search results? No one knows certainly. When you upload a video, you find this written above the tag section:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Tags can be useful if content in your video is commonly misspelled. Otherwise, tags play a minimal role in helping viewers find your video.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But if that was true, why would YouTube add a lot of tags to their videos? For example, YouTube Rewind video of 2019 has all of these tags:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rewind, Rewind 2019, youtube rewind 2019, #YouTubeRewind, MrBeast, PewDiePie, James Charles, Shane Dawson, CaseyNeistat, RiceGum, Simone Giertz, JennaMarbles, Lilly Singh, emma chamberlain, The Try Guys, Fortnite, Minecraft, Roblox, Marshmello, Garena Free Fire, GTA V, Lachlan, Anaysa, jeffreestar, Noah Schnapp, Jennelle Eliana, T-Series, Azzyland, LazarBeam, Dude Perfect, David Dobrik, KSI, NikkieTutorials, Kurzgesagt, Jelly, Ariana Grande, Billie Eilish, BLACKPINK, Year in Review&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Apart from this discussion, this following violin plot shows the distribution of the number of tags in trending videos. This plot lets us know how many tags trending videos have:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-tagdist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that most of trending videos have between 10 and 30 tags. Here are some interesting facts about trending videos tags:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The average number of tags a trending video has is &lt;strong&gt;21&lt;/strong&gt; tags. &lt;/li&gt;
&lt;li&gt;Only 3.5% of trending videos have no tags.&lt;/li&gt;
&lt;li&gt;The minimum number of tags a trending video has is 0.&lt;/li&gt;
&lt;li&gt;The maximum number of tags a trending video has is 73.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After we explored the number of tags for trending videos, let&amp;rsquo;s see now the length of the tags of trending videos. YouTube allows you to put as many tags as you want, but the limit is 500 characters. So all the tags of a YouTube videos combined must not exceed 500 characters. Let&amp;rsquo;s see the tags lengths of trending videos.&lt;/p&gt;
&lt;p&gt;The following violin plot shows us the distribution of tags length for trending videos:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-taglendist.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Tags length ranges from 0 to 457. Almost all tags lengths are equally common, but we see the peak between 400 and 450 characters. Here are some facts about tags length of trending videos:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On average, the length of the tags of a trending video is &lt;strong&gt;251 characters&lt;/strong&gt; which is half the allowed size of 500 characters.&lt;/li&gt;
&lt;li&gt;The minimum tags length a trending video has is 0 characters.&lt;/li&gt;
&lt;li&gt;The maximum tags length a trending video has is 457 characters.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="most-common-words-in-trending-videos-tags"&gt;Most Common Words in Trending Videos Tags&lt;/h4&gt;
&lt;p&gt;As we did with titles and descriptions, let&amp;rsquo;s see the most common words in the tags of trending videos. The word cloud below shows us the most common 100 words:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-tags-commwords.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;We can see that words like &amp;ldquo;video&amp;rdquo; &amp;ldquo;2019&amp;rdquo;, &amp;ldquo;funny&amp;rdquo;, etc. are more common than the other words. The table below shows the &lt;strong&gt;most common 15 words&lt;/strong&gt; with their exact frequency:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-topcomm-tags.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;After we saw the most common words in video tags, let&amp;rsquo;s now see the most common tags used in trending videos which are shown in this word cloud:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-tags-comm.png"&gt; &lt;/p&gt;
&lt;h3 id="correlations-of-trending-videos"&gt;Correlations of Trending Videos&lt;/h3&gt;
&lt;p&gt;Now let&amp;rsquo;s see how different metrics of trending videos are &lt;a href="https://www.mathsisfun.com/data/correlation.html"&gt;correlated&lt;/a&gt;. We want to see how views are correlated with likes and how title length is correlated with views and more. Let&amp;rsquo;s visualize the correlation between different metrics by using a heatmap:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-corr.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;In this heatmap, lighter colors indicate higher positive correlation and darker colors indicate lower positive correlation (and sometimes negative correlation). The highest possible positive correlation is 1 and the highest possible negative correlation (which is the lowest possible positive correlation) is -1.&lt;/p&gt;
&lt;p&gt;We can see that there is a high positive correlation (0.81) between views and likes. This means that they tend to increase together in trending videos. We can also notice a significant positive correlation (0.61) between comments and views. Also, there is a significant positive correlation between comments and likes and between comments and dislikes.&lt;/p&gt;
&lt;h3 id="what-are-the-most-used-colors-in-trending-videos-thumbnails"&gt;What are the Most Used Colors in Trending Videos Thumbnails?&lt;/h3&gt;
&lt;p&gt;YouTube video thumbnails are the small images you see when you browse YouTube videos:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-thumbsex.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Thumbnails &lt;strong&gt;play now an important role&lt;/strong&gt; in the success of a YouTube video because they affect the click-through rate (how many people click on your video when they see it). Click-through rate have a significant impact on how YouTube publishes your video. Higher click-through rate means that YouTube will show your video to more and more people. High click-through rate communicate to YouTube algorithm that your video is attractive because people are clicking on it.&lt;/p&gt;
&lt;p&gt;So now that you know the importance of thumbnails, you should also know that many successful YouTubers spend big amounts of time trying to create the perfect thumbnail that will attract people and make them click on their videos. &lt;/p&gt;
&lt;p&gt;And because we have all of 2019&amp;rsquo;s trending videos to analyze, let&amp;rsquo;s analyze the thumbnails of these trending videos to see what are the most used colors in those thumbnails. To find the most used colors: First, we downloaded the thumbnails of the trending videos &lt;strong&gt;without considering duplicates&lt;/strong&gt;. This means that for a video that became trending more than one time (say 5 times), we downloaded one copy only of its thumbnail (not 5 copies). &lt;/p&gt;
&lt;p&gt;After downloading the thumbnail image for each unique trending video, we counted the colors of the pixels of these thumbnails. We had 11,177 thumbnails for 11,177 unique video. Each thumbnail image size is 320 x 180 which means that each thumbnail contains 57,600 pixels. This means that all thumbnails have 643,795,200 pixels. We got the color of each pixel and then counted the number of occurrences of each color. The resulting dictionary looked like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;{
 (255, 255, 255): 7572881,
 (254, 255, 255): 660165,
 (251, 255, 255): 280416,
 (249, 255, 255): 154100,
 (248, 255, 255): 131042,
 (255, 254, 255): 626143,
 ...
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This dictionary contained 4,098,274 unique colors. For example, the snippet above says that 7,572,881 pixels are white. The RGB color (255, 255, 255) represents the white color. It says also that 660,165 pixels are white but their RGB representation is (254, 255, 255). The two RGB colors (255, 255, 255) and (254, 255, 255) are white; you cannot distinguish between them by your eye, but they are different in the RGB representation. &lt;/p&gt;
&lt;p&gt;So we cannot use that dictionary to find the most used colors because if you look at the 100 most common colors in that dictionary, you will find them either white or black (different but very similar shades of white and black as we saw in the example above). Here in the following image, you see the 100 most common colors according to that dictionary:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-100clr.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;As you can see, they are essentially white and black colors with a few grey colors.&lt;/p&gt;
&lt;p&gt;The approach we followed then to find the most used colors was by taking the most common 10,000 colors from that dictionary then removing &amp;ldquo;duplicate&amp;rdquo; colors. For example, we kept only one black and removed all other blacks that were similar to that black. &lt;/p&gt;
&lt;p&gt;To measure the similarity between two RGB colors, we converted the colors to Lab colors and calculated the Euclidean distance between these Lab colors. Then we considered the colors similar if the following quantity fell between 0.9 and 1.0:
$$
\frac{375.6-\text{Euclidean distance}}{375.6}
$$
where 375.6 is the maximum possible distance between two Lab colors.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After this process, we ended up with 19 colors which are the most used colors in video thumbnails&lt;/strong&gt;. Here are the colors sorted by popularity:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-colors.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3 id="whats-inside-trending-videos-thumbnails"&gt;What&amp;rsquo;s Inside Trending Videos Thumbnails?&lt;/h3&gt;
&lt;p&gt;Similar to what we did in the previous section when we analyzed &lt;strong&gt;unique&lt;/strong&gt; trending videos thumbnails to find the most used colors, now we will analyze the thumbnails to find what is inside those thumbnails. People? Cars? Buildings?&lt;/p&gt;
&lt;p&gt;As we saw in the previous section, we have 11,177 thumbnail images. We cannot look at them one by one to see what&amp;rsquo;s inside them. Instead, we will use &lt;strong&gt;artificial intelligence&lt;/strong&gt;. In particular, we will use computer vision to see what&amp;rsquo;s inside the thumbnails. We will use an &lt;strong&gt;object detection algorithm&lt;/strong&gt; that can find objects (people, cars, etc.) in images.&lt;/p&gt;
&lt;p&gt;We used the TinyYOLOv3 algorithm. For more technical details, you can view the code by following the link in the &amp;ldquo;Code Used&amp;rdquo; section above. After running the algorithm on all the thumbnails, we got the objects that appeared in the thumbnails and the number of occurrences of each object.&lt;/p&gt;
&lt;p&gt;The bar chart below shows the top 7 items that appeared in trending videos thumbnails the most:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/yta2-objects.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;So a person image appears more than 1,000 times in trending videos thumbnails. This makes it more common than all other objects detected by the algorithm like ties, cars, bowls, bottles, etc.&lt;/p&gt;
&lt;p&gt;As mentioned above, we used TinyYOLOv3 algorithm which is fast but may not be the most effective algorithm. We might try running a more sophisticated algorithm to see what objects it will detect.&lt;/p&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In this post, we saw the results of analyzing YouTube trending videos of 2019. For me, the results were interesting and insightful. Hope they were the same for you.&lt;/p&gt;
&lt;!--

&lt;div class='sub-form-cont'&gt;
  &amp;lt;!-- &lt;div class="sub-img"&gt;&lt;img src="/assets/images/2021/lb4.png" &gt;&lt;/div&gt; --&amp;gt;
  &lt;p&gt;&lt;span class="sub-sp1"&gt;Hey! 👋&lt;/span&gt;&lt;br&gt; If you like this analysis, I have good news for you: Recently I launched Trendflow, &lt;strong&gt;a tool to study and discover 
  YouTube trends&lt;/strong&gt;. With an interactive dashboard and many data visualizations, you can do most of the analyses in this page with regularly updated data and thousands of trending videos. &lt;a href="https://www.trendflow.in/?src=yt_analysis_2_post" target="_blank"&gt;Click here&lt;/a&gt; to know more and access the tool.&lt;/p&gt;
&lt;/div&gt;
--&gt;

&lt;p class="text-box-1"&gt;If you want to &lt;strong&gt;download the data&lt;/strong&gt; used in this analysis which describes 2019's trending videos in the United States, you can buy it securely on Gumroad &lt;u&gt;&lt;strong&gt;&lt;a href="https://gum.co/qEzKK" target="_blank"&gt;on this link&lt;/a&gt;&lt;/strong&gt;&lt;/u&gt; or by using the button below. Along with United States, you'll also get trending-videos data for United Kingdom, Canada, Denmark, Malaysia, Saudi Arabia, and other countries as well.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;script src="https://gumroad.com/js/gumroad.js"&gt;&lt;/script&gt;
&lt;p style="text-align:center"&gt;&lt;a class="gumroad-button" href="https://gum.co/qEzKK" target="_blank"&gt;Buy the data&lt;/a&gt;&lt;/p&gt;

&lt;style&gt;
  #markdown-toc #markdown-toc-analysis-results {
    font-weight: bold;
    font-weight: 600;
  }
&lt;/style&gt;</content><category term="data-science"/><category term="data-science"/><category term="data-analysis"/><category term="data-visualization"/><category term="video-analysis"/><category term="data-science-project"/><category term="python"/><category term="pandas"/><category term="matplotlib"/><category term="youtube-analysis"/></entry><entry><title>تعلم البرمجة بلغة بايثون #19: الحلقات في بايثون Loops in Python</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-19-arabic.html" rel="alternate"/><published>2020-07-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-07-01:/ar/2020/learn-programming-with-python-1-19-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #19&amp;quot;" src="/assets/images/2020/pyc-19-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنبدأ الحديث عن الحلقات التكرارية. باستخدام الحلقات نجعل الكومبيوتر يقوم بمهام تكرارية، يكرر تنفيذ أوامر لعدد كبير من المرات. نحن لا نحب أن نقوم بمهام كهذه. حتى وإن أردنا القيام بها ستتطلب منا وقتاً طويلاً. لكن باستخدام الكومبيوتر نحصل على النتائج بلمح البصر.&lt;/p&gt;
&lt;p&gt;هناك نوعان من الحلقات …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #19&amp;quot;" src="/assets/images/2020/pyc-19-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنبدأ الحديث عن الحلقات التكرارية. باستخدام الحلقات نجعل الكومبيوتر يقوم بمهام تكرارية، يكرر تنفيذ أوامر لعدد كبير من المرات. نحن لا نحب أن نقوم بمهام كهذه. حتى وإن أردنا القيام بها ستتطلب منا وقتاً طويلاً. لكن باستخدام الكومبيوتر نحصل على النتائج بلمح البصر.&lt;/p&gt;
&lt;p&gt;هناك نوعان من الحلقات التكرارية في بايثون: حلقات &lt;code&gt;while&lt;/code&gt; وحلقات &lt;code&gt;for&lt;/code&gt;. سنبدأ بالحديث عن حلقات &lt;code&gt;while&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;تكلمنا بشكل مبسط عن الحلقات عندما شرحنا النمط التكراري لسير البرامج في درس سابق. لنعد الآن إلى المثال الذي رأيناه في ذلك الدرس:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Finished&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول ننشئ متغيراً اسمه &lt;code&gt;n&lt;/code&gt; ونضع فيه الرقم 5. ثم نأتي لنجد كلمة &lt;code&gt;while&lt;/code&gt; والتي تعني أننا سندخل حلقة تكرارية. دائماً مع كل &lt;code&gt;while&lt;/code&gt; ومع كل حلقة تكرارية هناك شرط، مثل شرط &lt;code&gt;if&lt;/code&gt;. إذا تحقق الشرط ندخل الحلقة وننفذ التعليمات التي بداخلها وإن لم يتحقق نتجاوز الحلقة ونتجاهل التعليمات التي بداخلها. &lt;/p&gt;
&lt;p&gt;فوصلنا إلى &lt;code&gt;while&lt;/code&gt;. الشرط هنا هو: &lt;code&gt;n &amp;gt; 0&lt;/code&gt; يعني هنا نطرح سؤالاً: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ إذا كان الجواب &lt;code&gt;True&lt;/code&gt; ندخل الحلقة وإن كان &lt;code&gt;False&lt;/code&gt; نتجاوز الحلقة. بما أن قيمة &lt;code&gt;n&lt;/code&gt; هي 5، و 5 أكبر من 0، إذن تحقق الشرط وسندخل الحلقة. &lt;/p&gt;
&lt;p&gt;دخلنا الحلقة. أول تعليمة تصادفنا داخل الحلقة هي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;والتي ستطبع قيمة &lt;code&gt;n&lt;/code&gt; على الشاشة. بعدها نأتي للتعليمة الثانية داخل الحلقة:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هذه التعليمة ستطرح 1 من قيمة &lt;code&gt;n&lt;/code&gt;.  فـ &lt;code&gt;n&lt;/code&gt; كانت 5، ستصبح الآن 4. الآن أين سنذهب؟ سنعود إلى بداية الحلقة، وبالتحديد إلى شرط الحلقة، وسنسأل مرة أخرى: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ الآن &lt;code&gt;n&lt;/code&gt; تساوي 4، و 4 أكبر من 0، إذن جواب الشرط &lt;code&gt;True&lt;/code&gt; وسيتم تنفيذ تعليمات الحلقة مرة أخرى. سيتم طباعة قيمة &lt;code&gt;n&lt;/code&gt; ثم طرح 1 من قيمة &lt;code&gt;n&lt;/code&gt;. ستصبح قيمة &lt;code&gt;n&lt;/code&gt; عندها تساوي 3. &lt;/p&gt;
&lt;p&gt;نعود بعدها إلى شرط الحلقة. نسأل: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ وبما أن &lt;code&gt;n&lt;/code&gt; تساوي الآن 3 فسيكون جواب الشرط &lt;code&gt;True&lt;/code&gt; وسيتم تنفيذ تعليمات الحلقة مرة أخرى. سيتم طباعة قيمة &lt;code&gt;n&lt;/code&gt; ثم طرح 1 من قيمة &lt;code&gt;n&lt;/code&gt;. ستصبح قيمة &lt;code&gt;n&lt;/code&gt; عندها تساوي 2. &lt;/p&gt;
&lt;p&gt;نعود بعدها مرة أخرى إلى شرط الحلقة. نسأل: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ وبما أن &lt;code&gt;n&lt;/code&gt; تساوي الآن 2 فسيكون جواب الشرط &lt;code&gt;True&lt;/code&gt; وسيتم تنفيذ تعليمات الحلقة مرة أخرى. سيتم طباعة قيمة &lt;code&gt;n&lt;/code&gt; ثم طرح 1 من قيمة &lt;code&gt;n&lt;/code&gt;. ستصبح قيمة &lt;code&gt;n&lt;/code&gt; عندها تساوي 1. &lt;/p&gt;
&lt;p&gt;نعود بعدها مرة أخرى إلى شرط الحلقة. نسأل: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ وبما أن &lt;code&gt;n&lt;/code&gt; تساوي الآن 1 فسيكون جواب الشرط &lt;code&gt;True&lt;/code&gt; وسيتم تنفيذ تعليمات الحلقة مرة أخرى. سيتم طباعة قيمة &lt;code&gt;n&lt;/code&gt; ثم طرح 1 من قيمة &lt;code&gt;n&lt;/code&gt;. ستصبح قيمة &lt;code&gt;n&lt;/code&gt; عندها تساوي 0. &lt;/p&gt;
&lt;p&gt;الآن نعود مرة أخرى إلى شرط الحلقة ونسأل: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ الآن &lt;code&gt;n&lt;/code&gt; تساوي 0، و 0 يساوي 0، لكن 0 ليس أكبر من 0. إذن هذه المرة سيكون جواب الشرط &lt;code&gt;False&lt;/code&gt; وهذا يعني أننا انتهينا من أمر حلقة &lt;code&gt;while&lt;/code&gt; هذه وسننتقل إلى ما بعدها. ماذا يأتي بعدها؟ تأتي تعليمة الطباعة والتي ستطبع &amp;ldquo;Finished&amp;rdquo; على الشاشة.&lt;/p&gt;
&lt;p&gt;المخطط التالي يوضح كيفية سير البرنامج:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/pyc-19-2.png"&gt;&lt;/p&gt;
&lt;p&gt;المتغير &lt;code&gt;n&lt;/code&gt; في هذا المثال يمكن أن نسميه متغير الحلقة، يعني هو المتغير الذي يعتمد شرط الحلقة عليه. ماذا لو كان البرنامج بهذا الشكل؟&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python
n = 5
while n &amp;gt; 0:
  print(n)
print('Finished')&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;ما الذي سيحدث عند تنفيذ هذا البرنامج؟&lt;/p&gt;
&lt;p&gt;في هذا البرنامج: الحلقة لا تحتوي على تعليمة إنقاص قيمة &lt;code&gt;n&lt;/code&gt;. هذا سيؤدي إلى أن نكرر الحلقة لعدد لا نهائي من المرات، يعني أنه سيتم تكرار تنفيذ تعليمات الحلقة بلا نهاية، وذلك بسبب أن شرط الحلقة سيتحقق دائماً: قيمة &lt;code&gt;n&lt;/code&gt; ستبقى 5، و 5 أكبر من 0، لا يوجد تعليمة لإنقاص قيمة &lt;code&gt;n&lt;/code&gt;. إذن ستستمر بايثون بطباعة قيمة &lt;code&gt;n&lt;/code&gt; وهي 5 بلا نهاية. هذا النوع من الحلقات يسمى الحلقات اللانهائية.&lt;/p&gt;
&lt;p&gt;المثال التالي يعرض حلقة لانهائية من نوع آخر:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;مرحباً&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هذه البرنامج سيقوم بتكرار طباعة كلمة &amp;ldquo;مرحباً&amp;rdquo; بلا نهاية. لاحظ هنا أن شرط الحلقة هو &lt;code&gt;True&lt;/code&gt;، لا يوجد سؤال هنا. يعني هنا اختصرنا قصة السؤال ووضعنا الجواب مباشرة وهو &lt;code&gt;True&lt;/code&gt; وهذه ال &lt;code&gt;True&lt;/code&gt; لا تتغير لأنها قيمة ثابتة وليست متغيراً. فهذه الحلقة ستستمر بالتكرار إلى ما لا نهاية.&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/9zKNy_kDQos" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون #20: الحلقات في بايثون Loops in Python: continue and break</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-20-arabic.html" rel="alternate"/><published>2020-07-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-07-01:/ar/2020/learn-programming-with-python-1-20-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #20&amp;quot;" src="/assets/images/2020/pyc-20-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنكمل حديثنا عن الحلقات في بايثون ونتحدث عن كلمتي break و continue وطريقة استخدامهما في الحلقات.&lt;/p&gt;
&lt;h2 id="break"&gt;تعليمة كسر الحلقة: break&lt;/h2&gt;
&lt;p&gt;هناك كلمة في بايثون يمكن أن نضعها داخل الحلقات. عندما يصل البرنامج إلى هذه الكلمة يتم الخروج مباشرة من الحلقة. هذه الكلمة هي &lt;code&gt;break&lt;/code&gt;. لننظر إلى المثال …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #20&amp;quot;" src="/assets/images/2020/pyc-20-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنكمل حديثنا عن الحلقات في بايثون ونتحدث عن كلمتي break و continue وطريقة استخدامهما في الحلقات.&lt;/p&gt;
&lt;h2 id="break"&gt;تعليمة كسر الحلقة: break&lt;/h2&gt;
&lt;p&gt;هناك كلمة في بايثون يمكن أن نضعها داخل الحلقات. عندما يصل البرنامج إلى هذه الكلمة يتم الخروج مباشرة من الحلقة. هذه الكلمة هي &lt;code&gt;break&lt;/code&gt;. لننظر إلى المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;قف&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;انتهى&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;عندما ننظز إلى هذا المثال نرى حلقة تبدو لانهائية لأن شرط الحلقة هو &lt;code&gt;True&lt;/code&gt; كما رأينا قبل قليل. ماذا يفعل هذا البرنامج؟ عندما يدخل البرنامج في حلقة &lt;code&gt;while&lt;/code&gt; والتي نفترض أن تنفيذها سيستمر بلا توقف لأن شرطها &lt;code&gt;True&lt;/code&gt;، عندما يدخل البرنامج هذه الحلقة يقرأ إدخالاً من المستخدم باستخدام الدالة &lt;code&gt;input&lt;/code&gt; ويقوم بتخزين ما يقرؤه من المستخدم في متغير اسمه &lt;code&gt;line&lt;/code&gt;. ثم يفحص ما أدخله المستخدم باستخدام &lt;code&gt;if&lt;/code&gt;: إذا أدخل المستخدم كلمة &amp;ldquo;قف&amp;rdquo; سيواجه البرنامج كلمة &lt;code&gt;break&lt;/code&gt; ويخرج من الحلقة مباشرة. أما إذا أدخل المستخدم أي شيء آخر سيطبع ما أدخله المستخدم ثم سيكرر تعليمات الحلقة ويقرأ منه إدخالاً آخراً ويستمر في تكرار الحلقة حتى يدخل المستخدم كلمة &amp;ldquo;قف&amp;rdquo;. &lt;/p&gt;
&lt;p&gt;إذن &lt;code&gt;break&lt;/code&gt; يمكن أن تستعمل مع الحلقات لتكرير تنفيذ مجموعة من التعليمات حتى يتحقق الشرط الذي نريده. هذا يمكن أن يكون له تطبيقات مفيدة في برامجك لاحقاً.&lt;/p&gt;
&lt;h2 id="continue"&gt;تعليمة continue&lt;/h2&gt;
&lt;p&gt;هناك تعليمة أخرى تستعمل مع الحلقات وهي تعليمة &lt;code&gt;continue&lt;/code&gt;. ماذا تفعل هذه التعليمة؟ هذه التعليمة تتخطى التكرار الحالي وتنتقل للتكرار التالي في الحلقة. سنرى مثالاً لتوضيحها.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;#&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;continue&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;قف&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;انتهى&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هذا المثال مشابه للمثال الذي رأيناه عندما تكلمنا عن &lt;code&gt;break&lt;/code&gt;. الزيادة في هذا المثال هي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;#&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;كما في مثال &lt;code&gt;break&lt;/code&gt;: في هذا المثال يستمر البرنامج بقراءة إدخال من المستخدم ويطبع هذا الإدخال حتى يدخل المستخدم كلمة &amp;ldquo;قف&amp;rdquo;. عندها يخرج البرنامج من الحلقة ويطبع &amp;ldquo;انتهى&amp;rdquo;. لكن الزيادة هنا أنه إذا أدخل المستخدم شيئاً يبدأ بهذا الرمز: &amp;ldquo;#&amp;rdquo; فإن البرنامج يتجاوز بقية التعليمات داخل الحلقة ويعود إلى بداية الحلقة مرة أخرى، يعني عندما يرى البرنامج كلمة &lt;code&gt;continue&lt;/code&gt; يقفز مباشرة إلى بداية الحلقة، إلى شرط الحلقة.&lt;/p&gt;
&lt;p&gt;لاحظ أننا استخدمنا &lt;code&gt;line[0]&lt;/code&gt; للوصول إلى أول حرف من النص الذي أدخله المستخدم. سنتعلم لاحقاً المزيد عن هذا الأمر.&lt;/p&gt;
&lt;p&gt;إذن &lt;code&gt;break&lt;/code&gt; تخرج من الحلقة إلى التعليمة التي بعد الحلقة. &lt;code&gt;continue&lt;/code&gt; تخرج لتعود إلى بداية الحلقة (شرط الحلقة).&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/qh5cmgraNO4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون #21: الحلقات في بايثون | Loops in Python: for Loop</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-21-arabic.html" rel="alternate"/><published>2020-07-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-07-01:/ar/2020/learn-programming-with-python-1-21-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #21&amp;quot;" src="/assets/images/2020/pyc-21-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنكمل حديثنا عن الحلقات في بايثون ونتحدث عن حلقة for.&lt;/p&gt;
&lt;h2 id="for"&gt;حلقة for&lt;/h2&gt;
&lt;p&gt;تعرفنا سابقاً على حلقة &lt;code&gt;while&lt;/code&gt; ورأينا أنها تتكرر طالما بقي شرطها متحققاً. الآن سنتعرف على حلقة &lt;code&gt;for&lt;/code&gt; وهي نوع آخر من الحلقات تتكرر لعدد محدد (معروف مسبقاً) من المرات.&lt;/p&gt;
&lt;p&gt;لنر المثال التالي عن حلقة &lt;code&gt;for …&lt;/code&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #21&amp;quot;" src="/assets/images/2020/pyc-21-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنكمل حديثنا عن الحلقات في بايثون ونتحدث عن حلقة for.&lt;/p&gt;
&lt;h2 id="for"&gt;حلقة for&lt;/h2&gt;
&lt;p&gt;تعرفنا سابقاً على حلقة &lt;code&gt;while&lt;/code&gt; ورأينا أنها تتكرر طالما بقي شرطها متحققاً. الآن سنتعرف على حلقة &lt;code&gt;for&lt;/code&gt; وهي نوع آخر من الحلقات تتكرر لعدد محدد (معروف مسبقاً) من المرات.&lt;/p&gt;
&lt;p&gt;لنر المثال التالي عن حلقة &lt;code&gt;for&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;انتهى&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذه الحلقة سيتم تكرار تعليمات الحلقة لكل عنصر في هذه القائمة: &lt;code&gt;[1,2,4,5,7]&lt;/code&gt;. هذا يعني أن أمر الطباعة هذا:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;سيتم تنفيذه مرة لكل عنصر في تلك القائمة، وفي كل مرة ستكون قيمة &lt;code&gt;i&lt;/code&gt; نفس قيمة ذلك العنصر. يعني أنه في المرة الأولى لتكرار الحلقة سيتم طباعة &amp;ldquo;1&amp;rdquo; وهو العنصر الأول في القائمة؛ في التكرار الثاني سيتم طباعة &amp;ldquo;2&amp;rdquo; والذي هو العنصر الثاني في القائمة، وهكذا حتى نصل إلى العنصر الأخير وهو &amp;ldquo;7&amp;rdquo; حيث ستتم طباعته ثم تنتهي الحلقة ويتم الخروج منها إلى الأمر الذي بعدها وهو أمر الطباعة الذي سيطبع كلمة &amp;ldquo;انتهى&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;في هذا المثال اخترنا أن يكون اسم متغير الحلقة &lt;code&gt;i&lt;/code&gt; لكن يمكن أن نختار أي اسم نريده. &lt;/p&gt;
&lt;p&gt;في المثال التالي سنمر على قائمة تحتوي على سلاسل نصية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Ahmad&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Leen&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;John&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Happy birthday &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هذا البرنامج سيمر على عناصر هذه القائمة وسيطبع لكل عنصر عبارة تهنئة. في البداية سيمر على &amp;ldquo;Ahmad&amp;rdquo; وبالتالي ستكون قيمة المتغير &lt;code&gt;f&lt;/code&gt; تساوي &amp;ldquo;أحمد&amp;rdquo; وسينفذ الأوامر داخل الحلقة. هناك أمر واحد، أمر الطباعة، فسينفذه ويطبع:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Happy birthday Ahmad
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;ثم سيمر على بقية العناصر ويطبع جملاً مشابهة:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Happy birthday Leen
Happy birthday John
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="for_1"&gt;تحليل حلقة &lt;code&gt;for&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;لننظر إلى المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;عرفنا من دراستنا لحلقة &lt;code&gt;for&lt;/code&gt; أن هذا البرنامج سيمر على عناصر القائمة ويطبعها على الشاشة. هذا البرنامج مكافئ للبرنامج التالي الذي سنكتبه بدون استخدام حلقة &lt;code&gt;for&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هذا يشابه ما تفعله حلقة &lt;code&gt;for&lt;/code&gt;: تمر على كل عنصر، وتجعل متغير الحلقة يحمل قيمة ذلك العنصر، ثم تنفذ التعليمات داخل الحلقة.&lt;/p&gt;
&lt;p&gt;ملاحظة: &lt;code&gt;break&lt;/code&gt; و &lt;code&gt;continue&lt;/code&gt; تعمل مع حلقة &lt;code&gt;for&lt;/code&gt; مثلما تعمل مع حلقة &lt;code&gt;while&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;ملاحظة: رأينا في هذا الدرس شيئاً جديداً هو القوائم. سنتعرف عليها بالتفصيل في المستقبل.&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/d2YJSuQUqlM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الخامس عشر: التقاط الأخطاء باستخدام Try و Except</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-15-arabic.html" rel="alternate"/><published>2020-06-05T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-05:/ar/2020/learn-programming-with-python-1-15-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الخامس عشر: التقاط الأخطاء باستخدام Try و Except&amp;quot;" src="/assets/images/2020/pyc-15-1.png"&gt;&lt;/p&gt;
&lt;p&gt;نستخدم هذه الطريقة عندما نعلم أن هناك جزءاً من الكود يمكن أن يسبب أخطاء عندما يتم تنفيذه. لذلك باستخدام هذه الطريقة نقول لبايثون: خذي هذا الجزء (الموجود داخل &lt;code&gt;try&lt;/code&gt;) وحاولي تنفيذه؛ إذا سار الأمر بدون مشاكل وأخطاء فهذا  ما نريد، ولكن إذا حدث خطأ قومي بتنفيذ أوامر أخرى (موجودة داخل …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الخامس عشر: التقاط الأخطاء باستخدام Try و Except&amp;quot;" src="/assets/images/2020/pyc-15-1.png"&gt;&lt;/p&gt;
&lt;p&gt;نستخدم هذه الطريقة عندما نعلم أن هناك جزءاً من الكود يمكن أن يسبب أخطاء عندما يتم تنفيذه. لذلك باستخدام هذه الطريقة نقول لبايثون: خذي هذا الجزء (الموجود داخل &lt;code&gt;try&lt;/code&gt;) وحاولي تنفيذه؛ إذا سار الأمر بدون مشاكل وأخطاء فهذا  ما نريد، ولكن إذا حدث خطأ قومي بتنفيذ أوامر أخرى (موجودة داخل &lt;code&gt;except&lt;/code&gt;). سنرى تفاصيل ذلك بعد قليل.&lt;/p&gt;
&lt;p&gt;كمثال: افترض أن لدينا هذا البرنامج:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;98&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول أنشأنا متغيراً اسمه &lt;code&gt;v&lt;/code&gt; ووضعنا فيه كلمة &lt;code&gt;"Hello"&lt;/code&gt;. السطر الثاني يقوم بتحويل المتغير &lt;code&gt;v&lt;/code&gt; إلى عدد صحيح (integer) لكن كما رأينا في درس سابق: لا يمكن تحويل أي سلسلة نصية إلى عدد، عندما نستخدم دالة &lt;code&gt;()int&lt;/code&gt; مع سلسلة نصية فيجب أن تكون السلسلة النصية تحتوي على عدد فقط (مثل &lt;code&gt;"78"&lt;/code&gt;). في هذه الحالة: عندما يصل تنفيذ البرنامج إلى السطر الثاني سيحدث خطأ ويتوقف تنفيذ البرنامج. &lt;/p&gt;
&lt;p&gt;لكن ماذا لو أردنا أن لا يتوقف تنفيذ البرنامج؟ نحن نعلم أن استخدام الدالة &lt;code&gt;()int&lt;/code&gt; قد يسبب أخطاء عندما نستخدمها مع قيم غير مناسبة. قد تأتينا القيم من مصادر خارجية لا نتحكم نحن بها ولا نريد لبرنامجنا أن يفشل بسبب ذلك. إذن الحل هو باستخدام &lt;code&gt;try.. except&lt;/code&gt;. سنضع السطر الثاني من البرنامج داخل &lt;code&gt;try&lt;/code&gt; وفي حال حدوث خطأ سنضع الأوامر التي يجب تنفيذها داخل &lt;code&gt;except&lt;/code&gt; كما يلي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;لا يمكن تحويل القيمة المعطاة إلى عدد&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;98&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;الآن ستحاول بايثون تنفيذ الأمر الموجود داخل &lt;code&gt;try&lt;/code&gt; ونحن نعلم في هذا المثال أن هذا الأمر سيسبب خطأ، فعندما يحدث الخطأ وبدلاً من أن يتوقف سير البرنامج ستنتقل بايثون إلى &lt;code&gt;except&lt;/code&gt; وتنفذ الأوامر الموجودة فيها. في هذا المثال: ستطبع أنه لا يمكن تحويل القيمة المعطاة إلى عدد وستنشئ متغيراً يحمل نفس الاسم (&lt;code&gt;g&lt;/code&gt;) وتضع بداخله الرقم &lt;code&gt;0&lt;/code&gt; ثم ستخرج من &lt;code&gt;except&lt;/code&gt;. الآن بعد &lt;code&gt;except&lt;/code&gt; ستكمل تنفيذ البرنامج بشكل اعتيادي.&lt;/p&gt;
&lt;p&gt;لاحظ أن هناك استخدام آخر لدالة &lt;code&gt;()int&lt;/code&gt; في البرنامج لتحويل السلسلة النصية في المتغير &lt;code&gt;t&lt;/code&gt; إلى عدد. لنضع ذلك في &lt;code&gt;try.. except&lt;/code&gt; كما فعلنا قبل قليل:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;لا يمكن تحويل القيمة المعطاة إلى عدد&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;98&amp;#39;&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في مثالنا هذا: السطر الذي يتم فيه تحويل &lt;code&gt;t&lt;/code&gt; إلى عدد سيتم تنفيذه بدون أخطاء لأن السلسة النصية المخزنة في &lt;code&gt;t&lt;/code&gt; تحتوي على عدد، لذلك فإن تحويل هذه السلسلة إلى عدد صحيح باستخدام &lt;code&gt;()int&lt;/code&gt; سيمر بدون أخطاء، ولذلك فلن يتم الدخول إلى &lt;code&gt;except&lt;/code&gt; وسينتقل البرنامج إلى تنفيذ الجملة الأخيرة وهي طباعة قيمة المتغير &lt;code&gt;t&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;لجعل هذا المثال أكثر واقعية سنقوم بتعديله ليصبح كما يلي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;أدخل عدداً&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;لا يمكن تحويل القيمة المعطاة إلى عدد&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;أدخل عدداً&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;الآن جعلنا البرنامج يأخذ قيم المتغيرين &lt;code&gt;v&lt;/code&gt; و &lt;code&gt;t&lt;/code&gt; من المستخدم. المستخدم قد يدخل قيماً غير مناسبة للدالة &lt;code&gt;()int&lt;/code&gt; ولكن بما أننا وضعنا الأوامر التي يمكن أن تسبب أخطاء داخل &lt;code&gt;try&lt;/code&gt; فسيتم تنفيذ برنامجنا حتى آخر سطر بدون أن يحدث خطأ يؤدي إلى توقف البرنامج.&lt;/p&gt;
&lt;p&gt;لاحظ أن طريقة &lt;code&gt;try.. except&lt;/code&gt; تشبه كيفية عمل &lt;code&gt;if&lt;/code&gt; و &lt;code&gt;else&lt;/code&gt; كما رأينا سابقاً.&lt;/p&gt;
&lt;p&gt;هناك أوقات يصبح فيها استخدام &lt;code&gt;try.. except&lt;/code&gt; مهماً. مثلاً إذا كان برنامجك يعمل بشكل دائم لتلقي طلبات وتقديم خدمات، ففي هذه الحالة لا تريد أن يتوقف البرنامج أبداً، وهنا تبرز أهمية طريقة &lt;code&gt;try.. except&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;هناك تفاصيل أخرى عن try و except. مثلاً يمكننا التقاط أنواع محددة من الأخطاء باستخدام except ويمكننا بالتالي تنفيذ أوامر تعتمد على نوع الخطأ. لكن في هذا الدرس يهمنا فقط الأساسيات.&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/Lh2TOhQDG4Y" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون #16: الدوال في بايثون | Functions in Python</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-16-arabic.html" rel="alternate"/><published>2020-06-05T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-05:/ar/2020/learn-programming-with-python-1-16-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #16: الدوال في بايثون&amp;quot;" src="/assets/images/2020/pyc-16-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتحدث عن الدوال في بايثون.&lt;/p&gt;
&lt;p&gt;تكلمنا سابقاً بشكل سريع عن الدوال في بايثون عندما ذكرنا أنماط سير البرامج في بايثون وقلنا أن هناك النمط التسلسلي والنمط الشرطي والنمط التكراري والنمط الوظيفي. الدوال هي أساس النمط الوظيفي، وسنتعرف عليها في هذا الدرس.&lt;/p&gt;
&lt;p&gt;لنفهم أهمية الدوال دعونا نتخيل الوضع …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #16: الدوال في بايثون&amp;quot;" src="/assets/images/2020/pyc-16-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتحدث عن الدوال في بايثون.&lt;/p&gt;
&lt;p&gt;تكلمنا سابقاً بشكل سريع عن الدوال في بايثون عندما ذكرنا أنماط سير البرامج في بايثون وقلنا أن هناك النمط التسلسلي والنمط الشرطي والنمط التكراري والنمط الوظيفي. الدوال هي أساس النمط الوظيفي، وسنتعرف عليها في هذا الدرس.&lt;/p&gt;
&lt;p&gt;لنفهم أهمية الدوال دعونا نتخيل الوضع التالي: لنفترض أن هناك خمسة أسطر من الكود تؤدي وظيفة معينة وأنك تستخدم هذه المجموعة من الأسطر عدة مرات في برنامجك. الآن ماذا لو وجدت خطأ في مجموعة الأسطر هذه؟ ماذا لو كنت استخدمت هذه المجموعة في 100 مكان مختلف في برنامجك؟ ستضطر في هذه الحالة إلى أن تقوم بإصلاح هذه الأسطر في كل مكان قمت باستخدامها فيه.&lt;/p&gt;
&lt;p&gt;أليس من الأفضل أن نضع مجموعة الأسطر هذه في مكان واحد ونعطيها اسماً ثم نقوم باستخدامها كما نشاء في برنامجنا؟ وإذا وجدنا خطأ فيها نقوم بإصلاحه في مكان واحد؟ هذا بالضبط ما تمكننا الدوال من فعله.&lt;/p&gt;
&lt;p&gt;الكود التالي يستخدم لإنشاء دالة اسمها &lt;code&gt;func&lt;/code&gt; تقوم بتنفيذ ثلاث أوامر طباعة:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;func&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;This is a function.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;هذه دالة.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;ABC&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;السطر الأول يبدأ بكلمة &lt;code&gt;def&lt;/code&gt; وهي اختصار لكلمة &lt;code&gt;define&lt;/code&gt; وتعني بالعربية &amp;ldquo;عرّف&amp;rdquo;، يعني في السطر الأول نقول: عرف أو أنشئ دالة جديدة اسمها &lt;code&gt;func&lt;/code&gt;، وبعد اسم الدالة نرى قوسين.. يمكن إعطاء قيم بين هذين القوسين لتستخدمها الدالة. سنعرف المزيد عن ذلك بعد قليل. وبعد القوسين نرى نقطتين رأسيتان. في الأسطر الثلاثة التالية نرى ثلاث تعليمات طباعة منزاحة إلى اليمين، وهذا الانزياح يعني أن هذه التعليمات تابعة لهذه الدالة.&lt;/p&gt;
&lt;p&gt;أمر مهم يجب التنبه له وهو أنه عندما نقوم بإنشاء دالة بهذا الشكل في برامجنا فإنه لا يتم تنفيذ محتويات الدالة، هذا يعني أنه عندما ننشئ الدالة &lt;code&gt;func&lt;/code&gt; في مثالنا فإن تعليمات الطباعة الثلاثة الموجودة داخل الدالة لن يتم تنفيذها. متى سيتم تنفيذها إذن؟ سيتم تنفيذها عندما يتم استدعاء الدالة. المثال التالي يعرض كيف يمكن استدعاء الدوال في بايثون:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;func&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;This is a function.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;هذه دالة.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;ABC&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا المثال قمنا بتعريف دالة اسمها &lt;code&gt;func&lt;/code&gt; كما في المثال السابق ثم قمنا باستدعاء الدالة عن طريق كتابة اسمها متبوعاً بقوسين. عندما يتم استدعاء الدالة تقوم بايثون بتنفيذ محتويات الدالة ثم إكمال تنفيذ البرنامج. في مثالنا هذا ستقوم بايثون بتنفيذ محتويات &lt;code&gt;func&lt;/code&gt; وهي ثلاث تعليمات طباعة ستطبع المخرَجات التالية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;This is a function.
هذه دالة. 
ABC
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;ثم تنتقل بايثون إلى السطر التالي في البرنامج وهو:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وستقوم بايثون بتنفيذه وطباعة &amp;ldquo;Hello&amp;rdquo; على الشاشة. ثم في السطر الأخير من البرنامج يتم استدعاء دالة &lt;code&gt;func&lt;/code&gt; مرة ثانية. وكما حدث في الاستدعاء الأول بالضبط: سيتم تنفيذ محتويات &lt;code&gt;func&lt;/code&gt; وطباعة الجمل الثلاث. إذن بعد انتهاء تنفيذ البرنامج سيكون لدينا المخرجات التالية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;This is a function.
هذه دالة. 
ABC
Hello
This is a function.
هذه دالة. 
ABC
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لاحظ أننا قمنا باستخدام الدوال في أمثلة كثيرة في الدروس السابقة، فمثلاً دالة &lt;code&gt;print&lt;/code&gt; والتي استخدمناها كثيراً هي دالة تقوم بطباعة القيمة أو القيم المعطاة إليها على الشاشة. أيضاً تعرفنا على دالة &lt;code&gt;int&lt;/code&gt; التي تقوم بتحويل القيمة المعطاة إليها إلى عدد صحيح. وأيضاً رأينا دالة &lt;code&gt;input&lt;/code&gt; والتي تقرأ إدخالات من مستخدم برامجنا. ورأينا دوال أخرى أيضاً.&lt;/p&gt;
&lt;p&gt;بالنسبة لتسمية الدوال: يجب اتباع نفس القواعد التي يجب اتباعها عند تسمية المتغيرات، وقد تعرفنا على هذه القواعد في درس سابق.&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/Kc_8yIf9k6w" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون #17: الدوال في بايثون: الوسطاء| Functions in Python: Parameters</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-17-arabic.html" rel="alternate"/><published>2020-06-05T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-05:/ar/2020/learn-programming-with-python-1-17-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #17&amp;quot;" src="/assets/images/2020/pyc-17-1.png"&gt;&lt;/p&gt;
&lt;p&gt;لننظر مرة أخرى إلى دالة &lt;code&gt;int&lt;/code&gt; والتي تعاملنا معها عدة مرات فيما سبق:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;9.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا السطر: نعلم أننا نقوم بتحويل العدد العشري 9.5 إلى عدد صحيح باستخدام الدالة &lt;code&gt;int&lt;/code&gt; وأننا نخزن ناتج التحويل في متغير اسمه &lt;code&gt;g&lt;/code&gt;. يعني بعد تنفيذ هذا السطر سيكون لدينا عدد …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #17&amp;quot;" src="/assets/images/2020/pyc-17-1.png"&gt;&lt;/p&gt;
&lt;p&gt;لننظر مرة أخرى إلى دالة &lt;code&gt;int&lt;/code&gt; والتي تعاملنا معها عدة مرات فيما سبق:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;9.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا السطر: نعلم أننا نقوم بتحويل العدد العشري 9.5 إلى عدد صحيح باستخدام الدالة &lt;code&gt;int&lt;/code&gt; وأننا نخزن ناتج التحويل في متغير اسمه &lt;code&gt;g&lt;/code&gt;. يعني بعد تنفيذ هذا السطر سيكون لدينا عدد صحيح هو 9 في المتغير &lt;code&gt;g&lt;/code&gt;. رأينا ذلك سابقاً. الرقم 9.5 هو قيمة تأخذها دالة &lt;code&gt;int&lt;/code&gt; وتقوم بتحويلها إلى عدد صحيح. نسمي هذه القيمة وسيط أو معامل (parameter). &lt;/p&gt;
&lt;p&gt;الدالة قد يكون لها وسيط أو وسيطان أو ثلاثة أو عشرة؛ ليس هناك حد أقصى. ويمكن أيضاً للدالة أن لا يكون لها أي وسيط مثل دالة &lt;code&gt;func&lt;/code&gt; في الدرس السابق.&lt;/p&gt;
&lt;p&gt;لمعرفة كيفية استخدام الوسطاء (parameters): لننظر إلى المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;arabic&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;مرحباً&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;👋🏼&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;arabic&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;spanish&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا المثال أنشأنا في البداية دالة اسمها &lt;code&gt;greet&lt;/code&gt;. هذه الدالة تأخذ وسيطاً واحداً سميناه &lt;code&gt;lang&lt;/code&gt;. هذه الدالة تقوم بطباعة كلمة ترحيب بناء على اللغة. الوسيط &lt;code&gt;lang&lt;/code&gt; هو الذي يحدد اللغة. داخل الدالة نقوم باستخدام هذا الوسيط، نستخدمه كما كنا نستخدم المتغيرات من قبل. ننظر في البداية إذا كانت قيمة هذا الوسيط هي &amp;ldquo;arabic&amp;rdquo; يعني اللغة العربية، إذا كانت &amp;ldquo;arabic&amp;rdquo; نقوم بطباعة &amp;ldquo;مرحباً&amp;rdquo;، وإذا لم تكن &amp;ldquo;arabic&amp;rdquo; ننظر هل هي &amp;ldquo;english&amp;rdquo;؟ إذا كانت &amp;ldquo;english&amp;rdquo; نطبع كلمة &amp;ldquo;Hello&amp;rdquo;، أما إذا كانت قيمة الوسيط ليست &amp;ldquo;arabic&amp;rdquo; وليست &amp;ldquo;english&amp;rdquo; نقوم بطباعة إشارة الترحيب 👋🏼. &lt;/p&gt;
&lt;p&gt;بعد أن ننتهي من إنشاء الدالة ننتقل للسطر التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا السطر نقوم باستدعاء الدالة &lt;code&gt;greet&lt;/code&gt; ونقوم بتمرير السلسلة النصية &lt;code&gt;"english"&lt;/code&gt; كوسيط. الآن ماذا سيحدث؟ سيتم تنفيذ محتويات الدالة &lt;code&gt;greet&lt;/code&gt; وستكون قيمة &lt;code&gt;lang&lt;/code&gt; هي &lt;code&gt;"english"&lt;/code&gt; وبالتالي سيتم طباعة &lt;code&gt;"Hello"&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;إذن &lt;code&gt;lang&lt;/code&gt; هو اسم وسيط نستخدمه داخل الدالة وقيمة هذا الوسيط يتم تحديدها عند استدعاء الدالة.&lt;/p&gt;
&lt;p&gt;في السطرين الأخيرين من البرنامج يتم استدعاء الدالة &lt;code&gt;greet&lt;/code&gt; مع تمرير &lt;code&gt;"arabic"&lt;/code&gt; في المرة الأولى و &lt;code&gt;"spanish"&lt;/code&gt; (يعني اسبانية) في المرة الثانية. بعد انتهاء تنفيذ هذا البرنامج سيكون لدينا المخرَجات التالية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Hello
مرحباً
👋🏼
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="_1"&gt;أكثر من وسيط&lt;/h3&gt;
&lt;p&gt;بشكل مشابه للمثال السابق: يمكن أن يكون للدالة أكثر من وسيط. لنر المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا المثال: أنشأنا دالة سميناها &lt;code&gt;add&lt;/code&gt;. هذه الدالة تأخذ وسيطين: &lt;code&gt;a&lt;/code&gt; و &lt;code&gt;b&lt;/code&gt;، تقوم بجمع هذين الوسيطين وطباعة الناتج. بعد إنشاء الدالة قمنا باستدعائها مع تمرير العددين 6 و 9. في هذه الحالة سيأخذ الوسيط &lt;code&gt;a&lt;/code&gt; العدد الأول وهو 6 لأنه الوسيط الأول، وسيأخذ الوسيط الثاني &lt;code&gt;b&lt;/code&gt; العدد الثاني وهو 9. سيتم بعدها تنفيذ محتويات الدالة حيث سيتم جمع العددين وتخزين ناتج الجمع في متغير اسمه &lt;code&gt;res&lt;/code&gt; ثم سيتم طباعة قيمة هذا المتغير. وبالتالي فإن ناتج تنفيذ هذا البرنامج سيكون:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="_2"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/ljzbuiDtr9o" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون #18: الدوال في بايثون: الإرجاع Functions in Python: Returning</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-18-arabic.html" rel="alternate"/><published>2020-06-05T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-05:/ar/2020/learn-programming-with-python-1-18-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #18&amp;quot;" src="/assets/images/2020/pyc-18-1.png"&gt;&lt;/p&gt;
&lt;h2 id="return"&gt;الإرجاع (Return)&lt;/h2&gt;
&lt;p&gt;رأينا عندما استخدمنا بعض الدوال في السابق مثل &lt;code&gt;int&lt;/code&gt; و &lt;code&gt;input&lt;/code&gt; أن هذه الدوال تقوم &lt;strong&gt;بإرجاع&lt;/strong&gt; قيمة ما. مثلاً الدالة &lt;code&gt;int&lt;/code&gt; تقوم بتحويل القيمة المعطاة لها إلى عدد صحيح وتقوم &lt;strong&gt;بإرجاع&lt;/strong&gt; هذا العدد الصحيح. الدالة &lt;code&gt;input&lt;/code&gt; تقوم بقراءة قيمة من مستخدم البرنامج وتقوم &lt;strong&gt;بإرجاع&lt;/strong&gt; هذه القيمة. يعني في …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون #18&amp;quot;" src="/assets/images/2020/pyc-18-1.png"&gt;&lt;/p&gt;
&lt;h2 id="return"&gt;الإرجاع (Return)&lt;/h2&gt;
&lt;p&gt;رأينا عندما استخدمنا بعض الدوال في السابق مثل &lt;code&gt;int&lt;/code&gt; و &lt;code&gt;input&lt;/code&gt; أن هذه الدوال تقوم &lt;strong&gt;بإرجاع&lt;/strong&gt; قيمة ما. مثلاً الدالة &lt;code&gt;int&lt;/code&gt; تقوم بتحويل القيمة المعطاة لها إلى عدد صحيح وتقوم &lt;strong&gt;بإرجاع&lt;/strong&gt; هذا العدد الصحيح. الدالة &lt;code&gt;input&lt;/code&gt; تقوم بقراءة قيمة من مستخدم البرنامج وتقوم &lt;strong&gt;بإرجاع&lt;/strong&gt; هذه القيمة. يعني في المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;4.2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;الدالة &lt;code&gt;int&lt;/code&gt; تقوم بتحويل العدد العشري 4.2 إلى عدد صحيح هو 4 ثم تقوم بإرجاع هذا العدد الصحيح ونقوم بتخزين هذا العدد الصحيح الذي تم إرجاعه في المتغير &lt;code&gt;n&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;هناك دوال لا ترجع شيئاً مثل دالة &lt;code&gt;print&lt;/code&gt;. يعني مثلاً إذا كتبنا:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;سيتم تنفيذ دالة &lt;code&gt;print&lt;/code&gt; وطباعة &amp;ldquo;Hello&amp;rdquo; لكن بما أن هذه الدالة لا ترجع شيئاً سيتم وضع &lt;code&gt;None&lt;/code&gt; في المتغير &lt;code&gt;d&lt;/code&gt;. و &lt;code&gt;None&lt;/code&gt; هي كلمة من الكلمات المحجوزة في بايثون والتي تعني &amp;ldquo;لا شيء&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;الآن كيف نجعل الدوال التي نكتبها تقوم بإرجاع قيم؟ يمكننا ذلك باستخدام كلمة &lt;code&gt;return&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;لنقم بكتابة مثال مشابه للمثال الذي رأيناه في الدرس السابق وسنستخدم فيه كلمة &lt;code&gt;return&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;arabic&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;مرحباً&amp;#39;&lt;/span&gt;
  &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;👋🏼&amp;#39;&lt;/span&gt;

&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; John&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;arabic&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; أحمد&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;spanish&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; Maya&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا المثال: في دالة &lt;code&gt;greet&lt;/code&gt; سننظر إذا كانت قيمة الوسيط &lt;code&gt;lang&lt;/code&gt; هي &amp;ldquo;arabic&amp;rdquo;، إذا كانت &amp;ldquo;arabic&amp;rdquo; نقوم بإرجاع السلسلة النصية &lt;code&gt;"مرحباً"&lt;/code&gt;، وإذا لم تكن &amp;ldquo;arabic&amp;rdquo; ننظر هل هي &amp;ldquo;english&amp;rdquo;؟ إذا كانت &amp;ldquo;english&amp;rdquo; نرجع كلمة &lt;code&gt;"Hello"&lt;/code&gt;، أما إذا كانت قيمة الوسيط ليست &amp;ldquo;arabic&amp;rdquo; وليست &amp;ldquo;english&amp;rdquo; نقوم بإرجاع إشارة الترحيب &lt;code&gt;👋🏼&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;كلمة &lt;code&gt;return&lt;/code&gt; تقوم بفعل أمرين:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;تقوم بإيقاف تنفيذ الدالة&lt;/li&gt;
&lt;li&gt;تقوم بإرسال القيمة المعطاة لها&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;يعني في مثالنا: إذا كانت قيمة الوسيط &amp;ldquo;arabic&amp;rdquo; سيتم إرجاع كلمة &lt;code&gt;"مرحباً"&lt;/code&gt; وسيتم إيقاف تنفيذ الدالة مما يعني أن جملة &lt;code&gt;elif&lt;/code&gt; لن يتم النظر إليها وسيتم تجاهلها وما بعدها تماماً.&lt;/p&gt;
&lt;p&gt;بعد إنشاء الدالة &lt;code&gt;greet&lt;/code&gt; نقوم باستدعائها ثلاث مرات في الأسطر الثلاثة الأخيرة من البرنامج. نبدأ مع هذا السطر:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; John&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;عندنا شخص إنكليزي اسمه John ونريد أن نطبع رسالة ترحيب له. بما أنه إنكليزي سنستدعي الدالة &lt;code&gt;greet&lt;/code&gt; مع تمرير &amp;ldquo;english&amp;rdquo; لها ليتم طباعة الترحيب بالإنكليزية. بناء على الطريقة التي كتبنا فيها الدالة &lt;strong&gt;سترجع&lt;/strong&gt; لنا الدالة سلسلة نصية هي &lt;code&gt;"Hello"&lt;/code&gt;. ستأخذ بايثون هذه السلسلة النصية التي تم إرجاعها وتصلها بسلسلة &lt;code&gt;"John "&lt;/code&gt;، وسيتم طباعة &lt;code&gt;"Hello John"&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;يعني لفهم كيفية تنفيذ هذا السطر: يمكن أن نستبدل استدعاء الدالة هذا:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;بالقيمة التي ترجعها الدالة فالسطر سيتحول من:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;english&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; John&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;إلى:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; John&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وهذه جملة طباعة مثل الجمل التي رأيناها سابقاً.&lt;/p&gt;
&lt;p&gt;في السطر قبل الأخير:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;arabic&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; أحمد&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;عندنا شخص عربي اسمه أحمد ونريد أن نطبع رسالة ترحيب له. بما أنه عربي سنستدعي الدالة &lt;code&gt;greet&lt;/code&gt; مع تمرير &amp;ldquo;arabic&amp;rdquo; لها ليتم طباعة الترحيب بالعربية هذه المرة. و&lt;strong&gt;سترجع&lt;/strong&gt; لنا الدالة سلسلة نصية هي &lt;code&gt;"مرحباً"&lt;/code&gt;. ستأخذ بايثون هذه السلسلة النصية التي تم إرجاعها وتصلها بسلسلة &lt;code&gt;"أحمد "&lt;/code&gt;، وسيتم طباعة &lt;code&gt;"مرحباً أحمد"&lt;/code&gt;. والسطر الأخير سيتم تنفيذه بشكل مشابه وسيتم طباعة &lt;code&gt;"Maya 👋🏼"&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="_1"&gt;تمرين&lt;/h2&gt;
&lt;p&gt;هذا الكود:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;print_xyz&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;This is the first line.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;This is the second line.&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  

&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;123&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;إذا قمنا بتنفيذه فماذا سيكون الناتج؟ ماذا سيطبع هذا الكود على الشاشة؟&lt;/p&gt;
&lt;p&gt;سيطبع هذه السطور:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Hello
123
7
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لماذا لم يطبع أيضاً هذه السطور؟&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;This is the first line.
This is the second line.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لأننا لم نقم باستدعاء دالة &lt;code&gt;print_xyz&lt;/code&gt;. قلنا أن إنشاء الدالة لا يعني تنفيذها. لتنفيذ الدالة لا بد من استدعائها. يعني في هذا المثال يجب أن نضيف التعليمة التالية ليتم استدعاء الدالة وتنفيذ محتوياتها:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;print_xyz&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="_2"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/KrBW2eabpoY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الرابع عشر: الشروط في بايثون: الطرق المتعددة مع elif</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-14-arabic.html" rel="alternate"/><published>2020-06-04T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-04:/ar/2020/learn-programming-with-python-1-14-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الرابع عشر: الشروط في بايثون: الطرق المتعددة مع elif" src="/assets/images/2020/pyc-14-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس من سلسلة &amp;ldquo;تعلم البرمجة من الصفر بلغة بايثون&amp;rdquo; سنكمل حديثنا عن الشروط في بايثون ونتعرف على الطرق المتعددة في الشروط التي يمكن إنشاؤها باستخدام كلمة elif مع أمثلة مفصلة.&lt;/p&gt;
&lt;h2 id="_1"&gt;الطرق المتعددة&lt;/h2&gt;
&lt;p&gt;ذكرنا أنه باستخدام &lt;code&gt;else&lt;/code&gt; يمكننا تشكيل ما يشبه مفترق طرق: إما أن تذهب في طريق &lt;code&gt;if …&lt;/code&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الرابع عشر: الشروط في بايثون: الطرق المتعددة مع elif" src="/assets/images/2020/pyc-14-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس من سلسلة &amp;ldquo;تعلم البرمجة من الصفر بلغة بايثون&amp;rdquo; سنكمل حديثنا عن الشروط في بايثون ونتعرف على الطرق المتعددة في الشروط التي يمكن إنشاؤها باستخدام كلمة elif مع أمثلة مفصلة.&lt;/p&gt;
&lt;h2 id="_1"&gt;الطرق المتعددة&lt;/h2&gt;
&lt;p&gt;ذكرنا أنه باستخدام &lt;code&gt;else&lt;/code&gt; يمكننا تشكيل ما يشبه مفترق طرق: إما أن تذهب في طريق &lt;code&gt;if&lt;/code&gt;  أو في طريق &lt;code&gt;else&lt;/code&gt; ، فهناك طريقان يتم اختيار أحدهما. لكن في الحقيقة: يمكننا تشكيل مفترق طرق لأكثر من طريقين؛ يمكننا تشكيل مفترق طرق لثلاث وأربع وخمس طرق وأكثر من ذلك. يمكننا فعل ذلك باستخدام &lt;code&gt;elif&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;مثال:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;صغير&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;وسط&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;كبير&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;انتهى البرنامج&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;ويمكن تمثيل سير هذا الكود عن طريق المخطط التالي:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/pyc-14-2.png"&gt;&lt;/p&gt;
&lt;p&gt;بداية سيسأل هل &lt;code&gt;x&lt;/code&gt; أقل من 2؟ إذا كان الجواب &amp;ldquo;صحيح&amp;rdquo; سيطبع &lt;code&gt;صغير&lt;/code&gt; وينتقل إلى جملة الطباعة الأخيرة ويطبع &lt;code&gt;انتهى البرنامج&lt;/code&gt;. أما إذا كان الجواب &amp;ldquo;خطأ&amp;rdquo; وكانت &lt;code&gt;x&lt;/code&gt; أكبر أو تساوي 2: عندها سينتقل إلى &lt;code&gt;elif&lt;/code&gt; وسيسأل هل &lt;code&gt;x&lt;/code&gt; أقل من 10؟ إذا كان الجواب &amp;ldquo;صحيح&amp;rdquo; سيطبع &lt;code&gt;وسط&lt;/code&gt; وينتقل إلى جملة الطباعة الأخيرة ويطبع &lt;code&gt;انتهى البرنامج&lt;/code&gt;. أما إذا كان الجواب &amp;ldquo;خطأ&amp;rdquo; وكانت &lt;code&gt;x&lt;/code&gt; أكبر أو تساوي 10: عندها سينتقل إلى &lt;code&gt;else&lt;/code&gt; وسيطبع &lt;code&gt;كبير&lt;/code&gt; ثم سيطبع &lt;code&gt;انتهى البرنامج&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;لاحظ أنه عندما يكون لدينا عدة شروط (مع &lt;code&gt;if&lt;/code&gt; و &lt;code&gt;elif&lt;/code&gt; و &lt;code&gt;else&lt;/code&gt;) فدائماً سيتم تنفيذ الأوامر التابعة لواحد منها. مثلاً في المثال أعلاه: سيتم تنفيذ الأوامر التابعة لـ &lt;code&gt;if&lt;/code&gt; &lt;strong&gt;أو&lt;/strong&gt; الأوامر التابعة لـ &lt;code&gt;elif&lt;/code&gt; &lt;strong&gt;أو&lt;/strong&gt; الأوامر التابعة لـ &lt;code&gt;else&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;هذا الكود يعتمد تنفيذه على قيمة &lt;code&gt;x&lt;/code&gt;. إذا افترضنا أن &lt;code&gt;x&lt;/code&gt; كانت قيمتها 0 قبل هذا الكود فما الذي ستتم طباعته؟ بناء على المخطط والشرح أعلاه: فإن البرنامج سيطبع &lt;code&gt;صغير&lt;/code&gt; ثم &lt;code&gt;انتهى البرنامج&lt;/code&gt; لأن جواب شرط &lt;code&gt;if&lt;/code&gt; سيكون &amp;ldquo;صحيح&amp;rdquo; (أو &amp;ldquo;True&amp;rdquo;) عندما تكون &lt;code&gt;x&lt;/code&gt; قيمتها 0.&lt;/p&gt;
&lt;p&gt;ماذا لو كانت قيمة &lt;code&gt;x&lt;/code&gt; تساوي 5؟ باتباع نفس المنطق: سنرى أنه سيتم طباعة &lt;code&gt;وسط&lt;/code&gt; ثم &lt;code&gt;انتهى البرنامج&lt;/code&gt; لأن جواب شرط &lt;code&gt;if&lt;/code&gt; سيكون &amp;ldquo;خطأ&amp;rdquo; لكن جواب شرط &lt;code&gt;elif&lt;/code&gt; سيكون &amp;ldquo;صحيح&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;ماذا لو كانت قيمة &lt;code&gt;x&lt;/code&gt; تساوي 20؟ عندها سيتم طباعة &lt;code&gt;كبير&lt;/code&gt; ثم &lt;code&gt;انتهى البرنامج&lt;/code&gt; لأن شرط &lt;code&gt;if&lt;/code&gt; سيكون جوابه &amp;ldquo;خطأ&amp;rdquo; (20 ليست أقل من 2) وكذلك شرط &lt;code&gt;elif&lt;/code&gt; سيكون جوابه &amp;ldquo;خطأ&amp;rdquo; (لأن 20 ليست أقل من 10)، فبعد ذلك لا يتبقى لدينا إلا &lt;code&gt;else&lt;/code&gt; و &lt;code&gt;else&lt;/code&gt; دائماً ليس لها شرط، فعندما تكون أجوبة الشروط التي قبل &lt;code&gt;else&lt;/code&gt; كلها &amp;ldquo;خطأ&amp;rdquo; يقوم البرنامج بتنفيذ الأوامر التابعة لـ &lt;code&gt;else&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;إذا  أردنا التعبير عن هذا البرنامج بلغتنا سنقول: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;إذا كانت &lt;code&gt;x&lt;/code&gt; أقل من 2: اطبع &lt;code&gt;صغير&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;أما&lt;/strong&gt; إذا كانت &lt;code&gt;x&lt;/code&gt; أقل من 10: اطبع &lt;code&gt;وسط&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;إذا لم تتحقق الشروط &lt;strong&gt;السابقة&lt;/strong&gt;: اطبع &lt;code&gt;كبير&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;يمكنك إضافة ما تشاء من جمل &lt;code&gt;elif&lt;/code&gt;. في هذا المثال كان لدينا جملة &lt;code&gt;elif&lt;/code&gt; واحدة لكن إن احتجت يمكن أن تضع ثلاثة وأربعة وأكثر حسب ما تحتاجه في برنامجك. يمكنك أيضاً أن تستغني عن &lt;code&gt;else&lt;/code&gt; إذا لم تكن تحتاجها. في المثال التالي لن يتم طباعة شيء إلا &lt;code&gt;انتهى البرنامج&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;صغير&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;وسط&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;انتهى البرنامج&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="_2"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/fHR0M8zxuMg" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الثاني عشر: الشروط في بايثون: عمليات المقارنة</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-12-arabic.html" rel="alternate"/><published>2020-06-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-01:/ar/2020/learn-programming-with-python-1-12-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثاني عشر: الشروط في بايثون" src="/assets/images/2020/pyc-12-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس من سلسلة &amp;ldquo;تعلم البرمجة من الصفر بلغة بايثون&amp;rdquo; سنكمل حديثنا عن الشروط في بايثون حيث سنتعرف على عمليات المقارنة الرئيسية في بايثون ونرى أمثلة عنها. &lt;/p&gt;
&lt;p&gt;في الدرس السابق رأينا نوعين من عمليات المقارنة في جمل if: رأينا إشارة &amp;ldquo;أكبر من&amp;rdquo; &lt;code&gt;&amp;lt;&lt;/code&gt; و إشارة &amp;ldquo;أقل من&amp;rdquo; &lt;code&gt;&amp;gt;&lt;/code&gt; واستخدمناهما لسؤال &amp;ldquo;هل …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثاني عشر: الشروط في بايثون" src="/assets/images/2020/pyc-12-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس من سلسلة &amp;ldquo;تعلم البرمجة من الصفر بلغة بايثون&amp;rdquo; سنكمل حديثنا عن الشروط في بايثون حيث سنتعرف على عمليات المقارنة الرئيسية في بايثون ونرى أمثلة عنها. &lt;/p&gt;
&lt;p&gt;في الدرس السابق رأينا نوعين من عمليات المقارنة في جمل if: رأينا إشارة &amp;ldquo;أكبر من&amp;rdquo; &lt;code&gt;&amp;lt;&lt;/code&gt; و إشارة &amp;ldquo;أقل من&amp;rdquo; &lt;code&gt;&amp;gt;&lt;/code&gt; واستخدمناهما لسؤال &amp;ldquo;هل &lt;code&gt;x&lt;/code&gt; أقل من 10؟&amp;rdquo; و &amp;ldquo;هل &lt;code&gt;x&lt;/code&gt; أكبر من 20؟&amp;rdquo;&lt;/p&gt;
&lt;p&gt;الجدول التالي يوضح عمليات المقارنة المتوفرة لنا في بايثون ومعانيها:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;عامل المقارنة&lt;/th&gt;
&lt;th&gt;المعنى&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;&lt;/td&gt;
&lt;td&gt;أقل من&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;=&amp;gt;&lt;/td&gt;
&lt;td&gt;أقل من أو يساوي&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;==&lt;/td&gt;
&lt;td&gt;يساوي&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;=&amp;lt;&lt;/td&gt;
&lt;td&gt;أكبر من أو يساوي&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;&lt;/td&gt;
&lt;td&gt;أكبر من&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;=!&lt;/td&gt;
&lt;td&gt;لا يساوي&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;انتبه إلى الفرق بين عامل المقارنة &lt;code&gt;==&lt;/code&gt; وعامل الإسناد &lt;code&gt;=&lt;/code&gt;. عامل المقارنة يقارن بين قيمتين فإن كانتا متساويتين يعطي True وإن لم تكونا متساويتين يعطي False. أما عامل الإسناد فيضع قيمة داخل متغير كما رأينا في العديد من الأمثلة في الدروس الماضية: مثلاً &lt;code&gt;x = 11&lt;/code&gt;  تضع قيمة &lt;code&gt;11&lt;/code&gt; في المتغير &lt;code&gt;x&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="_1"&gt;أمثلة عن عمليات المقارنة&lt;/h3&gt;
&lt;p&gt;لننظر إلى المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Equals 7&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Greater than 5&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Less than 4&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Greater than or equals 3&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Less than or equals 7&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Not equal to 6&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في البداية عرفنا متغيراً اسمه &lt;code&gt;d&lt;/code&gt; ووضعنا فيه 7. ثم قمنا بتنفيذ عدة جمل شرطية. نتيجة تنفيذ هذا البرنامج هي السطور التالية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Equals 7
Greater than 5
Greater than or equals 3
Less than or equals 7
Not equal to 6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;فنرى أنه تم طباعة جميع الجمل التابعة للشروط باستثناء الجملة التابعة للشرط الثالث &lt;code&gt;d &amp;lt; 4&lt;/code&gt; لأن جواب هذا الشرط False (أي &amp;ldquo;خطأ&amp;rdquo;) بينما أجوبة جميع الشروط الأخرى True (أي &amp;ldquo;صحيح&amp;rdquo;).&lt;/p&gt;
&lt;p&gt;والآن لنرَ مثالاً آخر:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Greater than 5&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Larger than 5&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ABC&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;End&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا المثال عرفنا متغيراً اسمه &lt;code&gt;d&lt;/code&gt; وضعنا فيه 7 ثم أتينا إلى شرط يسأل هل &lt;code&gt;d&lt;/code&gt; أكبر من 5؟ وبما أن قيمة &lt;code&gt;d&lt;/code&gt; - وهي 7 - أكبر من 5 فإن جواب الشرط سيكون True أي صحيح، وبالتالي سيتم تنفيذ الجمل الثلاث التابعة للشرط وبعد الانتهاء منها سيتم تنفيذ أمر الطباعة الأخير وينتهي البرنامج. مخرجات البرنامج ستكون كالتالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;Greater&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;than&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="nv"&gt;Larger&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;than&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="nv"&gt;ABC&lt;/span&gt;
&lt;span class="k"&gt;End&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;بينما لو كان الشرط &lt;code&gt;d &amp;gt; 8&lt;/code&gt; بدل أن يكون &lt;code&gt;d &amp;gt; 5&lt;/code&gt; فلن يتم تنفيذ الجمل التابعة للشرط وستكون مخرجات البرنامج كما يلي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;End&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذا المثال: كيف نعرف أننا انتهينا من الجمل التابعة لـ if ؟ نعرف ذلك عندما يقل انزياح الجمل إلى اليمين ونعود إلى المستوى الذي كنا فيه قبل هذه الجمل.&lt;/p&gt;
&lt;h2 id="_2"&gt;كيفية تحقيق الانزياح في بايثون&lt;/h2&gt;
&lt;p&gt;كما قلنا فإننا نقوم بزيادة انزياح الجمل التابعة لشرط ما إلى اليمين للدلالة على أنها تابعة لذلك الشرط. لكن كيف نزيحها؟ قلنا أن المقدار المنصوح به هو أربعة فراغات ويمكن كتابة هذه الفراغات باستخدام زر المسافة على لوحة المفاتيح أربع مرات. يمكن أيضاً إزاحة الجمل بمقدار فراغين فقط ويمكن أيضاً استخدام زر TAB على لوحة المفاتيح لإزاحة الجمل. لكن هنا ملاحظة مهمة: يجب أن تستخدم نفس أسلوب تحقيق الانزياح في كامل برنامجك: اختر أسلوباً واحداً واستخدمه. &lt;/p&gt;
&lt;p&gt;أيضاً عليك التنبه إلى أنه عندما تستخدم أسلوب الأربع فراغات وعندما تستخدم أسلوب TAB فإن الناتج متشابه في المظهر (يعني هذه أربع فراغات:    وهذا TAB:  ) لكن بالنسبة لبايثون هناك فرق وقد يؤدي ذلك إلى خطأ في تنفيذ البرنامج. لحسن الحظ فإن العديد من محررات النصوص البرمجية - مثل Visual Studio Code الذي نستخدمه في هذه الدورة - تحول TAB إلى فراغات.&lt;/p&gt;
&lt;p&gt;فملخص الكلام: إذا كنت تستخدم Visual Studio Code فاضغط TAB لتحقيق الانزياح (فذلك أسهل من ضغط زر المسافة أربع مرات) وسيقوم المحرر بإدراج أربعة فراغات. أما إن كان محرر النصوص الذي تستخدمه لا يحول TAB إلى فراغات فعليك إدخال الفراغات يدوياً باستخدام زر المسافة.&lt;/p&gt;
&lt;h2 id="_3"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/nD2U6b1D6rU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الثالث عشر: الشروط في بايثون: الشروط المتداخلة و else</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-13-arabic.html" rel="alternate"/><published>2020-06-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-06-01:/ar/2020/learn-programming-with-python-1-13-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثالث عشر: الشروط في بايثون" src="/assets/images/2020/pyc-13-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس من سلسلة &amp;ldquo;تعلم البرمجة من الصفر بلغة بايثون&amp;rdquo; سنكمل حديثنا عن الشروط في بايثون ونتعرف على الشروط المتداخلة وكلمة else المهمة في الشروط مع أمثلة مفصلة.&lt;/p&gt;
&lt;h2 id="_1"&gt;الجمل الشرطية المتداخلة&lt;/h2&gt;
&lt;p&gt;هل يمكن أن نكتب جملة شرطية داخل جملة شرطية أخرى في بايثون؟ نعم بالطبع. لنر مثالاً على ذلك …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثالث عشر: الشروط في بايثون" src="/assets/images/2020/pyc-13-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس من سلسلة &amp;ldquo;تعلم البرمجة من الصفر بلغة بايثون&amp;rdquo; سنكمل حديثنا عن الشروط في بايثون ونتعرف على الشروط المتداخلة وكلمة else المهمة في الشروط مع أمثلة مفصلة.&lt;/p&gt;
&lt;h2 id="_1"&gt;الجمل الشرطية المتداخلة&lt;/h2&gt;
&lt;p&gt;هل يمكن أن نكتب جملة شرطية داخل جملة شرطية أخرى في بايثون؟ نعم بالطبع. لنر مثالاً على ذلك:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Larger than 3&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Less than 19&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;All done&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هنا في البداية نسأل هل &lt;code&gt;x&lt;/code&gt; أكبر من 3؟ ولأننا وضعنا 12 في &lt;code&gt;x&lt;/code&gt; فإن جواب هذا الشرط سيكون True وسيتم تنفيذ أول جملة تابعة لهذا الشرط وهي طباعة &lt;code&gt;"Larger than 3"&lt;/code&gt; ثم يتم تنفيذ الجملة الثانية التابعة للشرط وهي جملة شرطية أخرى نسأل فيها هل &lt;code&gt;x&lt;/code&gt; أقل من 19 وبالطبع سيكون الجواب True أيضاً لأن قيمة &lt;code&gt;x&lt;/code&gt; هي 12 وبالتالي سيتم تنفيذ الجملة التابعة لهذا الشرط الثاني والتي ستطبع &lt;code&gt;"Less than 19"&lt;/code&gt; ثم نخرج من الجملة الشرطية الثانية والأولى لنواجه جملة الطباعة والتي ستطبع &lt;code&gt;"All done"&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;انتبه للانزياحات في هذا المثال. المخطط التالي يعرض رسماً لكيفية تنفيذ هذا البرنامج:&lt;/p&gt;
&lt;p&gt;&lt;img alt="الشروط المتداخلة في بايثون" src="/assets/images/2020/pyc-13-2.png"&gt;&lt;/p&gt;
&lt;h2 id="else"&gt;تنفيذ تعليمات عندما لا يتحقق الشرط (باستخدام else)&lt;/h2&gt;
&lt;p&gt;لنفترض أن لدينا شرطاً وأن لدينا مجموعة تعليمات نريد تنفيذها إذا تحقق هذا الشرط مثل ما رأينا في الأمثلة السابقة. ولكن ماذا لو أردنا أن ننفذ مجموعة أخرى من التعليمات في حال لم يتحقق الشرط؟ كيف نفعل ذلك في بايثون؟ نفعل ذلك باستخدام &lt;code&gt;else&lt;/code&gt;. انظر للمثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;أكبر من 7&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;بناء على ما تعلمناه فإن هذا البرنامج لن يطبع شيئاً لعدم تحقق الشرط، والآن إذا أضفنا &lt;code&gt;else&lt;/code&gt; للمثال كما يلي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; 
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;أكبر من 7&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ليس أكبر من 7&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;فإن البرنامج سيطبع &lt;code&gt;"ليس أكبر من 7"&lt;/code&gt; لأن الشرط لم يتحقق فانتقلنا إلى الجملة التابعة لـ &lt;code&gt;else&lt;/code&gt; والتي يتم الانتقال إليها عند عدم تحقق الشرط.&lt;/p&gt;
&lt;p&gt;الرسم التخطيطي التالي يوضح أكثر كيفية سير البرنامج السابق:&lt;/p&gt;
&lt;p&gt;&lt;img alt="الشروط في بايثون: else" src="/assets/images/2020/pyc-13-3.png"&gt;&lt;/p&gt;
&lt;p&gt;يمكن تشبيه سير البرنامج مع &lt;code&gt;if&lt;/code&gt; و &lt;code&gt;else&lt;/code&gt; بمفترق طرق: إما أن تذهب في طريق &lt;code&gt;if&lt;/code&gt; وتنفذ الجمل التابعة لها أو تذهب في طريق &lt;code&gt;else&lt;/code&gt; وتنفذ الجمل التابعة لها. فعندما تستخدم &lt;code&gt;if&lt;/code&gt; و &lt;code&gt;else&lt;/code&gt; فإن واحداً منهما فقط سيتم تنفيذ الجمل التابعة له.&lt;/p&gt;
&lt;p&gt;وانتبه إلى أن كل &lt;code&gt;else&lt;/code&gt; لا بد أن يكون هناك &lt;code&gt;if&lt;/code&gt; قبلها فكل &lt;code&gt;else&lt;/code&gt; تتعلق بـ &lt;code&gt;if&lt;/code&gt; ولكن من الممكن أن نرى &lt;code&gt;if&lt;/code&gt; بدون &lt;code&gt;else&lt;/code&gt; كما رأينا في الأمثلة السابقة.&lt;/p&gt;
&lt;h2 id="_2"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/PlPmRcylaOM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>ملخص كتاب التقليل الرقمي: اختيار حياة من التركيز في عالم كثير الضجيج</title><link href="https://ammar-alyousfi.com/ar/2020/digital-minimalism-book-notes-ar.html" rel="alternate"/><published>2020-05-14T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-05-14:/ar/2020/digital-minimalism-book-notes-ar.html</id><summary type="html">&lt;p&gt;انتهيت مؤخراً من قراءة كتاب Digital Minimalism: Choosing a Focused Life in a Noisy World  - وهو ما يمكن ترجمته إلى التقليل الرقمي: اختيار حياة من التركيز في عالم كثير الضجيج - لمؤلفه كال نيوبورت الأستاذ المساعد في علم الحاسوب في جامعة جورج تاون الأمريكية ومؤلف عدة كتب أخرى لاقت نجاحاً واسعا …&lt;/p&gt;</summary><content type="html">&lt;p&gt;انتهيت مؤخراً من قراءة كتاب Digital Minimalism: Choosing a Focused Life in a Noisy World  - وهو ما يمكن ترجمته إلى التقليل الرقمي: اختيار حياة من التركيز في عالم كثير الضجيج - لمؤلفه كال نيوبورت الأستاذ المساعد في علم الحاسوب في جامعة جورج تاون الأمريكية ومؤلف عدة كتب أخرى لاقت نجاحاً واسعاً.&lt;/p&gt;
&lt;p&gt;أحببت الكتاب وأعجبتني الكثير من الأفكار التي يطرحها والتي لها أهمية عظيمة في وقتنا هذا حيث ازداد توغل التكنولوجيا في حياتنا إلى حد غير مسبوق. في هذه التدوينة سأشارك أكثر ما أحببته في الكتاب (مع تصرف بسيط لجعل المحتوى مناسباً للتدوينة).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ملاحظة:&lt;/strong&gt; قمت بإنشاء مقطعي فيديو لخصت فيهما الكتاب ، لمشاهدتهما انظر أسفل الصفحة.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2020/digital-min-cover.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;صفحة الكتاب على موقع Goodreads الخاص بالكتب: &lt;a href="https://www.goodreads.com/book/show/40672036-digital-minimalism"&gt;Digital Minimalism&lt;/a&gt;. الكتاب غير مترجم إلى العربية بعد.&lt;/p&gt;
&lt;h2 id="_1"&gt;ما هي مشكلتنا مع التكنولوجيا الحديثة؟&lt;/h2&gt;
&lt;p&gt;&lt;img alt="مشكلة التكنولوجيا الحديثة" src="/assets/images/2020/digital-min-2.jpg"&gt;&lt;/p&gt;
&lt;p&gt;إن الانجذاب الذي لا يقاوم للشاشات يقود الناس للإحساس بأنهم يتخلون عن الاستقلالية والقرار الذاتي بشأن كيفية توجيه انتباههم وتركيزهم. لقد قاموا بتحميل التطبيقات بدوافع جيدة لكنهم اكتشفوا لاحقاً أن هذه التطبيقات بدأت بتدمير القيم التي دفتعهم لتحميلها في بداية الأمر: لقد انضموا لفيسبوك للبقاء على تواصل مع الأصدقاء في أماكن بعيدة لكن انتهى بهم الأمر وهم لا يستطيعون إجراء محادثة متصلة بدون مقاطعة مع صديق يجلس أمامهم.&lt;/p&gt;
&lt;p&gt;ما يجعلنا نشعر بعدم الراحة هو الإحساس بفقدان السيطرة، وهذا الإحساس يتجلى في عدة مواقف كل يوم، مثلاً عندما نشرد مع هواتفنا خلال وقت استحمام طفلنا أو عندما لا نستطيع الاستمتاع بلحظة جميلة بدون أن تأتينا رغبة جنونية لتسجيلها لجمهور افتراضي.&lt;/p&gt;
&lt;p&gt;إن الرغبة في تفقد تويتر أو تحديث صفحة فيسبوك أصبحت كارتعاش عصبي يمزق الوقت إلى أجزاء صغيرة جداً لا تصلح لبناء الحياة كما نخطط لها.&lt;/p&gt;
&lt;p&gt;العديد من التطبيقات والمواقع التي تدفع الناس بشكل لا يقاوم لتفقد هواتفهم وفتح صفحات انترنت جديدة تستغل شيئين في طبيعتنا البشرية: التعزيز الإيجابي غير المنتظم (أو المكافئة غير المنتظمة) والرغبة في تحصيل القبول الاجتماعي. المكافآت التي تُعطى بشكل غير منتظم مغرية أكثر بكثير وتجعل أجسادنا تفرز دوبامين أكثر من تلك التي تعطى وفق نمط معروف؛ عندما ينشر الناس شيئاً على وسائل التواصل الاجتماعي يصبح حالهم مثل المقامرين: هل سيحصل المنشور على إعجابات (أو قلوب أو إعادة تغريد) أم أنه سيقبع بدون رد فعل من أحد؟&lt;/p&gt;
&lt;p&gt;التطبيقات الشائعة التي ظهرت في العقد الأخير تشكل مناخاً ملائماً جداً لتطور الإدمان السلوكي مما يقود الناس لاستخدام هذه الخدمات أكثر بكثير من الحد النافع أو الصحي. وكما تم الكشف عنه من قبل باحثين مثل Tristan Harris و Sean Parker و Leah Pearlman و Adam Alter: فإن هذه الخدمات - في حالات كثيرة - مصممة خصيصاً لإحداث حالة الإدمان السلوكي. إذن فالاستخدام القهري لهذه الأدوات ليس نتيجة خلل في الشخصية ولكنه نتيجة لخطة تجارية هائلة.&lt;/p&gt;
&lt;h2 id="_2"&gt;الحل: التقليل الرقمي&lt;/h2&gt;
&lt;p&gt;&lt;img alt="التقليلية" src="/assets/images/2020/digital-min-3.jpg"&gt;&lt;/p&gt;
&lt;p&gt;التقليل الرقمي يعبر عن فلسفة لاستخدام التكنولوجيا مبنية على أن تقوم بتركيز وقت الإنترنت عندك على أنشطة قليلة ومُحَسّنة ومختارة بعناية تخدم الجوانب ذات القيمة لديك، وأن لا يكون عندك بعدها مشكلة في أن يفوتك أي شيء آخر على الإنترنت.&lt;/p&gt;
&lt;p&gt;أي شخص يدرس الاقتصاد يعرف قانون العوائد المتناقصة (diminishing returns) والذي يُطبق عند تحسين عمليات الإنتاج. يقول القانون أن زيادة الاستثمار في تحسين العملية الإنتاجية لا يمكن أن يزيد العوائد إلى ما لا نهاية؛ في وقت ما ستصل إلى حد تقل فيه العوائد التي تكسبها من الزيادة في الاستثمار. الرسم التالي يوضح هذا القانون:&lt;/p&gt;
&lt;p&gt;&lt;img alt="قانون العوائد المتناقصة" src="/assets/images/2020/Law-of-Diminishing-Returns.jpg"&gt;&lt;/p&gt;
&lt;p&gt;في البداية وحتى حد معين: كلما زدت الاستثمار في زيادة القوة العاملة والآليات إلخ ستحصل على عوائد أكبر بشكل ملحوظ. بعد ذلك الحد ستحصل على عوائد أقل وأقل مع زيادة استثمارك في تحسين العملية الإنتاجية. وإذا استمريت في زيادة الاستثمار ستصل إلى مرحلة تبدأ فيها العوائد بالتناقص كما يظهر في الرسم.&lt;/p&gt;
&lt;p&gt;معظم الناس يستثمرون طاقة قليلة جداً لتحسين حياتهم الرقمية (التكنولوجية). أي أنهم لا يزالون في المنطقة الأولى في الرسم أعلاه: في المنطقة حيث محاولات التحسين تعطي عوائد عظيمة. وهذه الحقيقة هي ما يدفع الأشخاص الذين يتبعون نظام التقليل الرقمي ليركزوا ليس فقط على الخدمات التكنولوجية التي يستخدمونها ولكن أيضاً على كيفية استخدام هذه الخدمات.&lt;/p&gt;
&lt;h3 id="_3"&gt;عملية تقليل الازدحام الرقمي&lt;/h3&gt;
&lt;p&gt;قم بأخذ استراحة من &amp;ldquo;الأدوات التكنولوجية الاختيارية&amp;rdquo; لمدة ثلاثين يوماً. فأول خطوة إذن في تقليل الازدحام الرقمي هي تحديد هذه الأدوات الاختيارية، أي الأدوات التي لست مضطراً لاستخدامها بسبب العمل مثلاً. عندما نقول &amp;ldquo;أدوات تكنولوجية&amp;rdquo; فالمقصود التطبيقات والمواقع والأدوات الرقمية الأخرى والتي يتم التعامل معها عن طريق شاشة حاسب أو شاشة هاتف محمول.&lt;/p&gt;
&lt;p&gt;بعد مرور ثلاثين يوماً: قم بإعادة إدخال الأدوات التكنولوجية التي تحقق الشروط التالية إلى حياتك مرة أخرى:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;أن تقدم الأداة خدمة تتعلق بشيء مهم حقاً بالنسبة لك&lt;/li&gt;
&lt;li&gt;أن تكون الأداة هي الطريقة الأفضل لخدمة ذلك الشيء المهم بالنسبة لك&lt;/li&gt;
&lt;li&gt;أن تضع قواعد تحدد متى وكيف ستستخدم هذه الأداة&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="_4"&gt;العزلة وأهميتها&lt;/h3&gt;
&lt;p&gt;&lt;img alt="العزلة" src="/assets/images/2020/digital-min-4.jpg"&gt;&lt;/p&gt;
&lt;p&gt;قبل أن نناقش موضوع العزلة نحتاج لأن نفهم معنى العزلة. لذلك سنتجه إلى Raymond Kethledge و Michael Erwin واللذان كتبا كتاباً عن العزلة. أخذ منهما الكتاب سبع سنوات ولكن جهودهم توجت في عام 2017 بإصداره تحت عنوان Lead Yourself First.&lt;/p&gt;
&lt;p&gt;المؤلفان يذكران بدقة تعريف العزلة في كتابهما. العديد من الناس يربط العزلة بالعزلة الجسدية مثل الذهاب إلى الجبال إلى مكان بعيد لا بشر فيه. لكن المؤلفان يوضحان أن العزلة متعلقة بما يحدث داخل عقلك وليس بالبيئة المحيطة بك. وبناء على ذلك يعرفان العزلة أنها الحالة التي يكون فيها عقلك خالياً مما يأتي من عقول الآخرين.&lt;/p&gt;
&lt;p&gt;فطالما تركت عقلك يتعامل مع أفكاره الخاصة فأنت في عزلة. ولكن العزلة تزول عندما تسمح لمُدْخَلات من عقول الآخرين أن تقتحمها مثل أن تقوم بمحادثة مع شخص آخر أو تقرأ كتاباً أو تشاهد التلفاز أو تفعل أي شيء له علاقة بشاشة هاتفك.&lt;/p&gt;
&lt;p&gt;يقول &lt;a href="[https://ar.wikipedia.org/wiki/%D8%A8%D9%84%D9%8A%D8%B2_%D8%A8%D8%A7%D8%B3%D9%83%D8%A7%D9%84](https://ar.wikipedia.org/wiki/بليز_باسكال)"&gt;بليز باسكال&lt;/a&gt; العالم الفيزيائي والرياضي المعروف:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;كل مشاكل البشرية تنشأ من عدم قدرة الإنسان على الجلوس بهدوء في غرفة لوحده.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;هناك عدد متزايد من الأبحاث التي تشير إلى أن وقت التأمل والتفكير الهادئ الذي أمضاه &lt;a href="[https://ar.wikipedia.org/wiki/%D8%A3%D8%A8%D8%B1%D8%A7%D9%87%D8%A7%D9%85_%D9%84%D9%8A%D9%86%D9%83%D9%88%D9%86](https://ar.wikipedia.org/wiki/أبراهام_لينكون)"&gt;الرئيس الأمريكي السابق أبراهام لينكون&lt;/a&gt; في كوخ كان يأوي إليه قد يكون لعب دوراً أساسياً في مساعدة لينكون أن يتعامل مع صدمات الحرب الأهلية الأمريكية وأن يعالج القرارات الصعبة التي واجهها.&lt;/p&gt;
&lt;p&gt;يساور الناقدَ الاجتماعي الكندي مايكل هاريس القلقُ من أن التكنولوجيا الجديدة تساعد على إنشاء ثقافة تمسح وقت انفراد الشخص مع أفكاره ويقول أن الأمر في غاية الخطورة عندما يكون هذا الوقت تحت الخطر.&lt;/p&gt;
&lt;p&gt;إن قضاء فترات منتظمة من العزلة بين أوقات نشاطاتنا الاجتماعية هو أمر ضروري للنجاح والازدهار. وفهم هذه الحقيقة أمر ملح الآن أكثر من أي وقت مضى لأن العزلة - ولأول مرة في التاريخ - قد بدأت بالاختفاء من حياتنا كلياً.&lt;/p&gt;
&lt;h4 id="_5"&gt;الحرمان من العزلة أو فقدان العزلة&lt;/h4&gt;
&lt;p&gt;الحرمان من العزلة يتحقق عندما يكون الوقت الذي تنفقه لوحدك مع أفكارك وبدون مدخلات الآخرين شبه معدوم.&lt;/p&gt;
&lt;p&gt;حتى التسعينات من القرن الماضي (1990-1999) كان فِقدان العزلة أمراً يصعب تحقيقه. كان هناك العديد من الأحوال التي تجبرك على البقاء وحيداً مع أفكارك سواء أردت ذلك أم لا، مثلاً عند الانتظار في طابور وعند الدخول في طريق شديد الازدحام و عند المشي في الشارع إلى بيت صديقك إلخ. أما اليوم فإن فقدان العزلة صار أمراً منتشراً.&lt;/p&gt;
&lt;h3 id="_6"&gt;آثار فقدان العزلة&lt;/h3&gt;
&lt;p&gt;لمعرفة آثار فقدان العزلة فإنه من الأجدى أن ندرس ذلك على الأشخاص المولودين بعد عام 1995 لأن هؤلاء الأشخاص هم المجموعة الأولى التي دخلت سنوات ما قبل المراهقة مع توافر الهواتف المحمولة والأجهزة اللوحية واتصال دائم بالإنترنت؛ تلك المجموعة تستخدم التكنولوجيا بصورة مفرطة أكثر من غيرها، وأفراد هذه المجموعة متصلون بشكل دائم بالإنترنت.&lt;/p&gt;
&lt;p&gt;كنت أتحادث مع المسؤولة عن خدمات الصحة النفسية في جامعة معروفة جيداً حيث كنت مدعواً للحديث في تلك الجامعة. أخبرتني هذه المرأة أنها بدأت برؤية تغيرات كبيرة في صحة الطلاب النفسية. حتى وقت قريب كان قسم الصحة النفسية في الجامعة يتعامل مع المشاكل النفسية الشائعة على مدى العقود الماضية مثل الحنين للأسرة والوطن ومشاكل الاضطراب في الأكل وبعض الاكتئاب وأحياناً الوسواس القهري. ثم تغير كل شيء: أصبح عدد الطلاب الذين يطلبون إرشاداً نفسياً أكبر بكثير وظهرت مشكلة جديدة كانت فيما قبل نادرة نسبياً لكنها تفوقت على كل المشاكل الأخرى السابقة، وهي القلق (anxiety). عندما سألتها عن السبب الذي أدى لهذا التغير برأيها قالت بدون تردد أن السبب على الأرجح يتعلق بالهواتف المحمولة.&lt;/p&gt;
&lt;p&gt;تزامن ظهور الارتفاع المفاجئ في المشاكل المتعلقة بالقلق مع دخول الطلاب الذين نشؤوا على الهواتف المحمولة ووسائل التواصل الاجتماعي إلى الجامعة. لاحظت المسؤولة أن هؤلاء الطلاب كانوا يستقبلون ويرسلون الرسائل بشكل مستمر وجنوني. لقد بدا لها بوضوح أن هذا الاتصال المستمر كان يؤثر على كيمياء عقول أولئك الطلاب بشكل سلبي.&lt;/p&gt;
&lt;p&gt;بعد سنوات قليلة تم تأكيد حدس هذه المسؤولة من قبل أستاذة علم النفس في جامعة ولاية سان دييغو جين تونج (Jean Twenge) والتي تعد من أبرز الخبراء في العالم بالتغيرات في أجيال الشباب الأمريكي. تقول جين في مقالة لها نشرت عام 2017 أنها درست هذه التغيرات لأكثر من 25 سنة وأن هذه التغيرات كانت دائماً تظهر وتزداد بشكل تدريجي. ولكن بدءاً من عام 2012 لاحظت تحولاً يمكن وصفه بأي شيء إلا التدريجية في قياسات الحالات العاطفية للمراهقين: كانت هناك تغيرات ملفتة بالنسبة للشباب المولودون بين 1995 و2012، ومن أكبر هذه التغيرات وأكثرها إثارة للقلق التغيرات في الصحة النفسية لهؤلاء المراهقين. تقول جين أن نسب الاكتئاب والانتحار زادت بشكل حاد بين هؤلاء المراهقين بسبب الارتفاع الهائل في اضطرابات القلق على ما يبدو. وتقول أيضاً أن هذه التغيرات في الصحة النفسية ترتبط تماماً بالوقت الذي أصبح فيه امتلاك هاتف محمول أمراً شائعاً في أميركا.&lt;/p&gt;
&lt;p&gt;لقد فقد أولئك المراهقون القدرة على معالجة مشاعرهم وفهمها، وفقدوا القدرة على التفكير والتأمل في أسئلة مهمة مثل &amp;ldquo;من نحن؟&amp;rdquo; و &amp;ldquo;ما هي الأشياء المهمة حقاً؟&amp;rdquo;، وأيضاً فقدوا القدرة على بناء علاقات قوية، ووصلوا لدرجة أنهم لا يستطيعون إعطاء أدمغتهم وقتاً للراحة وإطفاء الأجزاء المتعلقة بالاتصال الاجتماعي حيث أن هذه الأجزاء ليست مُعَدّة للعمل بشكل متواصل.&lt;/p&gt;
&lt;h3 id="_7"&gt;ادمج مراسلاتك&lt;/h3&gt;
&lt;p&gt;بدلاً من أن يظل هاتفك متاحاً طوال الوقت يستهلك انتباهك ويقاطع أوقات تركيزك، بدلاً من ذلك اجعله دائماً في وضعية عدم الإزعاج (Do Not Disturb). هذا الوضع متاح على أجهزة آيفون وأندرويد. هذا الوضع يطفئ الإشعارات فلن تأتيك إشعارات عند وصول رسائل أو مكالمات جديدة أو غيرها. وإذا كنت قلقاً بشأن حالات الطوارئ أو بشأن مكالمات هامة من ابنك أو زوجتك مثلاً فيمكنك اختيار أرقام ليتم استثناؤها. ويمكنك أيضاً اختيار أن يتم تفعيل هذا الوضع أوتوماتيكياً في أوقات محددة. يمكنك مثلاً أن تختار تفعيل هذا الوضع طوال اليوم ما عدا ساعة محددة.&lt;/p&gt;
&lt;p&gt;الآن مع تفعيل هذا الوضع يمكنك تخصيص أوقات محددة للرد على الرسائل دفعة واحدة حيث تقوم بمراجعة جميع الرسائل التي أتتك منذ آخر مرة تفقدت فيها الجهاز والرد على ما تريد منها ويمكنك أيضاً أن تتحادث لوقت قصير قبل أن تعتذر لأنك تريد الذهاب وتفعل وضعية عدم الإزعاج مرة أخرى وتعود لإكمال يومك.&lt;/p&gt;
&lt;p&gt;لقد تعلمت طريقة من مدير تنفيذي في وادي السيليكون تمكنك من أن تحظى بمكالمات ذات جودة عالية مع العائلة والأصدقاء. فالمكالمات تعد ذات قيمة تواصلية أعلى من مجرد المحادثات النصية التي تفقد الكثير من عناصر التواصل الغنية. يقوم هذا الشخص بإخبار عائلته وأصدقائه أنه متاح للتحدث معه الساعة 5:30 كل يوم عمل (من الاثنين إلى الخميس في أميركا) وأنه لا حاجة للتنسيق معه مسبقاً، فقط اتصل به. كان هذا الموعد (5:30) هو الوقت الذي يبدأ فيه رحلة عودته إلى المنزل من العمل في طريق مزدحم.&lt;/p&gt;
&lt;p&gt;رأيت أشخاصاً آخرين يقومون بفعل أشياء مشابهة مثل &amp;ldquo;ساعات المقهى&amp;rdquo;. في هذه الطريقة تقوم باختيار وقت كل أسبوع للجلوس في مقهى تحبه مع صحيفة أو كتاب جيد؛ الصحيفة أو الكتاب فقط للاحتياط. وتقوم بإخبار الناس الذين تعرفهم أنك موجود دائماً في ذلك المقهى خلال الوقت الذي اخترته.&lt;/p&gt;
&lt;h3 id="_8"&gt;احظ بوقت فراغ ذي جودة عالية&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/digital-min-5.jpg"&gt;&lt;/p&gt;
&lt;p&gt;وقت الفراغ ذو الجودة المنخفضة هو وقت تنفقه على سبيل المثال في تصفح مواقع التواصل الاجتماعي بدون أي هدف.&lt;/p&gt;
&lt;p&gt;في العالم المهني: العديد من أصحاب الإنجازات العظيمة استراتيجيون دقيقون. إنهم يضعون رؤية لما يحاولون إنجازه على عدة مراحل زمنية بحيث يصلون بين الهدف النهائي الذي يسعون إليه وبين القرارات المتعلقة بالأشياء اليومية التي يفعلونها. لقد قمت بممارسة هذه الأنواع من الاستراتيجيات المهنية لعدة سنوات وكتبت عنها أيضاً.&lt;/p&gt;
&lt;p&gt;أقترح أن تضع استراتيجية للتخطيط لوقت فراغك عن طريق وضع خطة فصلية وخطة أسبوعية. بالنسبة للخطة الفصلية: يمكنك وضعها ثلاث مرات في السنة (كل أربعة شهور) أو أربع مرات في السنة إلخ.&lt;/p&gt;
&lt;h4 id="_9"&gt;الخطة الفصلية&lt;/h4&gt;
&lt;p&gt;تحتوي الخطة الفصلية على نوعين من العناصر: الغايات والعادات. كلاهما له علاقة بالحصول على وقت فراغ ذي جودة عالية. مثال:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;غاية: تعلم عزف كل أغاني فرقة س على الغيتار.&lt;/p&gt;
&lt;p&gt;الاستراتيجيات: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;صيانة الغيتار وتعديل أوتاره، إيجاد المخططات الوترية للأغاني وطباعتها ووضعها في مغلف بلاستيكي جميل&lt;/li&gt;
&lt;li&gt;العودة إلى عادتي القديمة في التدرب بشكل منتظم على الغيتار&lt;/li&gt;
&lt;li&gt;كمحفز: تنظيم حفلة في نوفمبر أقوم فيها بعزف هذه الأغاني&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;عادة: القيام بأنشطة ذات جودة منخفضة في وقت فراغي لمدة لا تزيد على ساعة يومياً.&lt;/p&gt;
&lt;p&gt;عادة: قراءة شيء في السرير كل ليلة.&lt;/p&gt;
&lt;p&gt;عادة: حضور فعالية ثقافية كل أسبوع.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;لا يوجد خط فاصل واضح بين العادات والغايات. في المثال أعلاه يمكن للمخطِّط أن يضيف عادة &amp;ldquo;التدرب على الغيتار مرتين في الأسبوع&amp;rdquo; إلى قائمة العادات بدلاً من وضعها في قسم الغايات.&lt;/p&gt;
&lt;h4 id="_10"&gt;الخطة الأسبوعية&lt;/h4&gt;
&lt;p&gt;لكل غاية من الغايات في الخطة الفصلية: قم بالتفكير في الأفعال التي يمكنك القيام بها خلال الأسبوع القادم للتقدم في طريق الوصول إلى تلك الغاية ثم حدد مواعيداً للقيام بهذه الأفعال. تحديد المواعيد أمر مهم.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;هل تجعلنا وسائل التواصل الاجتماعي أكثر اتصالاً؟&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;في دراسة قام بها فريق كبير من تخصصات متنوعة ونشرت في &amp;ldquo;المجلة الأمريكية للطب الوقائي&amp;rdquo; المرموقة في 2017. في هذه الدراسة قام بريماك وفريقه باستطلاع رأي عينة تمثل الراشدين الذين تتراوح أعمارهم بين 19 و 22. وجدت الدراسة أنه كلما ازداد استخدام الأشخاص لوسائل التواصل الاجتماعي زاد احتمال كونهم وحيدين. &amp;ldquo;إنها وسائل تواصل! ألا يجدر بالناس أن يشعروا بالاتصال عند استخدامها؟&amp;rdquo; لكن البيانات كانت واضحة: كلما زاد الوقت الذي تنفقه في &amp;ldquo;الاتصال&amp;rdquo; عبر هذه الوسائل زادت فرص أن تصبح وحيداً.&lt;/p&gt;
&lt;h2 id="_11"&gt;الملخص في فيديو&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/nvRrf8SWkto" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="كتب"/><category term="ملخص-كتاب"/><category term="تطوير-الذات"/><category term="قضايا-معاصرة"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس العاشر: قراءة بيانات من المستخدم + التعليقات</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-10-arabic.html" rel="alternate"/><published>2020-05-10T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-05-10:/ar/2020/learn-programming-with-python-1-10-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس العاشر: قراءة بيانات من المستخدم + التعليقات" src="/assets/images/2020/pyc-10-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على كيفية قراءة إدخالات من مستخدم برنامجنا واستعمال هذه الإدخالات ضمن البرنامج. وأيضاً سنتعرف على التعليقات في بايثون وفائدتها وكيفية إضافتها.&lt;/p&gt;
&lt;h2 id="reading-input-from-the-user"&gt;قراءة بيانات من المستخدم (Reading Input from the User)&lt;/h2&gt;
&lt;p&gt;في برامج بايثون يمكنك أن تقرأ بيانات يدخلها مستخدم برنامجك باستخدام الدالة &lt;code&gt;input()&lt;/code&gt;. مثلاً في المثال …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس العاشر: قراءة بيانات من المستخدم + التعليقات" src="/assets/images/2020/pyc-10-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على كيفية قراءة إدخالات من مستخدم برنامجنا واستعمال هذه الإدخالات ضمن البرنامج. وأيضاً سنتعرف على التعليقات في بايثون وفائدتها وكيفية إضافتها.&lt;/p&gt;
&lt;h2 id="reading-input-from-the-user"&gt;قراءة بيانات من المستخدم (Reading Input from the User)&lt;/h2&gt;
&lt;p&gt;في برامج بايثون يمكنك أن تقرأ بيانات يدخلها مستخدم برنامجك باستخدام الدالة &lt;code&gt;input()&lt;/code&gt;. مثلاً في المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;nam&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;What is your name? &amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Welcome&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nam&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;نطلب من المستخدم في السطر الأول أن يدخل اسمه وستنتظر بايثون المستخدم حتى يكتب اسمه ويضغط Enter ثم تطبع جملة ترحيب به تتضمن الاسم الذي أدخله. مثلاً إذا أدخل المستخدم&lt;code&gt;"Khaled"&lt;/code&gt; فسيطبع البرنامج &lt;code&gt;"Welcome Khaled"&lt;/code&gt;. الصورة التالية توضح مثالاً لتنفيذ هذا البرنامج الصغير:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/pyc-10-2.png"&gt;&lt;/p&gt;
&lt;p&gt;وكما قلنا سابقاً فإن القيم التي نحصل عليها من مصادر خارجية غالباً تأتي على شكل سلاسل نصية، وهذا يتضمن الدالة &lt;code&gt;input()&lt;/code&gt; فإن القيمة التي نحصل عليها من هذه الدالة هي سلسلة نصية حتى لو أدخل المستخدم أرقاماً.&lt;/p&gt;
&lt;p&gt;في المثال التالي سنطلب من المستخدم أن يدخل عدداً ثم نضرب هذا العدد ب 7 ونطبع الناتج للمستخدم:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Enter a number: &amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Result =&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لاحظ أنه قبل أن نضرب الرقم الذي يدخله المستخدم ب 7 فإننا نقوم بتحويل الإدخال إلى عدد باستخدام الدالة &lt;code&gt;int()&lt;/code&gt; لأن الإدخال في الأصل سلسلة نصية. إذا لم نقم بهذه الخطوة سيواجه البرنامج خطأ في التنفيذ كما رأينا سابقاً.&lt;/p&gt;
&lt;p&gt;لاحظ أننا نستخدم دالة &lt;code&gt;print()&lt;/code&gt; في آخر مثالين بشكل مختلف قليلاً حيث نعطي للدالة قيمتين بدل قيمة واحدة في السابق ونفصل بين القيمتين بفاصلة &lt;code&gt;,&lt;/code&gt;. بهذه الطريقة ستطبع الدالة القيمتين مفصولتين بمسافة (space) كما يظهر في الصورة أعلاه حيث طبع البرنامج &lt;code&gt;"Welcome Khaled"&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;القيم التي نعطيها لأي دالة يطلق عليها وسطاء وسنرى هذا بالتفصيل فيما بعد.&lt;/p&gt;
&lt;h2 id="comments"&gt;التعليقات (Comments)&lt;/h2&gt;
&lt;p&gt;عندما تتقدم في تعلم بايثون يمكنك أن تكتب برامج طويلة تحتوي على العديد من السطور والأوامر. لتساعد نفسك أولاً وغيرك ثانياً على فهم الكود والأوامر المكتوبة فيه عندما تعود لتقرأ برنامجك بعد فترة من الزمن: استخدم التعليقات. التعليقات هي سطور في برنامجك لا تؤثر على سير البرنامج أي أن بايثون لا تقوم بتنفيذ هذه السطور. وظيفة هذه السطور هي توضيح ما تفعله الأوامر الموجودة في برنامجك.&lt;/p&gt;
&lt;p&gt;مثلاً لنعد إلى البرنامج الذي يقوم بإيجاد أكثر كلمة تكراراً في ملف وعدد مرات تكرارها والذي رأيناه في درس سابق. هذا هو البرنامج:&lt;/p&gt;
&lt;p&gt;&lt;img alt="برنامج بايثون بدون تعليقات" src="/assets/images/2020/pyc-10-3.png"&gt;&lt;/p&gt;
&lt;p&gt;وهذا هو نفس البرنامج مع إضافة تعليقات مناسبة:&lt;/p&gt;
&lt;p&gt;&lt;img alt="برنامج بايثون مع تعليقات" src="/assets/images/2020/pyc-10-4.png"&gt;&lt;/p&gt;
&lt;p&gt;في الحالتين تنفيذ البرنامج لن يختلف ولكن ما سيختلف هو فهمك لما يفعله كل جزء من الكود عندما تعود لتقرأ البرنامج بعد سنة من كتابته مثلاً. لاحظ أني كتبت التعليقات بالعربية وهذا ممكن ولكن أكثر المبرمجين يكتبونها بالانكليزية.&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/hW_JOBMMavY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الحادي عشر: الشروط في بايثون</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-11-arabic.html" rel="alternate"/><published>2020-05-10T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-05-10:/ar/2020/learn-programming-with-python-1-11-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الحادي عشر: الشروط في بايثون" src="/assets/images/2020/pyc-11-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس ستتعرف على الشروط في بايثون: سنعرف معناها واستخداماتها وسنرى أمثلة عنها.&lt;/p&gt;
&lt;p&gt;باستخدام الجمل الشرطية نبدأ بإضافة شيء من &amp;ldquo;الذكاء&amp;rdquo; لبرامجنا، نجعل برنامجنا يختار الذهاب لليمين أو اليسار بناء على حدث معين. الجمل الشرطية هي جزء أساسي في جعل أجهزة الحاسب تبدو ذكية. ومفتاح الجمل الشرطية هي if …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الحادي عشر: الشروط في بايثون" src="/assets/images/2020/pyc-11-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس ستتعرف على الشروط في بايثون: سنعرف معناها واستخداماتها وسنرى أمثلة عنها.&lt;/p&gt;
&lt;p&gt;باستخدام الجمل الشرطية نبدأ بإضافة شيء من &amp;ldquo;الذكاء&amp;rdquo; لبرامجنا، نجعل برنامجنا يختار الذهاب لليمين أو اليسار بناء على حدث معين. الجمل الشرطية هي جزء أساسي في جعل أجهزة الحاسب تبدو ذكية. ومفتاح الجمل الشرطية هي if وهي الكلمة المحجوزة التي تعلن أننا نريد أن نفعل شيئاً شرطياً.&lt;/p&gt;
&lt;p&gt;مثال:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Smaller&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Bigger&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Finished&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في المثال أعلاه الشرط الأول هو &lt;code&gt;x &amp;lt; 10&lt;/code&gt;. فإذا تحقق الشرط وكانت قيمة &lt;code&gt;x&lt;/code&gt; أقل من 10 يقوم البرنامج بتنفيذ الجملة التالية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Smaller&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وإذا لم يتحقق الشرط فإن البرنامج يتجاوز الجملة ولا يقوم بتنفيذها. &lt;/p&gt;
&lt;p&gt;لاحظ كيف أن الجملة التابعة للشرط الأول منزاحة قليلاً إلى اليمين. هذا الانزياح يدل على أن الجملة تابعة لجملة &lt;code&gt;if&lt;/code&gt; التي فوقها. يمكن أن يكون لدينا أكثر من جملة واحدة لتنفيذها إذا تحقق الشرط، لكن في مثالنا هذا لدينا جملة واحدة.&lt;/p&gt;
&lt;p&gt;إذن وبكلمات أخرى: عند جملة if يتم طرح سؤال: &amp;ldquo;&lt;code&gt;x&lt;/code&gt; أقل من 10؟&amp;rdquo; وجواب هذا السؤال إما &amp;ldquo;صحيح&amp;rdquo; (True) أو &amp;ldquo;خطأ&amp;rdquo; (False). إذا كان الجواب True يتم تنفيذ الجمل التابعة للشرط أما إذا كان الجواب False يتم تجاوزها.&lt;/p&gt;
&lt;p&gt;في المثال: قيمة &lt;code&gt;x&lt;/code&gt; عند التحقق من الشرط هي 5 وهي أقل من 10 لذلك سينفذ البرنامج الجملة التابعة للشرط ويطبع &lt;code&gt;"Smaller"&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;بالنسبة للشرط الثاني: &lt;code&gt;x &amp;lt; 20&lt;/code&gt; فإن هذا الشرط غير متحقق في مثالنا بما أن قيمة &lt;code&gt;x&lt;/code&gt; هي 5 ولذلك فالبرنامج لن ينفذ الجملة المرتبطة بهذا الشرط وهي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Bigger&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;بالنسبة للأمر الأخير:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Finish&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;فسيتم تنفيذه دائماً مهما كانت قيمة &lt;code&gt;x&lt;/code&gt; لأنه غير متعلق بأي شرط.&lt;/p&gt;
&lt;p&gt;كما رأينا في المثال فإن الجمل التابعة لشرط معين تكون منزاحة إلى اليمين قليلاً حتى تعرف بايثون أن هذه الجمل تابعة لذلك الشرط. مقدار الانزياح الموصى به هو 4 فراغات.&lt;/p&gt;
&lt;p&gt;ولتوضيح المثال السابق أكثر نعود لهذه الصورة والتي رأيناها في درس سابق عندما شرحنا النمط الشرطي في برامج بايثون:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/pyc-11-2.png"&gt;&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/HzYDIpMSVBc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس التاسع: تحويل أنواع البيانات في بايثون</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-9-arabic.html" rel="alternate"/><published>2020-04-26T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-04-26:/ar/2020/learn-programming-with-python-1-9-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس التاسع: تحويل أنواع البيانات في بايثون" src="/assets/images/2020/pyc-9-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على كيفية تحويل أنواع البيانات في بايثون وسنرى متى سنحتاج إلى ذلك في برامجنا.&lt;/p&gt;
&lt;h3 id="data-type-conversion"&gt;تحويل أنواع البيانات (Data-Type Conversion)&lt;/h3&gt;
&lt;p&gt;توفر بايثون لنا دوالاً تمكننا من تحويل نوع البيانات، فمثلاً يمكننا تحويل عدد صحيح إلى عشري أو العكس:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mf"&gt;3.0&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;4.5 …&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس التاسع: تحويل أنواع البيانات في بايثون" src="/assets/images/2020/pyc-9-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على كيفية تحويل أنواع البيانات في بايثون وسنرى متى سنحتاج إلى ذلك في برامجنا.&lt;/p&gt;
&lt;h3 id="data-type-conversion"&gt;تحويل أنواع البيانات (Data-Type Conversion)&lt;/h3&gt;
&lt;p&gt;توفر بايثون لنا دوالاً تمكننا من تحويل نوع البيانات، فمثلاً يمكننا تحويل عدد صحيح إلى عشري أو العكس:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mf"&gt;3.0&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;4.5&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول قمنا بتعريف متغير اسمه &lt;code&gt;x&lt;/code&gt; ووضعنا فيه العدد الصحيح &lt;code&gt;3&lt;/code&gt;؛ في هذه الحالة فإن نوع &lt;code&gt;x&lt;/code&gt; سيكون &lt;code&gt;int&lt;/code&gt;. ثم في السطر الثاني قمنا بتحويل نوع المتغير إلى &lt;code&gt;float&lt;/code&gt; باستخدام الدالة المسماة &lt;code&gt;float()&lt;/code&gt; ونرى أن الناتج هو &lt;code&gt;3.0&lt;/code&gt;. صحيح أن &lt;code&gt;3&lt;/code&gt; يساوي في الحقيقة &lt;code&gt;3.0&lt;/code&gt; لكن نوعهما مختلفان بالنسبة لبايثون: عندما تضيف الفاصلة العشرية لرقم يصبح نوعه &lt;code&gt;float&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;في السطر الثالث قمنا بتعريف متغير اسمه &lt;code&gt;y&lt;/code&gt; ووضعنا فيه عدداً عشرياً قيمته &lt;code&gt;4.5&lt;/code&gt; وهذا سيجعل &lt;code&gt;y&lt;/code&gt; من نوع &lt;code&gt;float&lt;/code&gt;. في السطر الرابع قمنا بتحويل نوع هذا المتغير إلى عدد صحيح &lt;code&gt;int&lt;/code&gt; باستخدام الدالة المسماة &lt;code&gt;int()&lt;/code&gt; وكان ناتج التحويل &lt;code&gt;4&lt;/code&gt; حيث أن دالة &lt;code&gt;int()&lt;/code&gt; تقوم بأخذ الرقم الذي على يسار الفاصلة العشرية وتترك ما على يمينها.&lt;/p&gt;
&lt;p&gt;أيضاً يمكننا استخدام الدوال &lt;code&gt;int()&lt;/code&gt; و &lt;code&gt;float()&lt;/code&gt; لتحويل السلاسل النصية إلى أرقام. لماذا قد نحتاج لذلك؟ لأنه في الكثير من الأحيان عندما تستقبل برامجنا بيانات من مصادر خارجية مثل الانترنت - كما سنرى لاحقاً - فإن هذه البيانات تأتي على شكل سلاسل نصية حتى لو كانت في حقيقتها تعبر عن أرقام. مثلاً:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;str_val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;123&amp;quot;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str_val&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;str&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str_val&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول نعرف متغيراً اسمه &lt;code&gt;str_val&lt;/code&gt; ونضع فيه سلسلة نصية هي &lt;code&gt;"123"&lt;/code&gt;. لاحظ أن السلسلة تحوي أرقاماً ولكن بايثون تعاملها كنص كما تعامل &lt;code&gt;"abc"&lt;/code&gt; بالضبط. لدلك عندما نحاول جمع هذه السلسلة النصية والرقم &lt;code&gt;3&lt;/code&gt; في السطر الأخير فإن بايثون ستخبرنا بأن خطأ وقع يشبه الخطأ الذي رأيناه في الأعلى.فبايثون لا تكترث إذا كانت السلسلة النصية تحتوي أرقاماً أو أحرفاً؛ المهم أنها سلسلة نصية، فعندما تحاول جمع رقم مع سلسلة نصية فإن بايثون ستواجه خطأ في التنفيذ.&lt;/p&gt;
&lt;p&gt;لذلك إذا أردنا التعامل مع الرقم الموجود في هذه السلسلة النصية كرقم وليس كنص فعلينا استخدام الدالة &lt;code&gt;int()&lt;/code&gt; لتحويل هذه السلسلة إلى رقم صحيح كالتالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;int_val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str_val&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;int_val&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;int&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;int_val&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;126&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول حولنا السلسلة النصية إلى عدد صحيح ثم في السطر الأخير أضفنا &lt;code&gt;3&lt;/code&gt; إليه وكان الناتج &lt;code&gt;126&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;لكن هناك أمر يجب التنبه له وهو أنه يجب أن تحتوي السلسلة النصية فقط على رقم حتى تستطيع تحويل نوعها باستخدام &lt;code&gt;int()&lt;/code&gt; أو &lt;code&gt;float()&lt;/code&gt;. في المثال التالي نقوم بمحاولة تحويل سلسلة نصية إلى رقم:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;es&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;hello&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;es&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;es&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;عندما تقوم بايثون بتنفيذ السطر الثاني فستواجه خطأ لأن السلسلة &lt;code&gt;es&lt;/code&gt; لا تحتوي على أرقام.&lt;/p&gt;
&lt;p&gt;أخيراً: فإنه يمكن تحويل الأرقام الصحيحة والعشرية إلى سلاسل نصية باستخدام دالة &lt;code&gt;str()&lt;/code&gt;. نحتاج إلى ذلك عندما نريد إدراج رقم في داخل نص موجود لدينا كما سنرى في العديد من الأمثلة مستقبلاً إن شاء الله. مثال:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="s1"&gt;&amp;#39;str&amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Your age is: &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;
&lt;span class="s1"&gt;&amp;#39;Your age is: 13&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="_1"&gt;ملاحظات&lt;/h3&gt;
&lt;p&gt;عندما تجمع عدد صحيح وعدد عشري في بايثون فإن الناتج سيكون عدداً عشرياً وعندما تقسم عدداً على أي عدد آخر فإن الناتج سيكون أيضاً عدداً عشرياً (float):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;45.2&lt;/span&gt;
&lt;span class="mf"&gt;168.2&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="mf"&gt;2.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="_2"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/qbMZMkEb_As" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الثامن: أنواع البيانات في بايثون</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-8-arabic.html" rel="alternate"/><published>2020-04-20T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-04-20:/ar/2020/learn-programming-with-python-1-8-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثامن: أنواع البيانات في بايثون" src="/assets/images/2020/pyc-8-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على أنواع البيانات في بايثون وسنرى أمثلة على كل نوع وسنرى طريقة لمعرفة نوع البيانات داخل برامج بايثون.&lt;/p&gt;
&lt;h2 id="data-types"&gt;أنواع البيانات (Data Types)&lt;/h2&gt;
&lt;p&gt;في بايثون هناك ثلاثة أنواع رئيسية للبيانات والمتغيرات: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;رقم صحيح (Integer) مثل &lt;code&gt;2&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;رقم عشري (Floating-point Number) مثل &lt;code&gt;3.5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;سلسلة نصية (String) مثل …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثامن: أنواع البيانات في بايثون" src="/assets/images/2020/pyc-8-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على أنواع البيانات في بايثون وسنرى أمثلة على كل نوع وسنرى طريقة لمعرفة نوع البيانات داخل برامج بايثون.&lt;/p&gt;
&lt;h2 id="data-types"&gt;أنواع البيانات (Data Types)&lt;/h2&gt;
&lt;p&gt;في بايثون هناك ثلاثة أنواع رئيسية للبيانات والمتغيرات: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;رقم صحيح (Integer) مثل &lt;code&gt;2&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;رقم عشري (Floating-point Number) مثل &lt;code&gt;3.5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;سلسلة نصية (String) مثل &lt;code&gt;"نص"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;بايثون تعرف الفرق بين هذه الأنواع. مثلاً العامل &lt;code&gt;+&lt;/code&gt; إذا تم استخدامه بين رقمين سيقوم بعملية الجمع بينما إذا تم استخدامه بين سلسلتين نصيتين سيقوم بدمجهما معاً كما يلي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;dd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;9&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;hello &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Ahmad&amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ee&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;Ahmad&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لكن ماذا لو استخدمت &lt;code&gt;+&lt;/code&gt; بين سلسلة نصية وعدد كما في المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;gg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;hello &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Ahmad&amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;gg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gg&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في هذه الحالة بايثون لن تستطيع تنفيذ هذا الأمر وستظهر رسالة خطأ:&lt;/p&gt;
&lt;p&gt;&lt;img alt="رسالة خطأ من بايثون" src="/assets/images/2020/pyc-8-2.png"&gt;&lt;/p&gt;
&lt;p&gt;تخبرك رسالة الخطأ بنوع الخطأ وفي أي سطر وقع وتخبرك بسبب الخطأ. في هذه الحالة السبب يقول أنه يمكن دمج سلسلة نصية مع سلسلة نصية أخرى فقط وليس مع عدد.&lt;/p&gt;
&lt;p&gt;بايثون توفر لنا دالة (function) اسمها &lt;code&gt;type()&lt;/code&gt; تمكننا من معرفة نوع البيانات كما في المثال التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1234&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;int&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ammar&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;str&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;11.44&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;float&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;text&amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;str&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;فكما ترى في السطر الأول نضع عدداً صحيحاً فتخبرنا بايثون أن نوعه &lt;code&gt;int&lt;/code&gt; وهي اختصار كلمة Integer وتعني عدد صحيح. في السطر الثاني نضع سلسلة نصية فتخبرنا بايثون أن نوعها &lt;code&gt;str&lt;/code&gt; وهي اختصار كلمة String وتعني سلسلة نصية. في السر الثالث نضع عدداً عشرياً (أي فيه فاصلة عشرية) فتخبرنا بايثون أن نوعه &lt;code&gt;float&lt;/code&gt; اختصاراً لـ Floating-point وتعني الفاصلة العائمة وهي طريقة تمثيل الأعداد العشرية في الحاسب.&lt;/p&gt;
&lt;p&gt;نرى أيضاً أنه يمكننا باستخدام هذه الدالة معرفة نوع المتغير حيث قمنا بتعريف متغير اسمه &lt;code&gt;x&lt;/code&gt; ووضعنا سلسلة نصية بداخله ثم عرفنا باستخدام الدالة أن نوعه &lt;code&gt;str&lt;/code&gt;. &lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/WNMAnnXDsI4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>Digital Minimalism - Book Notes</title><link href="https://ammar-alyousfi.com/2020/digital-minimalism-book-notes.html" rel="alternate"/><published>2020-04-17T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-04-17:/2020/digital-minimalism-book-notes.html</id><summary type="html">&lt;p&gt;I recently finished reading &amp;ldquo;Digital Minimalism: Choosing a Focused Life in a Noisy World&amp;rdquo; book by Cal Newport. I liked it and found many useful ideas in it especially in the current time where technology has reached unprecedented degrees of proliferation in our lives. Here, I will share what I …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I recently finished reading &amp;ldquo;Digital Minimalism: Choosing a Focused Life in a Noisy World&amp;rdquo; book by Cal Newport. I liked it and found many useful ideas in it especially in the current time where technology has reached unprecedented degrees of proliferation in our lives. Here, I will share what I liked most in this book.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2020/digital-min-cover.jpg" style="max-width:200px"&gt;&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/40672036-digital-minimalism"&gt;Digital Minimalism&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="the-problems-with-modern-technology"&gt;The Problems with Modern Technology&lt;/h2&gt;
&lt;p&gt;&lt;img alt="مشكلة التكنولوجيا الحديثة" src="/assets/images/2020/digital-min-2.jpg"&gt;&lt;/p&gt;
&lt;p&gt;The irresistible attraction to screens is leading people to feel as though they’re ceding more and more of their autonomy when it comes to deciding how they direct their attention.&lt;/p&gt;
&lt;p&gt;They downloaded the apps and set up accounts for good reasons, only to discover that these services were beginning to undermine the very values that made them appealing in the first place: they joined Facebook to stay in touch with friends across the country, and then ended up unable to maintain an uninterrupted conversation with the friend sitting across the table.&lt;/p&gt;
&lt;p&gt;What’s making us uncomfortable is this feeling of losing control—a feeling that instantiates itself in a dozen different ways each day, such as when we tune out with our phone during our child’s bath time, or lose our ability to enjoy a nice moment without a frantic urge to document it for a virtual audience.&lt;/p&gt;
&lt;p&gt;The urge to check Twitter or refresh Reddit becomes a nervous twitch that shatters uninterrupted time into shards too small to support the presence necessary for an intentional life.&lt;/p&gt;
&lt;p&gt;In an open marketplace for attention, darker emotions attract more eyeballs than positive and constructive thoughts. For heavy internet users, repeated interaction with this darkness can become a source of draining negativity.&lt;/p&gt;
&lt;p&gt;Many of the apps and sites that keep people compulsively checking their smartphones and opening browser tabs often leverage two hooks to make themselves nearly impossible to resist: intermittent positive reinforcement and the drive for social approval. Rewards delivered unpredictably are far more enticing than those delivered with a known pattern. Something about unpredictability releases more dopamine. You can describe users as “gambling” every time they post something on a social media platform: Will you get likes (or hearts or retweets), or will it languish with no feedback?&lt;/p&gt;
&lt;p&gt;The hot new technologies that emerged in the past decade or so are particularly well suited to foster behavioral addictions, leading people to use them much more than they think is useful or healthy. Indeed, as revealed by whistleblowers and researchers like Tristan Harris, Sean Parker, Leah Pearlman, and Adam Alter, these technologies are in many cases specifically designed to trigger this addictive behavior. Compulsive use, in this context, is not the result of a character flaw, but instead the realization of a massively profitable business plan.&lt;/p&gt;
&lt;h2 id="the-solution-digital-minimalism"&gt;The Solution: Digital Minimalism&lt;/h2&gt;
&lt;p&gt;&lt;img alt="التقليلية" src="/assets/images/2020/digital-min-3.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Digital Minimalism is a philosophy of technology use in which you focus your online time on a small number of carefully selected and optimized activities that strongly support things you value, and then happily miss out on everything else.&lt;/p&gt;
&lt;p&gt;The law of diminishing returns is familiar to anyone who studies economics. It applies to the improvement of production processes and says, at a high level, that investing more resources into a process cannot indefinitely improve its output—eventually you’ll approach a natural limit and start experiencing less and less extra benefit from continued investment. &lt;/p&gt;
&lt;p&gt;&lt;img alt="The law of diminishing returns" src="/assets/images/2020/Law-of-Diminishing-Returns.jpg"&gt;
&lt;a href="https://thepeakperformancecenter.com/business/strategic-management/the-law-of-diminishing-returns/"&gt;Image source&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Most people invest very little energy into optimizing their digital lives. To use the appropriate economic terminology, most people’s personal technology processes currently exist on the early part of the return curve—the location where additional attempts to optimize will yield massive improvements. It’s this reality that leads digital minimalists to focus not just on what technologies they adopt, but also on how they use them.&lt;/p&gt;
&lt;h3 id="the-digital-declutter-process"&gt;The Digital Declutter Process&lt;/h3&gt;
&lt;p&gt;For thirty days, you’re supposed to take a break from “optional technologies” in your life. The first step of the declutter process, therefore, is to define which technologies fall into this “optional” category.&lt;/p&gt;
&lt;p&gt;When I say technology in this context, I mean the general class of things we’ve been calling “new technologies” throughout this book, which include apps, websites, and related digital tools that are delivered through a computer screen or a mobile phone.&lt;/p&gt;
&lt;p&gt;To allow an optional technology back into your life at the end of the digital declutter, it must:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Serve something you deeply value&lt;/li&gt;
&lt;li&gt;Be the best way to serve this value&lt;/li&gt;
&lt;li&gt;Have rules that specify when and how you use it&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="the-importance-of-solitude"&gt;The Importance of Solitude&lt;/h3&gt;
&lt;p&gt;&lt;img alt="العزلة" src="/assets/images/2020/digital-min-4.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Before we can usefully discuss solitude, we need to better understand what we mean by this term. To aid us in this effort, we can turn toward Raymond Kethledge and Michael Erwin who wrote a book on the topic of solitude. It took them seven years, but their efforts culminated in the 2017 release of Lead Yourself First. &lt;/p&gt;
&lt;p&gt;The authors state a precise definition of solitude. Many people mistakenly associate this term with physical separation—requiring, perhaps, that you hike to a remote cabin miles from another human being. As Kethledge and Erwin explain, however, solitude is about what’s happening in your brain, not the environment around you. Accordingly, they define it to be a subjective state in which your mind is free from input from other minds.&lt;/p&gt;
&lt;p&gt;So as long as your mind is left to grapple only with its own thoughts, you are in solitude. On the other hand, solitude can be banished in even the quietest setting if you allow input from other minds to intrude. In addition to direct conversation with another person, these inputs can also take the form of reading a book, listening to a podcast, watching TV, or performing just about any activity that might draw your attention to a smartphone screen.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;All of humanity’s problems stem from man’s inability to sit quietly in a room alone” 
—Blaise Pascal.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A growing amount of research suggests that the time and space for quiet reflection the cottage enabled may have played a key role in helping Lincoln make sense of the traumas of the Civil War and tackle the hard decisions he faced.&lt;/p&gt;
&lt;p&gt;A Canadian social critic named Michael Harris talked about solitude in his 2017 book &amp;ldquo;Solitude&amp;rdquo;. Harris is concerned that new technologies help create a culture that undermines time alone with your thoughts, noting that “it matters enormously when that resource is under attack&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Regular doses of solitude, mixed in with our default mode of sociality, are necessary to flourish as a human being. It’s more urgent now than ever that we recognize this fact, because for the first time in human history solitude is starting to fade away altogether.&lt;/p&gt;
&lt;h4 id="solitude-deprivation"&gt;Solitude Deprivation&lt;/h4&gt;
&lt;p&gt;Solitude deprivation is a state in which you spend close to zero time alone with your own thoughts and free from input from other minds.&lt;/p&gt;
&lt;p&gt;As recently as the 1990s, solitude deprivation was difficult to achieve. There were just too many situations in everyday life that forced you to be alone with your thoughts, whether you wanted to or not—waiting in line, crammed into a crowded subway car, walking down the street, working on your yard. Today, it’s become widespread.&lt;/p&gt;
&lt;h5 id="solitude-deprivation-consequences"&gt;Solitude Deprivation Consequences&lt;/h5&gt;
&lt;p&gt;When it comes to constant connectivity, extreme use of technology is readily apparent among young people born after 1995—the first group to enter their preteen years with access to smartphones, tablets, and persistent internet connectivity. If persistent solitude deprivation causes problems, we should see them show up here first.&lt;/p&gt;
&lt;p&gt;I was chatting with the head of mental health services at a well-known university where I had been invited to speak. This administrator told me that she had begun seeing major shifts in student mental health. Until recently, the mental health center on campus had seen the same mix of teenage issues that have been common for decades: homesickness, eating disorders, some depression, and the occasional case of OCD. &lt;/p&gt;
&lt;p&gt;Then everything changed. Seemingly overnight the number of students seeking mental health counseling massively expanded, and the standard mix of teenage issues was dominated by something that used to be relatively rare: anxiety. When I asked her what she thought caused the change, she answered without hesitation that it probably had something to do with smartphones. &lt;/p&gt;
&lt;p&gt;The sudden rise in anxiety-related problems coincided with the first incoming classes of students that were raised on smartphones and social media. She noticed that these new students were constantly and frantically processing and sending messages. It seemed clear that the persistent communication was somehow messing with the students’ brain chemistry.&lt;/p&gt;
&lt;p&gt;A few years later, this administrator’s hunch was validated by San Diego State University psychology professor Jean Twenge, who is one of the world’s foremost experts on generational differences in American youth. &lt;/p&gt;
&lt;p&gt;As Twenge notes in a September 2017 article for the Atlantic, she has been studying these trends for over twenty-five years, and they almost always appear and grow gradually. But starting around 2012, she noticed a shift in measurements of teenager emotional states that was anything but gradual: Young people born between 1995 and 2012, a group Twenge calls “iGen,” exhibited remarkable differences. One of the biggest and most troubling changes was iGen’s psychological health. “Rates of teen depression and suicide have skyrocketed,” Twenge writes, with much of this seemingly due to a massive increase in anxiety disorders. She notes that these shifts in mental health correspond “exactly” to the moment when American smartphone ownership became ubiquitous.&lt;/p&gt;
&lt;p&gt;These teenagers have lost the ability to process and make sense of their emotions, or to reflect on who they are and what really matters, or to build strong relationships, or even to just allow their brains time to power down their critical social circuits, which are not meant to be used constantly.&lt;/p&gt;
&lt;h3 id="consolidate-technology-sessions"&gt;Consolidate Technology Sessions&lt;/h3&gt;
&lt;p&gt;Keep your phone in Do Not Disturb mode by default. On both iPhones and Android devices, for example, this mode turns off notifications when text messages arrive. If you’re worried about emergencies, you can easily adjust the settings so calls from a selected list (your spouse, your kid’s school) do come through. You can also set a schedule that turns the phone to this mode automatically during predetermined times.&lt;/p&gt;
&lt;p&gt;You can now schedule specific times for texting—consolidated sessions in which you go through the backlog of texts you received since the last check, sending responses as needed and perhaps even having some brief back-and-forth interaction before apologizing that you have to go, turning the phone back to Do Not Disturb mode, and continuing with your day.&lt;/p&gt;
&lt;p&gt;I learned a practice that allows you to regularly enjoy rich phone conversations from a technology executive in Silicon Valley who innovated a novel strategy for supporting high-quality interaction with friends and family: he tells them that he’s always available to talk on the phone at 5:30 p.m. on weekdays. There’s no need to schedule a conversation or let him know when you plan to call—just dial him up. As it turns out, 5:30 is when he begins his traffic-clogged commute home in the Bay Area.&lt;/p&gt;
&lt;p&gt;I’ve seen several variations of this practice work well like &amp;ldquo;Coffee shop hours&amp;rdquo;. In this variation, you pick some time each week during which you settle into a table at your favorite coffee shop with the newspaper or a good book. The reading, however, is just the backup activity. You spread the word among people you know that you’re always at the shop during these hours.&lt;/p&gt;
&lt;h3 id="have-a-high-quality-leisure-time"&gt;Have a High-quality Leisure Time&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/digital-min-5.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Low-quality leisure time is time spent on mindlessly and lazily browsing social media websites for example.&lt;/p&gt;
&lt;p&gt;In the professional world, many high achievers are meticulous strategists. They lay out a vision for what they’re trying to accomplish on multiple different time scales, connecting high-level ambition to decisions about daily actions. I’ve both practiced and written about these types of professional strategies for many years.&lt;/p&gt;
&lt;p&gt;I suggest you strategize the leisure-time part of your life with a two-level approach consisting of both a seasonal and weekly leisure plan.&lt;/p&gt;
&lt;h4 id="seasonal-leisure-plan"&gt;Seasonal Leisure Plan&lt;/h4&gt;
&lt;p&gt;Seasonal leisure plan contains two different types of items: objectives and habits; both be connected to cultivating a high-quality leisure life. Example:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Objective: Learn on the guitar every song from the A-side of Meet the Beatles!&lt;/p&gt;
&lt;p&gt;Strategies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Restring and retune my guitar, find the chord charts for the songs, print them, and put them in nice plastic protector sheets.&lt;/li&gt;
&lt;li&gt;Return to my old habit of regularly practicing my guitar.&lt;/li&gt;
&lt;li&gt;As incentive, schedule Beatles party in November. Perform songs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Habit: During the week, restrict low-quality leisure to only sixty minutes a night.&lt;/p&gt;
&lt;p&gt;Habit: Read something in bed every night.&lt;/p&gt;
&lt;p&gt;Habit: Attend one cultural event per week.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The boundary between habits and objectives is porous. In our above examples, our hypothetical planner might have added “practice guitar twice a week” to her habit list instead of including it in her Beatles-themed objective.&lt;/p&gt;
&lt;h4 id="the-weekly-leisure-plan"&gt;The Weekly Leisure Plan&lt;/h4&gt;
&lt;p&gt;For each of the objectives in the seasonal plan, figure out what actions you can do during the week to make progress on these objectives, and then, crucially, schedule exactly when you’ll do these things.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Does social media make us more connected?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There is a study authored by a large team from diverse disciplines. It appeared in the prestigious American Journal of Preventive Medicine in July 2017. In this study, Primack and his team surveyed a nationally representative sample of adults between the ages of nineteen and twenty-two. The researchers found that the more someone used social media, the more likely they were to be lonely. “It’s social media, so aren’t people supposed to be socially connected?” But the data was clear. The more time you spend “connecting” on these services, the more isolated you’re likely to become.&lt;/p&gt;</content><category term="books"/><category term="book-summary"/><category term="minimalism"/><category term="technology"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس السابع: العمليات الحسابية في بايثون</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-7-arabic.html" rel="alternate"/><published>2020-04-12T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-04-12:/ar/2020/learn-programming-with-python-1-7-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس السابع: العمليات الحسابية في بايثون" src="/assets/images/2020/pyc-7-2.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على العمليات الحسابية المختلفة في بايثون وكيفية إجرائها، وسنتعرف أيضاً على أولوية كل عملية بالنسبة لبايثون.&lt;/p&gt;
&lt;h2 id="mathematical-operations"&gt;العمليات الحسابية (Mathematical Operations)&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: right;"&gt;العامل&lt;/th&gt;
&lt;th style="text-align: right;"&gt;العملية&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;+&lt;/td&gt;
&lt;td style="text-align: right;"&gt;جمع (Addition)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;-&lt;/td&gt;
&lt;td style="text-align: right;"&gt;طرح (Subtraction)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;*&lt;/td&gt;
&lt;td style="text-align: right;"&gt;ضرب (Multiplication)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;/&lt;/td&gt;
&lt;td style="text-align: right;"&gt;قسمة (Division)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;**&lt;/td&gt;
&lt;td style="text-align: right;"&gt;رفع إلى أس (Power)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;٪&lt;/td&gt;
&lt;td style="text-align: right;"&gt;باقي القسمة (Remainder)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;جميع هذه العمليات معروفة. بالنسبة لعملية باقي القسمة (remainder …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس السابع: العمليات الحسابية في بايثون" src="/assets/images/2020/pyc-7-2.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على العمليات الحسابية المختلفة في بايثون وكيفية إجرائها، وسنتعرف أيضاً على أولوية كل عملية بالنسبة لبايثون.&lt;/p&gt;
&lt;h2 id="mathematical-operations"&gt;العمليات الحسابية (Mathematical Operations)&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: right;"&gt;العامل&lt;/th&gt;
&lt;th style="text-align: right;"&gt;العملية&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;+&lt;/td&gt;
&lt;td style="text-align: right;"&gt;جمع (Addition)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;-&lt;/td&gt;
&lt;td style="text-align: right;"&gt;طرح (Subtraction)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;*&lt;/td&gt;
&lt;td style="text-align: right;"&gt;ضرب (Multiplication)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;/&lt;/td&gt;
&lt;td style="text-align: right;"&gt;قسمة (Division)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;**&lt;/td&gt;
&lt;td style="text-align: right;"&gt;رفع إلى أس (Power)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: right;"&gt;٪&lt;/td&gt;
&lt;td style="text-align: right;"&gt;باقي القسمة (Remainder)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;جميع هذه العمليات معروفة. بالنسبة لعملية باقي القسمة (remainder) فهو كما تشرح الصورة التالية:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/pyc-7-1.jpg"&gt;&lt;/p&gt;
&lt;p&gt;في هذه الصورة: تم تقسيم سبعة عظام على كلبين فكان نصيب كل منهما ثلاث عظمات وبقيت عظمة، فباقي القسمة يساوي 1. هذه العملية مفيدة في عدة أحيان. مثلاً عندما نريد أن نحدد في برنامجنا إذا ما كان العدد زوجياً أم فردياً فيمكننا أن نعرف ذلك عن طريق النظر إلى باقي قسمة هذا العدد على 2: إن كان الباقي صفراً فالعدد زوجي وإلا كان فردياً.&lt;/p&gt;
&lt;h3 id="order-of-operations"&gt;أولوية العمليات (Order of Operations)&lt;/h3&gt;
&lt;p&gt;تختلف قوة العوامل فمثلاً عامل الضرب أقوى من عامل الجمع ولذلك فإن للضرب أولوية على الجمع. القائمة التالية تشرح ترتيب العمليات حسب الأولوية:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;الأقواس: العمليات بين الأقواس تنفذ قبل غيرها&lt;/li&gt;
&lt;li&gt;الرفع إلى أس&lt;/li&gt;
&lt;li&gt;الضرب والقسمة وباقي القسمة: كلها لها نفس الأولوية&lt;/li&gt;
&lt;li&gt;الجمع والطرح&lt;/li&gt;
&lt;li&gt;من اليسار إلى اليمين: عندما يكون هناك عمليات لها نفس الأولوية ننفذها بدءاً من اليسار إلى اليمين&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;كمثال على أولوية العمليات: ما هو ناتج تنفيذ الأوامر التالية؟&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;سيتم تنفيذ &lt;code&gt;2 ** 3&lt;/code&gt; في البداية لأنها العملية صاحبة الأولوية الأكبر هنا، وسينتج عن العملية العدد 8. فتتحول الجملة من:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;3&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;إلى &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;الآن يتم تنفيذ عملية القسمة لأنها ذات الأولوية الأعلى. صحيح أن عملية الضرب لها نفس الأولوية لكن عملية القسمة تأتي قبلها وكما قلنا سابقاً: عندما تتساوى الأولوية نتحرك من اليسار إلى اليمين. فتصبح الجملة:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;الآن يتم تنفيذ عملية الضرب لتصبح الجملة:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وبعدها ننفذ العملية الأخيرة وهي الجمع لنحصل على الناتج النهائي وهو 11.&lt;/p&gt;
&lt;p&gt;إذا أردنا أن نغير الترتيب الذي تجري به العمليات أو إذا أردنا مجرد جعل الأمور أكثر وضوحاً خاصة في الجمل الحسابية الطويلة فيمكننا استخدام الأقواس. مثلاً في الجملة السابقة إذا أردنا لعملية الجمع أن يتم تنفيذها قبل البقية نضع أقواساً كما يلي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;(1 + 2) ** 3 / 4 * 5
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وعندها سيتم تنفيذ ما بين الأقواس أولاً لأن لها الأولوية الكبرى وسينتج من ذلك:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;3&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;3&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وسيتم التنفيذ خطوة بعد خطوة حتى نصل إلى الناتج وهو 33.75 وهو رقم مختلف عن الجملة التي بدون أقواس.&lt;/p&gt;
&lt;p&gt;ملاحظة: إذا كنت في شك من أمرك فاستعمل الأقواس للتأكد من أن بايثون ستنفذ العملية بالترتيب الذي تريده.&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/EUL5BCCDukQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس السادس: الثوابت والمتغيرات في بايثون</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-6-arabic.html" rel="alternate"/><published>2020-04-06T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-04-06:/ar/2020/learn-programming-with-python-1-6-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس السادس: الثوابت والمتغيرات في بايثون" src="/assets/images/2020/pyc-6-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف بالتفصيل على الثوابت والمتغيرات في لغة بايثون مع أمثلة توضيحية.&lt;/p&gt;
&lt;h2 id="constants"&gt;الثوابت (Constants)&lt;/h2&gt;
&lt;p&gt;الثوابت هي قيم ثابتة قد تكون أرقاماً أو أحرفاً أو سلاسل نصية. يطلق عليها ثوابت لأنها لا تتغير. وهي أنواع:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;الثوابت الرقمية هي الأرقام التي نعرفها جميعاً مثل 2 و 5 و 4.6 …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس السادس: الثوابت والمتغيرات في بايثون" src="/assets/images/2020/pyc-6-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف بالتفصيل على الثوابت والمتغيرات في لغة بايثون مع أمثلة توضيحية.&lt;/p&gt;
&lt;h2 id="constants"&gt;الثوابت (Constants)&lt;/h2&gt;
&lt;p&gt;الثوابت هي قيم ثابتة قد تكون أرقاماً أو أحرفاً أو سلاسل نصية. يطلق عليها ثوابت لأنها لا تتغير. وهي أنواع:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;الثوابت الرقمية هي الأرقام التي نعرفها جميعاً مثل 2 و 5 و 4.6. &lt;/li&gt;
&lt;li&gt;الثوابت النصية هي حرف أو أكثر ضمن إشارتي تنصيص مثل &amp;ldquo;خالد&amp;rdquo; و &amp;ldquo;المدينة&amp;rdquo;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;مثال:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Hello&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="variables"&gt;المتغيرات (Variables)&lt;/h2&gt;
&lt;p&gt;هي أماكن في الذاكرة نستخدمها لتخزين بيانات برامجنا واسترجاعها في وقت لاحق، وكل متغير يجب أن نختار له اسماً. وكما رأينا سابقاً فلا يمكن أن تستخدم الكلمات المحجوزة لتسمية المتغيرات. ويطلق عليها المتغيرات لأننا نستطيع تغيير القيم المخزنة داخلها.&lt;/p&gt;
&lt;p&gt;مثال:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;93.9&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;26&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول مثلاً نقول لبايثون أن تجد مكاناً خالياً في الذاكرة وأن تسميه &lt;code&gt;x&lt;/code&gt; وأن تضع فيه الرقم 93.9. في السطر الثاني نقوم بفعل مشابه لتخزين القيمة 26 في متغير اسمه &lt;code&gt;y&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;الآن إذا قمنا بتنفيذ الأمر التالي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;فإن ذلك يعني أننا سنشطب القيمة التي وضعناها مسبقاً في &lt;code&gt;x&lt;/code&gt; وهي 93.9 وسنضع مكانها الرقم 100.&lt;/p&gt;
&lt;h3 id="_1"&gt;تسمية المتغيرات&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;يجب أن يبدأ اسم المتغير بحرف أو شرطة سفلية (underscore) _.&lt;/li&gt;
&lt;li&gt;يمكن أن يحتوي اسم المتغير على أحرف وأرقام وشرطات سفلية&lt;/li&gt;
&lt;li&gt;اسم المتغير حساس لحالة الأحرف وهذا يعني أن اسم val مختلف عن Val وكليهما مختلفين عن VAL. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;أسماء متغيرات صالحة للاستخدام: abc، var12، _text.&lt;/p&gt;
&lt;p&gt;أسماء متغيرات غير صالحة للاستخدام: 12var، $result، vip.text.&lt;/p&gt;
&lt;p&gt;يُنصح أن تكون أسماء المتغيرات معبرة عما تحتويه لتسهيل قراءة الكود فيما بعد وللمساعدة على تذكر وظيفة كل متغير.&lt;/p&gt;
&lt;p&gt;مثلاً هذا البرنامج:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;g33er9on1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;
&lt;span class="n"&gt;g33er1on1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;50.2&lt;/span&gt;
&lt;span class="n"&gt;g33er5on1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;g33er9on1&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;g33er1on1&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g33er5on1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وهذا البرنامج:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;50.2&lt;/span&gt;
&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لهما نفس النتائج ولكن قراءة وفهم الثاني أسهل بكثير من الأول. ولكن هناك طريقة أفضل لكتابة هذا البرنامج:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;
&lt;span class="n"&gt;daily_rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;50.2&lt;/span&gt;
&lt;span class="n"&gt;pay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;daily_rate&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;هذا البرنامج أفضل لأنه يعطي لكل متغير اسماً يعبر عن القيمة المخزنة فيه. فالمتغير الأول days (أي الأيام) يخزن عدد الأيام التي قام شخص بالعمل فيها، والمتغير الثاني daily_rate يخزن الأجرة المفروضة لكل يوم عمل، أما المتغير الثالث pay فهو يخزن المبلغ الذي ينبغي دفعه للعامل وهو ناتج ضرب عدد الأيام التي عملها بأجرة كل يوم.&lt;/p&gt;
&lt;h2 id="_2"&gt;جمل الإسناد (أو جمل التعيين)&lt;/h2&gt;
&lt;p&gt;جمل الإسناد هي الجمل التي نضع فيها قيماً داخل المتغيرات وقد رأينا عدة جمل إسناد من قبل، وهذا مثال آخر على جملة إسناد:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;5.4&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;تذكر أن الطرف الأيمن من الجملة يتم تنفيذه أولاً بشكل كامل ثم توضع النتيجة في المتغير الموجود في الطرف الأيسر، ولذلك يمكننا استخدام نفس المتغير في الطرفين بدون مشاكل.&lt;/p&gt;
&lt;h2 id="_3"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/6-FoYqhidlE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الخامس: كتابة وتشغيل برامج بايثون بدون تثبيت شيء على الجهاز</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-5-arabic.html" rel="alternate"/><published>2020-03-31T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-03-31:/ar/2020/learn-programming-with-python-1-5-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الخامس: كتابة وتشغيل برامج بايثون بدون تثبيت شيء على جهازك" src="/assets/images/2020/pyc-5-1.png"&gt;&lt;/p&gt;
&lt;p&gt;رأينا في درس سابق كيفية تثبيت بايثون ومحرر نصوص برمجية على أجهزتنا لنتمكن من كتابة وتشغيل برامج بايثون. في هذا الدرس سنتعرف على طرق لكتابة وتشغيل برامج بايثون بدون تثبيت شيء على الجهاز. هذه الطرق يمكن أن تسهل الأمور في بداية رحلة تعلم بايثون، لكن في نهاية الأمر أعتقد أنه …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الخامس: كتابة وتشغيل برامج بايثون بدون تثبيت شيء على جهازك" src="/assets/images/2020/pyc-5-1.png"&gt;&lt;/p&gt;
&lt;p&gt;رأينا في درس سابق كيفية تثبيت بايثون ومحرر نصوص برمجية على أجهزتنا لنتمكن من كتابة وتشغيل برامج بايثون. في هذا الدرس سنتعرف على طرق لكتابة وتشغيل برامج بايثون بدون تثبيت شيء على الجهاز. هذه الطرق يمكن أن تسهل الأمور في بداية رحلة تعلم بايثون، لكن في نهاية الأمر أعتقد أنه لا بد من تثبيت بايثون ومحرر نصوص على الجهاز خاصة أنها عملية سهلة كما رأينا في درس سابق.&lt;/p&gt;
&lt;p&gt;سنتعرف في هذا الجزء على طريقتين لكتابة وتشغيل برامج بايثون في متصفح الانترنت: Repl.it و Google Colab.&lt;/p&gt;
&lt;h3 id="1-google-colab"&gt;1. Google Colab&lt;/h3&gt;
&lt;p&gt;هذه خدمة مجانية مقدمة من Google تمكنك من كتابة وتشغيل برامج بايثون في متصفح الانترنت مباشرة. عن طريق هذه الخدمة يمكنك كتابة كود بايثون وتشغيله ورؤية النتائج مباشرة ويمكنك أيضاً كتابة نص عادي في نفس الملف لشرح الكود مثلاً أو لتفسير النتائج. في Google Colab (غوغل كولاب): الكثير من حزم بايثون البرمجية المفيدة تأتي مثبتة بشكل مسبق فيمكنك استخدامها مباشرة ويمكنك تثبيت أي حزمة أخرى بسهولة (سنتعرف لاحقاً على الحزم البرمجية وكيفية استخدامها).&lt;/p&gt;
&lt;p&gt;&lt;img alt="واجهة Google Colab (غوغل كولاب)" src="/assets/images/2020/pyc-5-3.png"&gt;&lt;/p&gt;
&lt;p&gt;أيضاً تمكنك هذه الخدمة من حفظ ملفات برامجك في حسابك في Google Drive ويمكنك فتح ملفات برامجك المخزنة هناك بشكل مباشر. وزيادة على ذلك فإن غوغل كولاب يوفر لك وحدة معالجة رسوميات (GPU) لاستخدامها في برامجك بشكل مجاني (هناك برامج معينة تعمل بشكل أسرع كثيراً باستخدام وحدة معالجة الرسوميات).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://colab.research.google.com/"&gt;موقع غوغل كولاب (Google Colab)&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="2-replit"&gt;2. Repl.it&lt;/h3&gt;
&lt;p&gt;هذا الموقع يمكنك - مجاناً - من كتابة برامج بايثون وتشغيلها ويوفر خطة مجانية محدودة بعض الشيء لكنها كافية للمبتدئين.&lt;/p&gt;
&lt;p&gt;&lt;img alt="واجهة موقع Repl.it" src="/assets/images/2020/pyc-5-2.png"&gt;&lt;/p&gt;
&lt;p&gt;يمكن عن طريق هذا الموقع إنشاء ملفات بايثون وحفظها وتثبيت حزم برمجية. ويمكنك التسجيل في الموقع للاحتفاظ بملفاتك. الخطة المجانية تعطيك 100 ميغابايت لتخزين ملفاتك وهي كافية لكتابة العديد والعديد من البرامج.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://repl.it/"&gt;موقع Repl.it&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;تعرفنا في هذا المقال على طريقتين من أفضل الطرق لكتابة وتشغيل برامج بايثون على الانترنت. هناك العديد من الخدمات الأخرى المشابهة المتوفرة أيضاً. هذه الخدمات جعلت البرمجة ومشاركة البرامج التي تكتبها مع الآخرين أسهل مما سبق.&lt;/p&gt;
&lt;p&gt;يمكنك استخدام هذه الخدمات الآن لتجربة البرامج التي نكتبها في هذه الدورة ويمكنك تثبيت بايثون ومحرر نصوص على جهازك في أي وقت بسهولة باتباع التعليمات الموضحة في &lt;a href="https://www.youtube.com/watch?v=b9du7snWQj4"&gt;هذا المقطع من الدرس السابق&lt;/a&gt; (&lt;a href="https://www.youtube.com/watch?v=xzi5P-GcT20"&gt;أو هذا المقطع إن كنت تستخدم نظام ماك&lt;/a&gt;).&lt;/p&gt;
&lt;h2 id="_1"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/3cy-tZibpvk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الثالث: مدخل إلى برامج بايثون (1)</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-3-arabic.html" rel="alternate"/><published>2020-03-15T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-03-15:/ar/2020/learn-programming-with-python-1-3-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثالث: مدخل إلى برامج بايثون (1)" src="/assets/images/2020/pyc-3-6.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنأخذ لمحة عن برامج بايثون وعن نمط بايثون التفاعلي وأيضاً سنتعرف على الكلمات المحجوزة في بايثون.&lt;/p&gt;
&lt;p&gt;لندخل إلى نمط بايثون التفاعلي (عن طريق كتابة python في برنامج PowerShell في ويندوز أو كتابة python3 في برنامج Terminal في نظام ماك) ونكتب بعض أوامر بايثون:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x …&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثالث: مدخل إلى برامج بايثون (1)" src="/assets/images/2020/pyc-3-6.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنأخذ لمحة عن برامج بايثون وعن نمط بايثون التفاعلي وأيضاً سنتعرف على الكلمات المحجوزة في بايثون.&lt;/p&gt;
&lt;p&gt;لندخل إلى نمط بايثون التفاعلي (عن طريق كتابة python في برنامج PowerShell في ويندوز أو كتابة python3 في برنامج Terminal في نظام ماك) ونكتب بعض أوامر بايثون:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;في السطر الأول نرى أمر تخزين قيمة - وهي 1 - في متغير أو variable اسمه &lt;code&gt;x&lt;/code&gt;. المتغير ببساطة هو جزء من الذاكرة نقوم بتخزين ما نشاء فيه. فمثلاً في السطر الأول نقول لبايثون خذي جزءاً من الذاكرة وسمه &lt;code&gt;x&lt;/code&gt; وضعي 1 بداخله.&lt;/p&gt;
&lt;p&gt;في السطر الثاني نقول لبايثون أحضري القيمة المخزنة في &lt;code&gt;x&lt;/code&gt; واطبعيها على الشاشة، وبالطبع فإنها ستطبع 1 لأننا وضعنا 1 في &lt;code&gt;x&lt;/code&gt; في السطر السابق. في مثالنا هذا يبدو هذا الأمر بلا فائدة ولكن لاحقاً عندما نكتب برامج حقيقية سيكون هناك استخدامات مفيدة أكثر لهذه الأوامر.&lt;/p&gt;
&lt;p&gt;في السطر الثالث نقوم بأخذ القيمة الموجودة في &lt;code&gt;x&lt;/code&gt; ثم نضيف لها 1 ثم نخزنها مرة أخرى في &lt;code&gt;x&lt;/code&gt;. وعندما نطبع ما في داخل &lt;code&gt;x&lt;/code&gt; في السطر الرابع نرى أنه تم طباعة 2 بعد عملية الجمع التي قمنا بها في السطر الثالث.&lt;/p&gt;
&lt;p&gt;وفي السطر الأخير نخرج من نمط بايثون التفاعلي.&lt;/p&gt;
&lt;p&gt;لو قمت بكتابة أي من الأوامر السابقة بشكل خاطئ فإن بايثون ستنبهك بأنك قمت بخطأ في كتابتك للأوامر.&lt;/p&gt;
&lt;h2 id="_1"&gt;الكلمات المحجوزة في بايثون&lt;/h2&gt;
&lt;p&gt;لدينا في بايثون شيء يسمى الكلمات المحجوزة (reserved words). ما هي الكلمات المحجوزة؟ هي كلمات لها وظائف محددة في بايثون وعندما نستخدم هذه الكلمات في برامجنا يجب أن تعني الشيء الذي تتوقعه بايثون بالضبط، أي أنه لا يمكننا استخدام هذه الكلمات لأي غرض آخر: لا يمكن مثلاً أن تسمي متغيراً باسم كلمة محجوزة. هذه قائمة بالكلمات المحجوزة في بايثون:&lt;/p&gt;
&lt;p&gt;&lt;img alt="الكلمات المحجوزة في بايثون" src="/assets/images/2020/pyc-3-1.png"&gt;&lt;/p&gt;
&lt;h2 id="_2"&gt;متى نستخدم نمط بايثون التفاعلي؟&lt;/h2&gt;
&lt;p&gt;نمط بايثون التفاعلي (interactive mode) مفيد لتجربة أوامر بايثون بشكل سريع أو لتشغيل برامج صغيرة جداً تتكون من 3-4 سطور. معظم البرامج تكون أطول بكثير من ذلك ولذا فإننا نقوم بكتابتها في ملف باستخدام محرر النصوص ثم نطلب من بايثون أن تقوم بتشغيل الملف وتنفيذ الأوامر الموجودة فيه. هذا الملف الذي يحتوي على برنامج بايثون يطلق عليه سكريبت (script)، وسنضيف إلى اسم هذا الملف &amp;ldquo;.py&amp;rdquo; وهذا يعني أن هذا الملف يحتوي برنامج بايثون.&lt;/p&gt;
&lt;h2 id="_3"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/5nv5FSGopLU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;ملاحظة: ربما تقول في نفسك أن البرامج التي تراها حتى الآن ليس لها فائدة وهذا صحيح لأننا ما زلنا في البداية نتعلم الأساسيات والقواعد البدائية لكني أؤكد لك أنك عندما تتعلم بايثون بشكل جيد ستستطيع فعل العديد والعديد من الأمور الهامة والمفيدة التي تختصر عليك وقتاً وجهداً أو تجلب لك ربحاً مالياً أو تمكنك من تقديم فائدة للآخرين.&lt;/p&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الرابع: مدخل إلى برامج بايثون (2)</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-4-arabic.html" rel="alternate"/><published>2020-03-15T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-03-15:/ar/2020/learn-programming-with-python-1-4-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الرابع: مدخل إلى برامج بايثون (2)" src="/assets/images/2020/pyc-4-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على الطرق التي يمكن أن يسير بها برنامج بايثون وسنرى أمثلة على كل طريقة.&lt;/p&gt;
&lt;h2 id="_1"&gt;كيفية سير برنامج بايثون&lt;/h2&gt;
&lt;p&gt;هناك عدة أنماط لسير برنامج بايثون:&lt;/p&gt;
&lt;h3 id="_2"&gt;النمط التسلسلي&lt;/h3&gt;
&lt;p&gt;في هذا النمط يكون البرنامج عبارة عن سلسلة من الخطوات التي يجب تنفيذها بالترتيب.&lt;/p&gt;
&lt;p&gt;&lt;img alt="مثال عن نمط سير البرنامج التسلسلي" src="/assets/images/2020/pyc-4-2.png"&gt;&lt;/p&gt;
&lt;h3 id="_3"&gt;النمط الشرطي&lt;/h3&gt;
&lt;p&gt;في هذا النمط يقوم …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الرابع: مدخل إلى برامج بايثون (2)" src="/assets/images/2020/pyc-4-1.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنتعرف على الطرق التي يمكن أن يسير بها برنامج بايثون وسنرى أمثلة على كل طريقة.&lt;/p&gt;
&lt;h2 id="_1"&gt;كيفية سير برنامج بايثون&lt;/h2&gt;
&lt;p&gt;هناك عدة أنماط لسير برنامج بايثون:&lt;/p&gt;
&lt;h3 id="_2"&gt;النمط التسلسلي&lt;/h3&gt;
&lt;p&gt;في هذا النمط يكون البرنامج عبارة عن سلسلة من الخطوات التي يجب تنفيذها بالترتيب.&lt;/p&gt;
&lt;p&gt;&lt;img alt="مثال عن نمط سير البرنامج التسلسلي" src="/assets/images/2020/pyc-4-2.png"&gt;&lt;/p&gt;
&lt;h3 id="_3"&gt;النمط الشرطي&lt;/h3&gt;
&lt;p&gt;في هذا النمط يقوم البرنامج بتنفيذ بعض الخطوات فقط في حال تحقق شرط ما.&lt;/p&gt;
&lt;p&gt;&lt;img alt="مثال عن نمط سير البرنامج الشرطي" src="/assets/images/2020/pyc-4-3.png"&gt;&lt;/p&gt;
&lt;p&gt;الكلمة التي تمكننا من وضع الشروط هي &lt;code&gt;if&lt;/code&gt; وهي إحدى الكلمات المحجوزة في بايثون. &lt;code&gt;if&lt;/code&gt; دائماً ما تكون متبوعة بشرط. مثلاً في المثال في الصورة أعلاه الشرط الأول هو &lt;code&gt;x &amp;lt; 10&lt;/code&gt;. فإذا تحقق الشرط وكانت قيمة &lt;code&gt;x&lt;/code&gt; أقل من 10 يقوم البرنامج بتنفيذ الجملة الشرطية:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Smaller&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;وإذا لم يتحقق الشرط فإن البرنامج يتجاوز الجملة الشرطية ولا يقوم بتنفيذها. في المثال: قيمة &lt;code&gt;x&lt;/code&gt; عند التحقق من الشرط هي 5 وهي أقل من 10 لذلك سينفذ البرنامج الجملة الشرطية.&lt;/p&gt;
&lt;p&gt;بالنسبة للشرط الثاني: &lt;code&gt;x &amp;lt; 20&lt;/code&gt; فإن هذا الشرط غير متحقق في مثالنا بما أن قيمة &lt;code&gt;x&lt;/code&gt; هي 5 ولذلك فالبرنامج لن ينفذ الجملة الشرطية المرتبطة بهذا الشرط وهي:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Bigger&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لاحظ كيف أن الجملتان الشرطيتان منزاحتان قليلاً إلى اليمين. هذا الانزياح يدل على أن الجملة الشرطية تابعة لجملة &lt;code&gt;if&lt;/code&gt; التي فوقها.&lt;/p&gt;
&lt;p&gt;بالنسبة للأمر الأخير:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Finish&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;فسيتم تنفيذه دائماً مهما كانت قيمة &lt;code&gt;x&lt;/code&gt; لأنه غير متعلق بأي شرط.&lt;/p&gt;
&lt;h3 id="_4"&gt;النمط التكراري&lt;/h3&gt;
&lt;p&gt;في هذا النمط يقوم البرنامج بتكرير تنفيذ مجموعة من الخطوات.&lt;/p&gt;
&lt;p&gt;&lt;img alt="مثال عن نمط سير البرنامج التكراري" src="/assets/images/2020/pyc-4-4.png"&gt;&lt;/p&gt;
&lt;p&gt;في المثال أعلاه: الكلمة التي مكنتنا من إنشاء حلقة تكرارية (loop) هي &lt;code&gt;while&lt;/code&gt; وهي أيضاً من الكلمات المحجوزة في بايثون. ودائماً ما تكون &lt;code&gt;while&lt;/code&gt; متبوعة بشرط. وطالما بقي هذا الشرط متحققاً سيستمر البرنامج في تكرار تنفيذ الأوامر داخل الحلقة.&lt;/p&gt;
&lt;p&gt;ففي المثال أعلاه: سيتم تخزين 5 في المتغير &lt;code&gt;n&lt;/code&gt; ثم نأتي إلى جملة &lt;code&gt;while&lt;/code&gt; وهنا يتم طرح سؤال: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ إذا كان الجواب &amp;ldquo;نعم، صحيح&amp;rdquo; فسيتم تنفيذ الأوامر داخل الحلقة (وهي الأوامر المنزاحة إلى اليمين قليلاً) ثم سيتم طرح السؤال مرة أخرى وسيتكرر تنفيذ ما بداخل الحلقة حتى يصبح جواب السؤال &amp;ldquo;لا، خطأ&amp;rdquo;، عندها سيتجاوز البرنامج الأوامر داخل الحلقة وينتقل لتنفيذ الأوامر التي ما بعد الحلقة.&lt;/p&gt;
&lt;p&gt;إذا تتبعنا كيفية سير عمل المثال في الصورة أعلاه: سنرى أنه عند طرح سؤال &lt;code&gt;while&lt;/code&gt; فإن الإجابة ستكون &amp;ldquo;صحيح&amp;rdquo; لأن &lt;code&gt;n&lt;/code&gt; والتي قيمتها 5 أكبر من 0، ولذلك سيتم تنفيذ التعليمتين داخل الحلقة وهي طباعة قيمة &lt;code&gt;n&lt;/code&gt; ثم طرح 1 من &lt;code&gt;n&lt;/code&gt; لتصبح 4. بعدها سيتم طرح سؤال &lt;code&gt;while&lt;/code&gt; مرة أخرى: هل &lt;code&gt;n&lt;/code&gt; أكبر من 0؟ وأيضاً بما أن &lt;code&gt;n&lt;/code&gt; قيمتها 4 فسيكون الجواب &amp;ldquo;صحيح&amp;rdquo; وسيتم تنفيذ تعليمات الحلقة وتصبح قيمة &lt;code&gt;n&lt;/code&gt; الجديدة 3. وسيتم تكرار ذلك حتى تصبح &lt;code&gt;n&lt;/code&gt; مساوية لـ 0. عندها عندما يتم طرح سؤال الحلقة سيكون الجواب &amp;ldquo;خطأ&amp;rdquo; وسيخرج البرنامج من الحلقة وينفذ التعليمة التي بعدها وهي طباعة &amp;ldquo;Finished&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;لاحظ أن التعليمات التابعة لحلقة &lt;code&gt;while&lt;/code&gt; منزاحة إلى اليمين قليلاً ولاحظ أيضاً النقطتان الرأسيتان بعد جملة &lt;code&gt;while&lt;/code&gt;. هذه كلها من قواعد كتابة بايثون التي عليك مراعاتها وإلا فإن بايثون ستخبرك بوجود خطأ في برنامجك.&lt;/p&gt;
&lt;p&gt;لاحظ أيضاً أنه تم كتابة البرنامج في المثال أعلاه بحيث يتم تنفيذ التعليمات داخل الحلقة 5 مرات. &lt;/p&gt;
&lt;h3 id="_5"&gt;النمط الوظيفي&lt;/h3&gt;
&lt;p&gt;في هذا النمط يقوم البرنامج باستخدام الدوالّ (أو التوابع). الدالّة هي مجموعة من الأوامر تنفذ مهمة معينة ويتم استدعاؤها عند الحاجة إليها. سنعرف المزيد عن هذا النمط لاحقاً إن شاء الله.&lt;/p&gt;
&lt;p&gt;الآن إذا نظرنا مرة أخرى إلى البرنامج الذي عرضناه سابقاً والذي يقوم بإيجاد أكثر كلمة تكراراً في ملف نصي وعدد مرات تكرارها:&lt;/p&gt;
&lt;p&gt;&lt;img alt="برنامج بايثون لإيجاد أكثر كلمة تكرراً في نص" src="/assets/images/2020/pyc-4-5.png"&gt;&lt;/p&gt;
&lt;p&gt;سنرى أنه يحتوي على كود تسلسلي مثل أول ثلاث تعليمات ويحتوي على كود تكراري مثل التعليمات التي تبدأ في سطر رقم 5 وتنتهي في سطر رقم 8. هذه السطور تحتوي على حلقتي &lt;code&gt;for&lt;/code&gt; و &lt;code&gt;for&lt;/code&gt; هي كلمة محجوزة تمكننا من إنشاء حلقات تكرارية شبيهة بـ &lt;code&gt;while&lt;/code&gt;. ونرى أيضاً أن هذا البرنامج يحتوي على كود شرطي مثل التعليمات التي تبدأ في سطر 13. سنعود لاحقاً لهذا البرنامج لنرى كيفية كتابته خطوة بخطوة بعد أن نتعلم الأساسيات اللازمة.&lt;/p&gt;
&lt;p&gt;في الدروس القادمة سنتعلم بالتفصيل عن المتغيرات والجمل الشرطية والحلقات وغيرها. في هذا الدرس قمنا فقط بإلقاء نظرة إجمالية لتمكننا من ربط الأشياء ببعضها لاحقاً. فلا تقلق إن كانت بعض المفاهيم مشوشة لديك أو كانت هناك أجزاء غير واضحة بعد.&lt;/p&gt;
&lt;h2 id="_6"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/EybWCCT9Rx0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;ملاحظة: ربما تقول في نفسك أن البرامج التي تراها حتى الآن ليس لها فائدة وهذا صحيح لأننا ما زلنا في البداية نتعلم الأساسيات والقواعد البدائية لكني أؤكد لك أنك عندما تتعلم بايثون بشكل جيد ستستطيع فعل العديد والعديد من الأمور الهامة والمفيدة التي تختصر عليك وقتاً وجهداً أو تجلب لك ربحاً مالياً أو تمكنك من تقديم فائدة للآخرين.&lt;/p&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الثاني: تثبيت بايثون ومحرر نصوص وكتابة أول برنامج</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-2-arabic.html" rel="alternate"/><published>2020-03-08T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-03-08:/ar/2020/learn-programming-with-python-1-2-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثاني: تثبيت بايثون ومحرر نصوص برمجية وكتابة أول برنامج" src="/assets/images/2020/pyc-2-2.png"&gt;&lt;/p&gt;
&lt;p&gt;لكي نستطيع كتابة وتشغيل برامج بايثون (Python) على أجهزتنا علينا تثبيت بايثون ومحرر نصوص برمجية. نحتاج إلى تثبيت بايثون كي نتمكن من تشغيل البرامج المكتوبة بلغة بايثون، ونحتاج محرر نصوص لنكتب البرامج فيه. &lt;/p&gt;
&lt;p&gt;بشكل عام هناك نسختان من بايثون: بايثون 2 وبايثون 3. بايثون 2 هي نسخة قديمة وتوقف دعمها …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="تعلم البرمجة بلغة بايثون - الدرس الثاني: تثبيت بايثون ومحرر نصوص برمجية وكتابة أول برنامج" src="/assets/images/2020/pyc-2-2.png"&gt;&lt;/p&gt;
&lt;p&gt;لكي نستطيع كتابة وتشغيل برامج بايثون (Python) على أجهزتنا علينا تثبيت بايثون ومحرر نصوص برمجية. نحتاج إلى تثبيت بايثون كي نتمكن من تشغيل البرامج المكتوبة بلغة بايثون، ونحتاج محرر نصوص لنكتب البرامج فيه. &lt;/p&gt;
&lt;p&gt;بشكل عام هناك نسختان من بايثون: بايثون 2 وبايثون 3. بايثون 2 هي نسخة قديمة وتوقف دعمها في بداية عام 2020. لذلك نسخة بايثون التي سنقوم بتثبيتها هي &lt;strong&gt;بايثون 3&lt;/strong&gt;. هناك نسخ فرعية من بايثون 3؛ النسخة الحالية هي 3.8.2، ولكن أي نسخة من بايثون 3 ستعمل بدون مشاكل.&lt;/p&gt;
&lt;p&gt;مُحَرِّر النصوص هو برنامج شبيه بالمفكرة أو برنامج وورد (Word) ولكنه مخصص لكتابة نصوص البرامج أو ما سنطلق عليه من الآن وصاعداً &amp;ldquo;&lt;strong&gt;الكود&lt;/strong&gt;&amp;rdquo;. مثلاً الصورة المتحركة أدناه تعرض محرر نصوص اسمه Visual Studio Code وهو المحرر الذي سنستخدمه في هذه الدورة.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;تعريف &amp;ldquo;كود&amp;rdquo;: نص برمجي&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img alt="مثال على كود برنامج بايثون" src="/assets/images/2020/pyc-2-1.gif"&gt;&lt;/p&gt;
&lt;p&gt;هناك العديد من من محررات النصوص المتوفرة لتثبيتها ولكن سنختار &lt;a href="https://code.visualstudio.com/"&gt;Visual Studio Code&lt;/a&gt; أو اختصاراً VS Code لأنه محرر متميز متوفر على جميع أنظمة التشغيل ومجاني تماماً وفيه العديد من الميزات المهمة التي تساعدنا عند كتابة البرامج. طبعاً يمكن استخدام VS Code لكتابة برامج بأي لغة برمجة وليس فقط برامج بلغة بايثون.&lt;/p&gt;
&lt;p&gt;سنتطرق في هذه التدوينة إلى:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;كيفية تثبيت بايثون و VS Code وكتابة برنامج بايثون على نظام ويندوز&lt;/li&gt;
&lt;li&gt;كيفية تثبيت بايثون و VS Code وكتابة برنامج بايثون على نظام ماك&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="vs-code"&gt;كيفية تثبيت بايثون و VS Code على نظام ويندوز&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;سوف أذكر الخطوات هنا باختصار. &lt;strong&gt;لمشاهدة كيفية التثبيت خطوة بخطوة&lt;/strong&gt; &lt;a href=""&gt;شاهد فيديو الدرس&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;قم بتحميل بايثون من &lt;a href="https://www.python.org/downloads/"&gt;موقع بايثون الرسمي&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;قم بتثبيت الملف الذي قمت بتحميله وخلال التثبيت تأكد من اختيار أن يتم إضافة بايثون إلى ال PATH كما هو موضح في الصورة أدناه. وإذا عرض عليك بعد ذلك أن يتم تغيير الطول الأقصى لل PATH فقم بذلك. الآن أصبحت بايثون مثبتة على جهازك.&lt;/li&gt;
&lt;li&gt;قم بتحميل VS Code من &lt;a href="https://code.visualstudio.com/"&gt;موقعه الرسمي&lt;/a&gt; ثم قم بتثبيته كأي برنامج آخر.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;الآن بعد أن قمت بتثبيت بايثون ومحرر النصوص شغل برنامج PowerShell وهو برنامج يأتي مع نظام ويندوز. قم بتشغيله عن طريق كتابة اسمه في قائمة ابدأ. واجهة البرنامج تشبه الصورة في الأسفل.&lt;/p&gt;
&lt;p&gt;&lt;img alt="برنامج PowerShell أو باورشل" src="/assets/images/2020/pyc-2-3.png"&gt;&lt;/p&gt;
&lt;p&gt;برنامج PowerShell هو برنامج مهم يمكننا من كتابة أوامر لينفذها نظام التشغيل ويسمى واجهة سطر الأوامر أو Command-Line Interface.&lt;/p&gt;
&lt;p&gt;ضمن PowerShell اكتب &lt;code&gt;python&lt;/code&gt; واضغط Enter للدخول إلى برنامج بايثون التفاعلي وهو يمكنك من كتابة أوامر بلغة بايثون ورؤية النتائج مباشرة. يمكن استخدام هذا البرنامج التفاعلي لتجربة أوامر بسرعة فهو غير مناسب لكتابة برامج طويلة. في برنامج بايثون التفاعلي اكتب:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;ثم اضغط Enter. هذا الأمر هو أمر طباعة وسيطبع كلمة &amp;ldquo;Hello&amp;rdquo;. للخروج من نمط بايثون التفاعلي اكتب &lt;code&gt;exit()&lt;/code&gt; واضغط Enter أو اضغط &lt;code&gt;Ctrl + Z&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;عندما نريد أن نكتب برامج حقيقية فإننا سنكتبها في محرر النصوص الذي قمنا بتثبيه. افتح برنامج محرر النصوص Visual Studio Code ثم اكتب بداخله نفس أمر الطباعة الموجود في الأعلى واحفظ الملف على جهازك (يجب أن تكون صيغة الملف &lt;code&gt;.py&lt;/code&gt; وهي صيغة ملفات بايثون). بعد ذلك اذهب إلى PowerShell وتأكد أنك خرجت من نمط بايثون التفاعلي كما ذكرنا في الأعلى ثم اكتب:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لكن استبدل &lt;code&gt;path/to/file&lt;/code&gt; بمكان وجود الملف الذي حفظته من محرر النصوص ثم اضغط Enter وسيتم تشغيل البرنامج الذي كتبته في محرر النصوص وسيتم طباعة &amp;ldquo;Hello&amp;rdquo;. &lt;/p&gt;
&lt;p&gt;هكذا تكون قد كتبت وشغلت أول برنامج بايثون لك. كما ذكرت سابقاً: &lt;strong&gt;لرؤية التفاصيل خطوة بخطوة قم بمشاهدة فيديو الدرس&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id="vs-code_1"&gt;كيفية تثبيت بايثون و VS Code على نظام ماك&lt;/h2&gt;
&lt;p&gt;أنظمة ماك تأتي وبايثون مثبتة مسبقاً عليها لكن النسخة المثبتة تكون بايثون 2 وهذه النسخة من بايثون قديمة وتوقف دعمها كما هو مذكور أعلاه لكن ما زالت تأتي مع أجهزة الماك. لذلك سنحتاج لأن نثبت بايثون 3 إلى جانب بايثون 2. ولا نريد أن نحذف نسخة بايثون 2 الموجودة على الجهاز لأن هناك برامج في النظام قد تعتمد عليها.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;سوف أذكر الخطوات هنا باختصار. &lt;strong&gt;لمشاهدة كيفية التثبيت خطوة بخطوة&lt;/strong&gt; &lt;a href=""&gt;شاهد فيديو الدرس&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;قم بتحميل بايثون من &lt;a href="https://www.python.org/downloads/"&gt;موقع بايثون الرسمي&lt;/a&gt; وقم بتثبيت بايثون كأي برنامج آخر.&lt;/li&gt;
&lt;li&gt;قم بتحميل VS Code من &lt;a href="https://code.visualstudio.com/"&gt;موقعه الرسمي&lt;/a&gt; ثم قم بتثبيته كأي برنامج آخر.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;ملاحظة هامة:&lt;/strong&gt; لأننا الآن لدينا بايثون 2 وبايثون 3 سوية: عندما نريد تشغيل بايثون 3 سنكتب &lt;code&gt;python3&lt;/code&gt; وليس فقط &lt;code&gt;python&lt;/code&gt;. سنوضح هذا الأمر لاحقاً لكن فقط أحببت التنبيه الآن احتياطاً.&lt;/p&gt;
&lt;p&gt;الآن بعد أن قمت بتثبيت بايثون ومحرر النصوص شغل برنامج Terminal وهو برنامج يأتي مع نظام ماك. ستجده في مجلد Utilities الموجود في مجلد Applications. واجهة البرنامج تشبه الصورة في الأسفل.&lt;/p&gt;
&lt;p&gt;&lt;img alt="برنامج Terminal" src="/assets/images/2020/pyc-2-4.png"&gt;&lt;/p&gt;
&lt;p&gt;برنامج Terminal هو برنامج مهم يمكننا من كتابة أوامر لينفذها نظام التشغيل ويسمى واجهة سطر الأوامر أو Command-Line Interface.&lt;/p&gt;
&lt;p&gt;ضمن Terminal اكتب &lt;code&gt;python3&lt;/code&gt; (انتبه أنها &lt;code&gt;python3&lt;/code&gt; وليس &lt;code&gt;python&lt;/code&gt;) واضغط Enter للدخول إلى برنامج بايثون التفاعلي وهو يمكنك من كتابة أوامر بلغة بايثون ورؤية النتائج مباشرة. يمكن استخدام هذا البرنامج التفاعلي لتجربة أوامر بسرعة فهو غير مناسب لكتابة برامج طويلة. في برنامج بايثون التفاعلي اكتب:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;ثم اضغط Enter. هذا الأمر هو أمر طباعة وسيطبع كلمة &amp;ldquo;Hello&amp;rdquo;. للخروج من نمط بايثون التفاعلي اكتب &lt;code&gt;exit()&lt;/code&gt; واضغط Enter أو اضغط &lt;code&gt;Ctrl + Z&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;عندما نريد أن نكتب برامج حقيقية فإننا سنكتبها في محرر النصوص الذي قمنا بتثبيه. افتح برنامج محرر النصوص Visual Studio Code ثم اكتب بداخله نفس أمر الطباعة الموجود في الأعلى واحفظ الملف على جهازك (يجب أن تكون صيغة الملف &lt;code&gt;.py&lt;/code&gt; وهي صيغة ملفات بايثون). بعد ذلك اذهب إلى Terminal وتأكد أنك خرجت من نمط بايثون التفاعلي كما ذكرنا في الأعلى ثم اكتب:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;python3&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;لكن استبدل &lt;code&gt;path/to/file&lt;/code&gt; بمكان وجود الملف الذي حفظته من محرر النصوص ثم اضغط Enter وسيتم تشغيل البرنامج الذي كتبته في محرر النصوص وسيتم طباعة &amp;ldquo;Hello&amp;rdquo;. &lt;/p&gt;
&lt;p&gt;هكذا تكون قد كتبت وشغلت أول برنامج بايثون لك. كما ذكرت سابقاً: &lt;strong&gt;لرؤية التفاصيل خطوة بخطوة قم بمشاهدة فيديو الدرس&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id="_1"&gt;الفروق بين ويندوز وماك&lt;/h2&gt;
&lt;p&gt;هناك - كما رأينا - بعض الفروق البسيطة بين ويندوز وماك أهمها:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;في ويندوز نستخدم PowerShell كواجهة سطر الأوامر بينما في ماك نستخدم Terminal.&lt;/li&gt;
&lt;li&gt;في ويندوز عندما نريد الدخول إلى بايثون في واجهة سطر الأوامر (PowerShell)  أو عندما نريد تشغيل برنامج بايثون موجود في جهازنا فإننا نكتب &lt;code&gt;python&lt;/code&gt; بينما في نظام ماك نكتب &lt;code&gt;python3&lt;/code&gt;. وذكرنا أسباب ذلك في الأعلى.
  &lt;span style="font-weight:bold; background-color:lightyellow;"&gt;لذلك عندما أشرح الدروس القادمة اكتب بناء على نظامك:&lt;/span&gt; إذا كنت تستخدم ويندوز اكتب &lt;code&gt;python&lt;/code&gt; في PowerShell وإن كنت تستخدم ماك اكتب &lt;code&gt;python3&lt;/code&gt; في Terminal كما هو موضح أعلاه.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="_2"&gt;كيفية كتابة وتشغيل برامج بايثون بدون تثبيت شيء على جهازك&lt;/h2&gt;
&lt;p&gt;على الرغم من أنه يفضل تثبيت بايثون ومحرر نصوص على جهازك لكن يمكنك كتابة وتشغيل برامج بايثون بدون فعل ذلك حيث تتوفر عدة خدمات تمكنك من كتابة وتشغيل برامج بايثون عن طريق متصفح الإنترنت. &lt;strong&gt;هذه الخدمات لا تغني عن تثبيت بايثون ومحرر نصوص على جهازك&lt;/strong&gt; لكن يمكنك استخدامها في الدروس القليلة القادمة لأنها دروس بسيطة أو عند الحاجة لكن بعدها عليك تثبيت بايثون ومحرر نصوص على جهازك. بعض هذه الخدمات:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://colab.research.google.com/"&gt;Google Colab&lt;/a&gt;: هذه خدمة رائعة مقدمة من Google تمكنك من كتابة وتشغيل كود بايثون في متصفح الإنترنت وتمكنك من استخدام ملفاتك المخزنة على حسابك في Google Drive ومن حفظ الملفات التي تنشئها هناك أيضاً. هناك العديد من الأشياء التي يمكن تعلمها عن هذه الخدمة لذلك سأتكلم عنها في درس منفصل.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://repl.it/"&gt;Repl.it&lt;/a&gt;: هذا الموقع يمكنك من كتابة وتشغيل كود بايثون في المتصفح ويمكنك أيضاً رفع ملفات من جهازك لاستخدامها في برامجك. النسخة المجانية منه محدودة لكن كافية لبرامج صغيرة.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;ـ&lt;/p&gt;
&lt;h2 id="_3"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/b9du7snWQj4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>تعلم البرمجة بلغة بايثون - الدرس الأول: مقدمة</title><link href="https://ammar-alyousfi.com/ar/2020/learn-programming-with-python-1-1-arabic.html" rel="alternate"/><published>2020-03-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-03-01:/ar/2020/learn-programming-with-python-1-1-arabic.html</id><summary type="html">&lt;p&gt;&lt;img alt="دورة تعلم البرمجة بلغة بايثون. القسم الأول، الدرس الأول" src="/assets/images/2020/pyc-1-6.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذه الدورة &lt;strong&gt;ستتعلم البرمجة بلغة بايثون (Python) من الصفر&lt;/strong&gt;. هذه الدورة لا تفترض أن لديك خبرة سابقة في البرمجة ، فيمكنك دخول هذه الدورة حتى لو كنت لا تعرف شيئاً عن البرمجة من قبل.&lt;/p&gt;
&lt;p&gt;الدورة ستكون مقسمة إلى عدة أقسام ، وكل قسم يحتوي على عدد من الدروس. &lt;/p&gt;
&lt;p&gt;سيتم طرح دروس …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="دورة تعلم البرمجة بلغة بايثون. القسم الأول، الدرس الأول" src="/assets/images/2020/pyc-1-6.png"&gt;&lt;/p&gt;
&lt;p&gt;في هذه الدورة &lt;strong&gt;ستتعلم البرمجة بلغة بايثون (Python) من الصفر&lt;/strong&gt;. هذه الدورة لا تفترض أن لديك خبرة سابقة في البرمجة ، فيمكنك دخول هذه الدورة حتى لو كنت لا تعرف شيئاً عن البرمجة من قبل.&lt;/p&gt;
&lt;p&gt;الدورة ستكون مقسمة إلى عدة أقسام ، وكل قسم يحتوي على عدد من الدروس. &lt;/p&gt;
&lt;p&gt;سيتم طرح دروس هذه الدورة عن طريق تدوينات مثل هذه وعن طريق فيديوهات على موقع يوتيوب (YouTube). فيمكنك اختيار الأفضل بالنسبة لك.&lt;/p&gt;
&lt;p&gt;ما يميز هذه الدورة أنها مبنية على مصادر من &lt;strong&gt;أفضل المصادر&lt;/strong&gt; العالمية الموجودة لتعلم بايثون خاصة دورات &lt;a href="https://www.coursera.org/specializations/python"&gt;Python for Everybody&lt;/a&gt; المقدمة من جامعة ميشيغان الأمريكية. وخلال هذه الدورة سنكتب برامج مفيدة وعملية يمكنك استخدامها في حياتك اليومية.&lt;/p&gt;
&lt;p&gt;في هذا الدرس سنناقش الهدف من تعلم البرمجة ، وسنعرف ما هو البرنامج ، وسنرى مثالاً على برنامج بلغة بايثون ، ثم سنتعرف على الأسباب التي تجعلنا نختار بايثون كلغة برمجة لتعلمها ، ثم سنأخذ لمحة سريعة عن مكونات الحاسب وكيفية عمله ، وفي النهاية سأعرفكم عن نفسي ومؤهلاتي لإعداد هذه الدورة.&lt;/p&gt;
&lt;h2 id="_1"&gt;لماذا نتعلم البرمجة؟&lt;/h2&gt;
&lt;p&gt;قبل أن تبدأ بتعلم البرمجة لا بد أن تسأل نفسك هذا السؤال: لماذا أريد تعلم البرمجة؟. ولتجيب عن هذا السؤال عليك أن تعلم أننا نعيش اليوم في عالم مليء بالتكنولوجيا والأجهرة الإلكترونية: حاسبات ، هواتف محمولة ، أجهزة ذكية ، إلخ. البرمجة تحولك من مجرد مستهلك للتكنولوجيا إلى صانع لها.&lt;/p&gt;
&lt;p&gt;&lt;img alt="من فوائد البرمجة" src="/assets/images/2020/pyc-1-1.png"&gt;&lt;/p&gt;
&lt;p&gt;الحاسب (أو الكمبيوتر) هو جهاز صنع لهدف واحد وهو أن ينفذ ما تأمره به. كيف يمكن أن تعطي الأوامر (أو التعليمات) للحاسب؟ عن طريق برامج مثل برامج بايثون. كيف تصنع هذه البرامج؟ عن طريق تعلم البرمجة. عن طريق البرمجة يمكنك صنع برامج مفيدة لك تستخدمها في حياتك أو برامج يمكن للآخرين أيضاً الاستفادة منها.&lt;/p&gt;
&lt;h2 id="_2"&gt;ما هو البرنامج؟&lt;/h2&gt;
&lt;p&gt;البرنامج ببساطة هو سلسلة من التعليمات للكمبيوتر مكتوبة بإحدى لغات البرمجة.&lt;/p&gt;
&lt;p&gt;لتقريب الفكرة دعنا نعطي مثالاً من حياتنا عن برنامج للإنسان وهي وصفات الطعام. فمثلاً ستجد تعليمات مكتوبة لك في طريقة التحضير: قطع البطاطا ، ضع المكونات في وعاء ، اخلط المزيج جيداً ، ضعه في الفرن حتى يصبح لونه ذهبياً ، وهكذا. برنامج الكمبيوتر يشبه ذلك ولكنه بدل أن يكون مكتوباً بلغة بشرية كالعربية سيكون مكتوباً بلغة برمجية مثل بايثون أو جافا ، وبدلاً من أن ينفذه الإنسان سيقوم الكمبيوتر بتنفيذه.&lt;/p&gt;
&lt;h2 id="_3"&gt;مثال عن برنامج بلغة بايثون&lt;/h2&gt;
&lt;p&gt;كيف يبدو البرنامج المكتوب بلغة بايثون؟ في الصورة أدناه ترى برنامجاً بسيطاً بلغة بايثون. &lt;/p&gt;
&lt;p&gt;&lt;img alt="برنامج بايثون لإيجاد أكثر الكلمات تكراراً" src="/assets/images/2020/pyc-1-2.png"&gt;&lt;/p&gt;
&lt;p&gt;هذا البرنامج يقوم بإيجاد أكثر كلمة تكررت في ملف نصي ويطبعها للمستخدم. تخيل مثلاً أن أعطيك كتاباً من 300 صفحة وأطلب منك أن تجد أكثر كلمة تكرراً في الكتاب وعدد مرات تكرارها. يمكنك بالطبع أداء هذه المهمة لكنها ستستهلك منك وقتاً طويلاً جداً وجهداً وتركيزاً كبيرين. لكن باستخدام هذا البرنامج الصغير يمكننا إيجاد المطلوب خلال أقل من ثانية (في الحقيقة يمكن لهذا البرنامج أن يبحث في أكثر من ألف صفحة خلال أقل من ربع ثانية!).&lt;/p&gt;
&lt;h2 id="_4"&gt;لماذا بايثون؟&lt;/h2&gt;
&lt;p&gt;بايثون هي لغة برمجة تم اختراعها قبل حوالي 30 سنة (عام 1991) من قبل مبرمج هولندي اسمه جايدو ڤان روسم. يشارك اليوم المئات من أكفأ المبرمجين حول العالم في تطوير بايثون وتحسينها.&lt;/p&gt;
&lt;p&gt;بايثون هي لغة برمجة &lt;strong&gt;متعددة الأغراض&lt;/strong&gt; أي أنها تستخدم في الكثير من المجالات مثل برمجة تطبيقات الإنترنت وبرامج الحاسب والبرامج العلمية وعلم البيانات (data science) وتحليل البيانات (data analysis) وتصوير البيانات (data visualization) والذكاء الاصطناعي والشبكات وغيرها.&lt;/p&gt;
&lt;h3 id="_5"&gt;بايثون سهلة التعلم للمبتدئين&lt;/h3&gt;
&lt;p&gt;من مميزات لغة بايثون أنها &lt;strong&gt;لغة برمجة سهلة التعلم&lt;/strong&gt; وفي نفس الوقت &lt;strong&gt;قوية جداً&lt;/strong&gt; وتستخدم في أكبر الشركات في العالم. ولهذا السبب تجد أن العديد من جامعات العالم صارت تدرس لغة بايثون لطلابها في سنواتهم الأولى. بالنسبة لي فقد تعلمت العديد من لغات البرمجة مثل C و C++ و Java و غيرها ووجدت فعلاً أن بايثون هي الأسهل بلا منازع. &lt;/p&gt;
&lt;h3 id="_6"&gt;بايثون أشهر لغة برمجة&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites"&gt;يتم استخدام بايثون اليوم من قبل أقوى الشركات&lt;/a&gt; على مستوى العالم مثل Google و Facebooks وغيرها. الرسم البياني في الأسفل يوضح مدى شهرة بايثون في Google مقارنة بغيرها من لغات البرمجة القوية مثل جافا وسي شارب وبي إتش بي في آخر خمس سنين. لاحظ كيف أن بايثون (ممثلة باللون الأزرق) ازدادت شهرة مع الأيام حتى أصبحت اليوم تتفوق على جميع هذه اللغات.&lt;/p&gt;
&lt;script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/2051_RC11/embed_loader.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt; trends.embed.renderExploreWidget("TIMESERIES", {"comparisonItem":[{"keyword":"/m/05z1_","geo":"US","time":"2015-02-28 2020-02-28"},{"keyword":"/m/07sbkfb","geo":"US","time":"2015-02-28 2020-02-28"},{"keyword":"/m/07657k","geo":"US","time":"2015-02-28 2020-02-28"},{"keyword":"/m/060kv","geo":"US","time":"2015-02-28 2020-02-28"}],"category":0,"property":""}, {"exploreQuery":"date=today%205-y&amp;geo=US&amp;q=%2Fm%2F05z1_,%2Fm%2F07sbkfb,%2Fm%2F07657k,%2Fm%2F060kv","guestPath":"https://trends.google.com:443/trends/embed/"}); &lt;/script&gt;

&lt;p&gt;أيضاً يمكنك النظر إلى الرسم أدناه لترى مدى شهرة بايثون على الموقع البرمجي الشهير &lt;a href="https://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt; مقارنة بالعديد من لغات البرمجة الأخرى. شاهد كيف أن بايثون (الخط الأحمر العريض في الرسم) أصبحت اليوم هي اللغة الأكثر تفاعلاً على الموقع.&lt;/p&gt;
&lt;p&gt;&lt;img alt="مدى شهرة لغات البرمجة على موقع Stack Overflow" src="/assets/images/2020/pyc-1-3.png"&gt;&lt;/p&gt;
&lt;p&gt;وبسبب كثرة استخدام بايثون حول العالم فغالباً لن يخطر سؤال في بالك إلا وستجد له جواباً ولن تواجهك مشكلة إلا وستجد أحداً حلها من قبل.&lt;/p&gt;
&lt;h3 id="_7"&gt;حزم برمجية لكل شيء&lt;/h3&gt;
&lt;p&gt;من مميزات لغة بايثون أيضاً أن هناك الكثير من الحزم البرمجية الجاهزة للاستخدام والتي تجعل القيام بالأمور العظيمة سهلاً في متناول اليد. الحزم البرمجية هي برامج تكون ضخمة أحياناً كتبها مبرمجون وجعلوها متاحة كي يستخدمها غيرهم بسهولة. هناك حزم لتحليل البيانات وحزم لإجراء حسابات رياضية معقدة وحزم أخرى لإنشاء رسوم بيانية وحزم للاتصال بقواعد البيانات المختلفة وحزم لتحميل البيانات من الإنترنت (web crawling) وحزم لتحميل الفيديوهات من يوتيوب وحزم لإنشاء برامج ذكاء اصطناعي وتعلم الآلة (machine learning) ووو&amp;hellip; القائمة لا تنتهي. لاحقاً سترى الفائدة العظيمة لهذه الحزم!&lt;/p&gt;
&lt;h2 id="_8"&gt;لمحة عن عتاد الحاسب (الهاردوير)&lt;/h2&gt;
&lt;p&gt;بما أن البرامج التي ستكتبها سيتم تنفيذها من قبل الحاسب، فمن المفيد أن نأخذ لمحة سريعة ومبسطة عن كيفية عمل الحاسب من الداخل. &lt;/p&gt;
&lt;p&gt;يمكن تمثيل الأجزاء الرئيسية في الحاسب كما في الصورة التالية:&lt;/p&gt;
&lt;p&gt;&lt;img alt="مخطط توضيحي لمكونات الحاسب" src="/assets/images/2020/pyc-1-4.png"&gt;&lt;/p&gt;
&lt;p&gt;أجهزة الإدخال والإخراج: أجهزة الإدخال هي الأجهزة التي نستخدمها للإدخال إلى الحاسوب مثل الفأرة ولوحة المفاتيح، وأجهزة الإخراج هي الأجهزة التي يستخدمها الحاسوب للإخراج مثل الشاشة وسماعات الصوت. &lt;/p&gt;
&lt;p&gt;وحدة المعالجة المركزية أو المعالج أو CPU هي أهم جزء في الحاسب، وهي دارة كهربائية شديدة التعقيد تحتوي على الملايين والملايين من &lt;a href="[https://ar.wikipedia.org/wiki/%D8%AA%D8%B1%D8%A7%D9%86%D8%B2%D8%B3%D8%AA%D9%88%D8%B1](https://ar.wikipedia.org/wiki/ترانزستور)"&gt;الترانزستورات&lt;/a&gt;، ويمكن للمعالجات الحديثة تنفيذ حوالي 3 مليارات عملية في الثانية الواحدة، فهي سريعة جداً ودائماً تطلب التعليمة (الخطوة) التالية لتقوم بتنفيذها. ومن أين تأخذ التعليمات؟ من الذاكرة الرئيسية (RAM).&lt;/p&gt;
&lt;p&gt;&lt;img alt="صور معالج Intel i7 من الأعلى والأسفل" src="/assets/images/2020/pyc-1-5.png"&gt;&lt;/p&gt;
&lt;p&gt;نرى أيضاً الذاكرة الثانوية وهي الذاكرة التي تحتفظ بالبيانات حتى بعد إطفاء الحاسب مثل القرص الصلب. عندما تكتب برنامجاً بلغة بايثون يتم تخزينه على الذاكرة الثانوية ثم يتم ترجمته إلى لغة الآلة (أصفار وواحدات) ونقله إلى الذاكرة الرئيسية عند تشغيله، وعندما يسأل المعالج: &amp;ldquo;ما التعليمة التالية؟&amp;rdquo; يتم إعطاء أول تعليمة من برنامجك للمعالج وعندما ينتهي من تنفيذها يتم إعطاؤه التعليمة التي بعدها وهكذا.&lt;/p&gt;
&lt;p&gt;لماذا لا يكفي وجود ذاكرة رئيسية فقط في الحاسب؟ لماذا نحتاج إلى ذاكرة ثانوية؟ لأنه عندما نقوم بإطفاء الحاسب فإن الذاكرة الرئيسية تفقد كل محتوياتها بينما الذاكرة الثانوية تحتفظ بمحتوياتها حتى بعد إطفاء الحاسب.&lt;/p&gt;
&lt;h2 id="_9"&gt;من أنا؟&lt;/h2&gt;
&lt;p&gt;بما أني سأكون الشخص الذي يعد هذه الدورة فلا بد أن أخبركم قليلاً عن نفسي ومؤهلاتي كي تزداد ثقتكم بالمحتوى المقدَّم في هذه الدورة.&lt;/p&gt;
&lt;p&gt;اسمي عمار اليوسفي. نلت درجة الماجستير مع مرتبة الشرف في علم البيانات (Data Science) من الجامعة الأولى في ماليزيا جامعة مالايا، وقبلها حصلت على درجة البكالوريوس في هندسة الحاسوب (Computer Engineering) من جامعة الأميرة سمية للتكنولوجيا في الأردن بترتيب الأول على الدفعة. عملت في شركة عالمية في كوالالامبور في مجال علم وتحليل البيانات. ونفذت عدة مشاريع لاقت قبولاً جيداً في مجالات تحليل البيانات وتصوير البيانات وتعلم الآلة وبايثون والعديد من حزمها البرمجية و SQL وغير ذلك. للاطلاع على المزيد من التفاصيل ولزيارة صفحات المشاريع التي قمت بتنفيذها يمكنك زيارة &lt;a href="https://ammar-alyousfi.com/s-resume/"&gt;صفحة سيرتي الذاتية&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="_10"&gt;فيديو الدرس&lt;/h2&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/w1JEjTvhfW8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</content><category term="دورة-تعلم-البرمجة-بلغة-بايثون"/><category term="بايثون"/><category term="برمجة"/><category term="لغات-برمجة"/><category term="تعلم-البرمجة"/><category term="البرمجة-للمبتدئين"/><category term="تعلم-البرمجة-بالعربي"/></entry><entry><title>Great Course Review: SQL for Data Analysis</title><link href="https://ammar-alyousfi.com/2020/great-course-review-sql-for-data-analysis.html" rel="alternate"/><published>2020-02-20T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-02-20:/2020/great-course-review-sql-for-data-analysis.html</id><summary type="html">&lt;p&gt;&lt;img alt="" src="/assets/images/2020/sqldac-1.png"&gt;&lt;/p&gt;
&lt;p&gt;Recently I finished &amp;ldquo;SQL for Data Analysis&amp;rdquo; course on Udacity platform. It is a really useful course that covers many important topics in SQL ranging from basic to advanced topics.&lt;/p&gt;
&lt;h2 id="course-topics"&gt;Course Topics&lt;/h2&gt;
&lt;p&gt;The course is divided into 7 lessons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The first lesson talks about basic SQL commands and how to …&lt;/li&gt;&lt;/ol&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="" src="/assets/images/2020/sqldac-1.png"&gt;&lt;/p&gt;
&lt;p&gt;Recently I finished &amp;ldquo;SQL for Data Analysis&amp;rdquo; course on Udacity platform. It is a really useful course that covers many important topics in SQL ranging from basic to advanced topics.&lt;/p&gt;
&lt;h2 id="course-topics"&gt;Course Topics&lt;/h2&gt;
&lt;p&gt;The course is divided into 7 lessons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The first lesson talks about basic SQL commands and how to filter the data. &lt;/li&gt;
&lt;li&gt;Then the second lesson talks about how to join tables. &lt;/li&gt;
&lt;li&gt;The third lesson topic is SQL aggregations. &lt;/li&gt;
&lt;li&gt;And then the fourth lesson covers subqueries and temporary tables. &lt;/li&gt;
&lt;li&gt;The fifth lesson discusses data cleaning in SQL. &lt;/li&gt;
&lt;li&gt;The sixth advanced lesson talks about window functions. &lt;/li&gt;
&lt;li&gt;And finally, the seventh advanced lesson talks about advanced joins and performance tuning.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="how-the-course-is-conducted"&gt;How the Course is Conducted&lt;/h2&gt;
&lt;p&gt;Each lesson consists of short video lectures and a number of quizzes (with their solutions). It is good because you get to practice in your browser each concept after learning it and the quizzes simulate real-life problems.&lt;/p&gt;
&lt;p&gt;The course is free to attend and can be found on &lt;a href="https://www.udacity.com/course/sql-for-data-analysis--ud198"&gt;this link&lt;/a&gt;.&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="sql"/><category term="data-analysis"/><category term="databases"/><category term="window-functions"/><category term="advanced-sql"/><category term="resources"/><category term="course"/></entry><entry><title>تحليل المباريات الدولية بين عام 1872 و 2018 (أكثر من 40,000 مباراة)</title><link href="https://ammar-alyousfi.com/ar/2020/analysis-of-international-football-matches-between-1872-and-2018.html" rel="alternate"/><published>2020-02-14T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-02-14:/ar/2020/analysis-of-international-football-matches-between-1872-and-2018.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2020/fban-head.jpg" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p&gt;في هذا المنشور سأعرض نتائج تحليل البيانات للمباريات الدولية التي أقيمت بين عام 1872 وعام 2018 (147سنة). وأعني بالمباريات الدولية المباريات بين المنتخبات الوطنية مثل منتخب البرازيل والمنتخب الألماني ومنتخب السعودية إلخ.&lt;/p&gt;
&lt;p&gt;يعتمد تحليل البيانات هذا على &lt;a href="https://www.kaggle.com/martj42/international-football-results-from-1872-to-2017"&gt;مجموعة بيانات منشورة على موقع Kaggle&lt;/a&gt;. تحتوي هذه المجموعة على معلومات عن أكثر …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2020/fban-head.jpg" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p&gt;في هذا المنشور سأعرض نتائج تحليل البيانات للمباريات الدولية التي أقيمت بين عام 1872 وعام 2018 (147سنة). وأعني بالمباريات الدولية المباريات بين المنتخبات الوطنية مثل منتخب البرازيل والمنتخب الألماني ومنتخب السعودية إلخ.&lt;/p&gt;
&lt;p&gt;يعتمد تحليل البيانات هذا على &lt;a href="https://www.kaggle.com/martj42/international-football-results-from-1872-to-2017"&gt;مجموعة بيانات منشورة على موقع Kaggle&lt;/a&gt;. تحتوي هذه المجموعة على معلومات عن أكثر من 40,000 مباراة دولية كما ذكرنا. المعلومات المتوفرة لكل مباراة هي تاريخ المباراة والفريقين المتباريين ونتيجة المباراة والبلد الذي استضاف المباراة والبطولة التي أقيمت ضمنها المباراة (مثل كأس العالم وكأس الأمم الأوروبية إلخ) ومعلومات أخرى. الصورة أدناه تعرض السطور القليلة الأولى من مجموعة البيانات هذه.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/footballanl-1.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ملاحظة&lt;/strong&gt;: لقد قمت بإجراء تحليل البيانات هذا &lt;a href="https://ammar-alyousfi.com/2020/analysis-of-international-football-matches-between-1872-and-2018"&gt;وكتبت عنه باللغة الإنجليزية في مدونتي الإنجليزية&lt;/a&gt; وحقق انتشاراً جيداً (انظر &lt;a href="https://www.reddit.com/r/footballtactics/comments/f3aj7z/i_analyzed_over_40000_international_matches_from/"&gt;هنا&lt;/a&gt; و&lt;a href="https://www.reddit.com/r/dataisbeautiful/comments/f2w3mq/oc_i_analyzed_over_40000_international_matches/"&gt;هنا&lt;/a&gt; و&lt;a href="https://www.reddit.com/r/soccer/comments/f2nsrp/analysis_results_of_international_football/"&gt;هنا&lt;/a&gt;)، وهنا أنشره باللغة العربية عسى أن يلقى قبولاً من الجمهور العربي.&lt;/p&gt;
&lt;h2 id="_1"&gt;أهمية هذا التحليل&lt;/h2&gt;
&lt;p&gt;هذا التحليل يقدم نتائج تهم محبي ومتابعي كرة القدم حول العالم لأنه يستخلص نتائج مثيرة للاهتمام من بيانات متفرقة عن عدد كبير من المباريات ويقدم النتائج عن طريق رسوم بيانية جميلة. فالرسم البياني الواحد يلخص لك معلومات موجودة في أكثر من 40,000 سطر.&lt;/p&gt;
&lt;h2 id="_2"&gt;أهداف التحليل&lt;/h2&gt;
&lt;p&gt;هذا التحليل يهدف إلى الإجابة عن الأسئلة التالية:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ما هو الفريق الذي لعب مباريات أكثر من غيره من الفرق عبر التاريخ؟&lt;/li&gt;
&lt;li&gt;ما هو الفريق الذي لعب مباريات أكثر من غيره في كأس العالم؟&lt;/li&gt;
&lt;li&gt;ما هو الفريق الذي حقق أكبر عدد من الانتصارات عبر التاريخ؟&lt;/li&gt;
&lt;li&gt;ما هو الفريق الذي تكبد أكبر عدد من الخسارات عبر التاريخ؟&lt;/li&gt;
&lt;li&gt;ما هو الفريق الذي أحرز أكبر عدد من الأهداف على مر السنين؟&lt;/li&gt;
&lt;li&gt;ما هو الفريق الذي أحرز أكبر عدد من الأهداف في كأس العالم؟&lt;/li&gt;
&lt;li&gt;ما هي الفرق التي تكرر لعبها ضد بعضها أكثر؟&lt;/li&gt;
&lt;li&gt;هل عدد الأهداف في المباريات الودية أقل من عددها في المباريات غير الودية؟&lt;/li&gt;
&lt;li&gt;ما هي البطولة التي يتم إحراز أكبر عدد من الأهداف فيها؟&lt;/li&gt;
&lt;li&gt;ما هي نسبة المباريات التي انتهت بالتعادل عبر التاريخ؟&lt;/li&gt;
&lt;li&gt;ما عدد المباريات التي تم لعبها في كل بطولة عبر التاريخ؟&lt;/li&gt;
&lt;li&gt;كيف يتغير عدد المباريات من سنة إلى أخرى؟ هل كان عدد المباريات في ستينات القرن الماضي أكثر من الآن؟&lt;/li&gt;
&lt;li&gt;ما هو الشهر من السنة الذي أقيم فيه أكبر عدد من المباريات عبر التاريخ؟ هل هو آب؟ هل هو كانون الثاني؟ هل يتغير عدد المباريات بشكل ملحوظ من شهر لآخر؟&lt;/li&gt;
&lt;li&gt;ما هو يوم الأسبوع الذي أقيم فيه أكبر عدد من المباريات عبر التاريخ؟ هل هو الخميس؟ هل هو السبت؟ هل يتغير عدد المباريات بشكل ملحوظ من يوم لآخر؟&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="_3"&gt;كيف تم إجراء هذا التحليل؟&lt;/h2&gt;
&lt;p&gt;تم إجراؤه بشكل رئيسي باستخدام لغة بايثون (Python) البرمجية؛ تم استخدام حزمة Pandas لقراءة البيانات وتحليلها وتخزينها؛ تم استخدام حزمة Matplotlib لإنشاء الرسوم البيانية. وتم إجراء التحليل بكامله ضمن Jupyter Lab.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/footballanl-2.png"&gt;&lt;/p&gt;
&lt;h2 id="_4"&gt;الكود المستخدم لإجراء التحليل&lt;/h2&gt;
&lt;p&gt;يمكن الوصول إلى الكود المستخدم لإجراء التحليل وشرح العمليات التي تم إجراؤها عن طريق &lt;a href="https://github.com/ammar1y/Analysis-of-International-Football-Matches-Between-1872-and-2018"&gt;هذا الرابط&lt;/a&gt; على موقع Github.&lt;/p&gt;
&lt;p&gt;والآن &lt;strong&gt;لنبدأ&lt;/strong&gt; بعرض نتائج التحليل.&lt;/p&gt;
&lt;h2 id="_5"&gt;نتائج التحليل&lt;/h2&gt;
&lt;h3 id="_6"&gt;ما هو الفريق الذي لعب مباريات أكثر من غيره من الفرق عبر التاريخ؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-played-more.png"&gt;&lt;/p&gt;
&lt;p&gt;السويد هي من لعبت مباريات أكثر من جميع الفرق الأخرى. ليست البرازيل، وليست ألمانيا، بل السويد! لعبت 1,004 مباريات، ويليها إنجلترا التي لعبت 999 مباراة، ثم البرازيل والأرجنتين حيث لعب كل منهما 966 مباراة.&lt;/p&gt;
&lt;p&gt;الرسم البياني يعرض أيضاً عدد المباريات التي تم لعبها في البطولات. مثلاً، يمكن رؤية أن معظم مباريات السويد كانت ودية (friendly) وأنها لعبت عدداً لا بأس به من المباريات في بطولتي كأس العالم )(FIFA World Cup) وكأس الأمم الأوروبية (UEFA Euro).&lt;/p&gt;
&lt;h3 id="_7"&gt;ما هو الفريق الذي لعب مباريات أكثر من غيره في كأس العالم؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-played-more-wc.png"&gt;&lt;/p&gt;
&lt;p&gt;إذا أخذنا بعين الاعتبار بطولة كأس العالم فقط فإن كلاً من ألمانيا والبرازيل يأتي في المركز الأول حيث لعب كل منهما 109 مباريات في كأس العالم. ويليهما إيطاليا التي لعبت 83 مباراة ثم الأرجنتين التي لعبت 81 مباراة.&lt;/p&gt;
&lt;h3 id="_8"&gt;ما هو الفريق الذي حقق أكبر عدد من الانتصارات عبر التاريخ؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-won-more.png"&gt;&lt;/p&gt;
&lt;p&gt;نرى أن البرازيل حققت أكبر عدد من الانتصارات عبر التاريخ حيث فازت في 617 مباراة. بعد البرازيل تأتي إنجلترا التي حققت 565 انتصاراً ثم ألمانيا التي حققت 548 انتصاراً.&lt;/p&gt;
&lt;h3 id="_9"&gt;ما هو الفريق الذي تكبد أكبر عدد من الخسارات عبر التاريخ؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-lost-more.png"&gt;&lt;/p&gt;
&lt;p&gt;فنلندا هو الفريق الذي خسر مباريات أكثر من جميع الفرق الأخرى؛ لقد خسر في 395 مباراة. بعد فنلندا تأتي سويسرا التي خسرت 342 مباراة ثم إيرلندا الشمالية التي خسرت 329 مباراة.&lt;/p&gt;
&lt;h3 id="-"&gt;الانتصارات - الخسارات&lt;/h3&gt;
&lt;p&gt;رأينا أن هناك فرقاً انتصرت أكثر من الأخرى وأن هناك فرقاً خسرت أكثر من غيرها. الآن سنطرح عدد مرات الخسارة لكل فريق من عدد مرات فوزه ونرى النتائج. هذا سيتيح لنا أن نرى الفرق التي فازت أكثر مما خسرت والفرق التي خسرت أكثر مما فازت.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-wins-losses.png"&gt;&lt;/p&gt;
&lt;p&gt;الرسم البياني يعرض الفرق العشرين الأولى بناء على القيمة المطلقة لـ (الانتصارات - الخسارات). نرى أن البرازيل تأتي في المقدمة بقيمة 461 وهذا يعني أنها فازت 461 مرة أكثر مما خسرت. ثم تأتي إنجلترا بقيمة 372 ثم ألمانيا بقيمة 349. هذه الفرق كلها فازت أكثر مما خسرت، ولذلك رسمت باللون الأخضر.&lt;/p&gt;
&lt;p&gt;على الضفة الأخرى هناك فرق خسرت أكثر مما فازت عبر التاريخ، وهي مرسومة باللون الأحمر. في مقدمة هذه الفرق تأتي لوكسمبورغ بقيمة -276 وهذا يعني أنها خسرت 276 مرة أكثر مما فازت، ثم مالطا بقيمة -228، ثم فنلندا بقيمة -212.&lt;/p&gt;
&lt;h3 id="_10"&gt;ما هو الفريق الذي أحرز أكبر عدد من الأهداف على مر السنين؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-scored-more.png"&gt;&lt;/p&gt;
&lt;p&gt;كما يظهر في الرسم: فريق إنجلترا هو من أحرز أهدافاً أكثر من أي فريق آخر؛ أحرز 2,170 هدفاً، ويليه فريق البرازيل الذي أحرز 2,091 هدفاً، ثم فريق ألمانيا والذي أحرز 2,116 هدفاً.&lt;/p&gt;
&lt;h3 id="_11"&gt;ما هو الفريق الذي أحرز أكبر عدد من الأهداف في كأس العالم؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-scored-more-wc.png"&gt;&lt;/p&gt;
&lt;p&gt;بالنظر إلى مباريات كأس العالم فقط فنرى أن البرازيل هي أكثر من أحرز أهدافاً في كأس العالم برصيد 229 هدفاً ثم ألمانيا بـ 226 هدفاً، ثم الأرجنتين بـ 137 هدفاً.&lt;/p&gt;
&lt;h3 id="_12"&gt;ما هي الفرق التي تكرر لعبها ضد بعضها أكثر؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-against-eachother.png"&gt;&lt;/p&gt;
&lt;p&gt;كما يظهر في الصورة فإن الفريقين اللذين تواجها في مباريات أكثر من غيرهما هما الأرجنتين والأوروغواي حيث تواجها في 175 مباراة عبر التاريخ. بعدهما يأتي فريقا النمسا وهنغاريا حيث تواجها 133 مرة، ثم بلغاريا وهولندا اللذين تواجها 125 مرة.&lt;/p&gt;
&lt;p&gt;إذا نظرنا إلى خريطة العالم نجد أن هذه الأزواج تقع بجانب بعضها: فالأرجنتين تقع بجانب الأوروغواي والنمسا بجانب هنغاريا وبلغاريا بجانب هولندا كما يظهر في الصورة أسفله.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-mp.png"&gt;&lt;/p&gt;
&lt;h3 id="_13"&gt;هل عدد الأهداف في المباريات الودية أقل من عددها في المباريات غير الودية؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-fr-vs-non.png"&gt;&lt;/p&gt;
&lt;p&gt;كما نرى في الرسم فليس هناك فرق يذكر بين متوسط عدد الأهداف في المباريات الودية وبين متوسط عدد الأهداف في المباريات غير الودية.&lt;/p&gt;
&lt;h3 id="_14"&gt;ما هي البطولة التي يتم إحراز أكبر عدد من الأهداف فيها؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-tour-goals.png"&gt;&lt;/p&gt;
&lt;p&gt;كما يُظهر الرسم فإن مباراة في البطولة البريطانية (British Championship) يتم تسجيل 3.5 أهداف بها في المتوسط. ومتوسط عدد الأهداف في مباريات تصفيات كأس الكاريبي (CFU Caribbean Cup qualification) قريب جداً من ذلك. بعد ذلك، فإن متوسط عدد الأهداف في مباريات بطولة ميركادا (Merdeka Tournament) هو 3.3.&lt;/p&gt;
&lt;p&gt;أيضاً يمكننا رؤية أن المباريات الودية يتم تسجيل أهداف بها أكثر من مباريات كأس العالم، وكذلك نرى أن مباريات &lt;em&gt;تصفيات&lt;/em&gt; كأس العالم يتم تسجيل أهداف بها أكثر من مباريات كأس العالم.&lt;/p&gt;
&lt;h3 id="_15"&gt;ما هي نسبة المباريات التي انتهت بالتعادل عبر التاريخ؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-draw-p.png"&gt;&lt;/p&gt;
&lt;p&gt;نسبتها 23.1٪ كما هو ظاهر.&lt;/p&gt;
&lt;h4 id="_16"&gt;ما عدد المباريات التي تم لعبها في كل بطولة عبر التاريخ؟&lt;/h4&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-tour-matches.png"&gt;&lt;/p&gt;
&lt;p&gt;من رسم الخريطة الشجرية أعلاه (حيث يمثل حجم المستطيل عدد المباريات لكل بطولة) نرى أن أكثر المباريات الدولية التي تم لعبها كانت ودية (friendly) حيث تم لعب 16,795 مباراة ودية من إجمالي عدد المباريات البالغ 40,407 مباراة. بعد المباريات الودية تأتي مباريات تصفيات كأس العالم (FIFA World Cup qualification) ثم مباريات تصفيات كأس الأمم الأوروبية (UEFA Euro qualification).&lt;/p&gt;
&lt;h3 id="_17"&gt;كيف يتغير عدد المباريات من سنة إلى أخرى؟ هل كان عدد المباريات في ستينات القرن الماضي أكثر من الآن؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-years.png"&gt;&lt;/p&gt;
&lt;p&gt;من رسم المخطط الشريطي (bar chart) أعلاه نرى أنه بشكل عام فإن عدد المباريات يزداد عبر السنين. كانت سنة 2008 السنة التي شهدت أكبر عدد من المباريات بحصيلة 1,091 مباراة.&lt;/p&gt;
&lt;h3 id="_18"&gt;كيف يتغير عدد الأهداف من سنة لأخرى؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-years-goals.png"&gt;&lt;/p&gt;
&lt;p&gt;يظهر الرسم أن عدد الأهداف يميل للزيادة عبر السنين أيضاً. لمشاهدة العلاقة بين عدد المباريات وعدد الأهداف عبر السنين بشكل أسهل شاهد الرسم أدناه والذي يعرض الرسمين السابقين مع بعضهما.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-years-count-goals.png"&gt;&lt;/p&gt;
&lt;h4 id="_19"&gt;ما هو الشهر من السنة الذي أقيم فيه أكبر عدد من المباريات عبر التاريخ؟ هل هو آب؟ هل هو كانون الثاني؟ هل يتغير عدد المباريات بشكل ملحوظ من شهر لآخر؟&lt;/h4&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-months.png"&gt;&lt;/p&gt;
&lt;p&gt;كما نرى فإن عدد المباريات يختلف من شهر لآخر. كان شهر حزيران (June) الشهر الذي شهد مباريات أكثر من باقي الشهور حيث شهد 5,706 مباراة على مر السنين من أصل 40,407 مباراة. في نهاية القائمة يأتي شهر كانون الثاني (January) حيث شهد 2,148 مباراة فقط.&lt;/p&gt;
&lt;h3 id="_20"&gt;ما هو يوم الأسبوع الذي أقيم فيه أكبر عدد من المباريات عبر التاريخ؟ هل هو الخميس؟ هل هو السبت؟ هل يتغير عدد المباريات بشكل ملحوظ من يوم لآخر؟&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-day.png"&gt;&lt;/p&gt;
&lt;p&gt;نرى أن يوم الأحد شهد مباريات أكثر من باقي الأيام حيث أقيم فيه 9,943 مباراة، وبعده يأتي يوم الأربعاء بفارق بسيط. في نهاية القائمة نرى يوم الاثنين حيث شهد 2,313 مباراة فقط.&lt;/p&gt;
&lt;h2 id="_21"&gt;ملخص للنتائج&lt;/h2&gt;
&lt;p&gt;هذا الملخص لا يغني عن النتائج المعروضة أعلاه لكن قد ينفع لتذكر بعض الأشياء في هذا التحليل.&lt;/p&gt;
&lt;p&gt;خلال الفترة بين عام 1872 و2018:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;السويد 🇸🇪 لعبت مباريات أكثر من الفرق الأخرى&lt;/li&gt;
&lt;li&gt;ألمانيا 🇩🇪 لعبت مباريات في كأس العالم أكثر من الفرق الأخرى&lt;/li&gt;
&lt;li&gt;البرازيل 🇧🇷 فازت أكثر من الفرق الأخرى&lt;/li&gt;
&lt;li&gt;فنلندا 🇫🇮 خسرت أكثر من الفرق الأخرى&lt;/li&gt;
&lt;li&gt;البرازيل 🇧🇷 حققت 461 فوزاً صافياً: أكثر من أي فريق آخر&lt;/li&gt;
&lt;li&gt;لوكسمبورغ 🇱🇺 حققت 276 خسارة صافية: أكثر من أي فريق آخر&lt;/li&gt;
&lt;li&gt;إنجلترا 🏴󠁧󠁢󠁥󠁮󠁧󠁿 أحرزت أهدافاً أكثر من الفرق الأخرى&lt;/li&gt;
&lt;li&gt;البرازيل 🇧🇷 أحرزت أهدافاً في كأس العالم أكثر من الفرق الأخرى&lt;/li&gt;
&lt;li&gt;الأرجنتين 🇦🇷 والأوروغواي 🇺🇾 تواجها أكثر من أي فريقين آخرين&lt;/li&gt;
&lt;li&gt;23.1٪ من المباريات انتهت بالتعادل&lt;/li&gt;
&lt;li&gt;شهر حزيران جرى فيه مباريات أكثر من الشهور الأخرى&lt;/li&gt;
&lt;li&gt;يوم الأحد شهد مباريات أكثر من الأيام الأخرى&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="_22"&gt;العمل المستقبلي&lt;/h2&gt;
&lt;p&gt;زيادة على ما تم عمله هنا يمكن إجراء تحليلات أكثر عمقاً. مثلاً يمكن أن يتم تحليل أداء المنتخب المصري على مر السنين ومعرفة سنوات تميزه وسنوات ذبوله. أو يمكن أن يتم إجراء تحليل للفرق الخليجية وإجراء مقارنات بينها. يمكن أيضاً مقارنة القارات ببعضها، وأمور أخرى.&lt;/p&gt;
&lt;p&gt;إذا كنت ترغب برؤية تحليلات كهذه أو غيرها أخبرني بذلك عبر &lt;a href="mailto:ammar5656@gmail.com"&gt;بريدي الإلكتروني&lt;/a&gt; أو &lt;a href="https://twitter.com/ammar_cel"&gt;حسابي في تويتر&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;إذا أعجبك هذا العمل شاركه مع غيرك 📲. إذا كنت من سكان الإمارات يمكنك أيضاً متابعة حساب جديد يعرض نتائج تحليل بيانات تتعلق بالإمارات العربية المتحدة على &lt;a href="https://www.instagram.com/bayanat.nreg/"&gt;Instagram&lt;/a&gt; أو &lt;a href="https://twitter.com/mWaQZYXWTAnBwAr"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;</content><category term="علم-البيانات"/><category term="علم-البيانات"/><category term="تحليل-البيانات"/><category term="كرة-القدم"/><category term="مشروع"/><category term="تصوير-البيانات"/></entry><entry><title>Analysis of International Football Matches Between 1872 and 2018 (More than 40,000 Matches)</title><link href="https://ammar-alyousfi.com/2020/analysis-of-international-football-matches-between-1872-and-2018.html" rel="alternate"/><published>2020-02-12T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2020-02-12:/2020/analysis-of-international-football-matches-between-1872-and-2018.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2020/fban-head.jpg" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p&gt;In this post, I will present the results of a thorough analysis of international football matches that took place between 1872 and 2018 (147 years). &lt;/p&gt;
&lt;p&gt;International matches means matches between national teams like Brazil, Italy, Japan, Egypt, etc.&lt;/p&gt;
&lt;p&gt;The analysis uses a dataset published on Kaggle on &lt;a href="https://www.kaggle.com/martj42/international-football-results-from-1872-to-2017"&gt;this link&lt;/a&gt;. Each …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2020/fban-head.jpg" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p&gt;In this post, I will present the results of a thorough analysis of international football matches that took place between 1872 and 2018 (147 years). &lt;/p&gt;
&lt;p&gt;International matches means matches between national teams like Brazil, Italy, Japan, Egypt, etc.&lt;/p&gt;
&lt;p&gt;The analysis uses a dataset published on Kaggle on &lt;a href="https://www.kaggle.com/martj42/international-football-results-from-1872-to-2017"&gt;this link&lt;/a&gt;. Each row in the dataset represents a match. For each match, the dataset lists its date, the two teams participating in the match, the result of the match, the tournament، the country that hosted the match, and other info. The figure below shows the first few rows of this dataset. &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/footballanl-1.png"&gt;&lt;/p&gt;
&lt;p&gt;The dataset owner says that &amp;ldquo;the matches are strictly men&amp;rsquo;s full internationals and the data does not include Olympic Games or matches where at least one of the teams was the nation&amp;rsquo;s B-team, U-23 or a league select team&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Regarding the tournament column in the dataset, it lists the name of the tournament of the match like &amp;ldquo;FIFA World Cup&amp;rdquo; tournament and &amp;ldquo;UEFA Euro&amp;rdquo; tournament, or &amp;ldquo;Friendly&amp;rdquo; for regular friendly matches.&lt;/p&gt;
&lt;h2 id="importance-of-the-analysis"&gt;Importance of the Analysis&lt;/h2&gt;
&lt;p&gt;This analysis presents interesting results for football lovers around the world especially because it covers 40,000+ international matches over 140+ years. It presents the results using elegant visualizations that summarize thousands of rows of data into one picture.&lt;/p&gt;
&lt;h2 id="goals-of-the-analysis"&gt;Goals of the Analysis&lt;/h2&gt;
&lt;p&gt;The analysis will answer questions including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Which team played the largest number of matches throughout history?&lt;/li&gt;
&lt;li&gt;Which team played the largest number of matches in FIFA World Cup?&lt;/li&gt;
&lt;li&gt;Which team achieved more wins than others over the years?&lt;/li&gt;
&lt;li&gt;Which team lost more matches than others over the years?&lt;/li&gt;
&lt;li&gt;Which team scored the largest number of goals throughout history?&lt;/li&gt;
&lt;li&gt;Which team scored the largest number of goals in FIFA World Cup?&lt;/li&gt;
&lt;li&gt;Which teams played against each other the most?&lt;/li&gt;
&lt;li&gt;Do Friendly Matches Have Less or More Goals than Non-Friendly Matches?&lt;/li&gt;
&lt;li&gt;In which tournament players tend to score more goals?&lt;/li&gt;
&lt;li&gt;What&amp;rsquo;s the percentage of matches that ended in draw?&lt;/li&gt;
&lt;li&gt;What is the number of matches played in each tournament throughout history? &lt;/li&gt;
&lt;li&gt;How does the number of matches change through years? Did the 1990s have more matches than the 1980s?&lt;/li&gt;
&lt;li&gt;Which month through history had more matches? Is it June, August, or others? Does the number of matches actually differ from month to month?&lt;/li&gt;
&lt;li&gt;Which day of the week had more matches through history? Did most matches occur in weekends?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="technologies-used-to-do-the-analysis"&gt;Technologies Used to Do the Analysis&lt;/h2&gt;
&lt;p&gt;The analysis was performed using Python programming language; &lt;a href="https://pandas.pydata.org/"&gt;Pandas&lt;/a&gt; package was used to read, handle, and analyze the data; &lt;a href="https://matplotlib.org/"&gt;Matplotlib&lt;/a&gt; and &lt;a href="https://seaborn.pydata.org/index.html"&gt;Seaborn&lt;/a&gt; packages were used to produce the visualizations; other packages were used as well. And the whole analysis was done in &lt;a href="https://jupyter.org/"&gt;Jupyter Lab&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/footballanl-2.png"&gt;&lt;/p&gt;
&lt;h2 id="code-of-the-analysis"&gt;Code of the Analysis&lt;/h2&gt;
&lt;p&gt;The whole analysis with the code used and with explanations about the operations performed can be found in a Jupyter notebook in &lt;a href="https://github.com/ammar1y/Analysis-of-International-Football-Matches-Between-1872-and-2018"&gt;this Github repository&lt;/a&gt;. Please note that the notebook contains extra analytics that are not presented in this post. So if you want everything, see the notebook.&lt;/p&gt;
&lt;p&gt;And now, &lt;strong&gt;let&amp;rsquo;s dive&lt;/strong&gt; into the analysis results. If you need to see an image in bigger size, right-click on the image and open it in a new tab.&lt;/p&gt;
&lt;h2 id="analysis-results"&gt;Analysis Results&lt;/h2&gt;
&lt;p&gt;The results will be presented as visualizations that answer the questions mentioned above.&lt;a name="played-most"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="which-team-played-the-largest-number-of-matches-throughout-history"&gt;Which team played the largest number of matches throughout history?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-played-more.png"&gt;&lt;/p&gt;
&lt;p&gt;So the answer is &lt;strong&gt;Sweden&lt;/strong&gt; with 1,004 matches followed closely by &lt;strong&gt;England&lt;/strong&gt; with 999 matches followed by both &lt;strong&gt;Brazil&lt;/strong&gt; and &lt;strong&gt;Argentina&lt;/strong&gt; with 966 matches.&lt;/p&gt;
&lt;p&gt;This top-10 plot has 5 countries in Europe, 3 countries in South America, 1 country in North America, and 1 country in Asia.&lt;/p&gt;
&lt;p&gt;The plot shows also the tournaments played by each of the teams. For example, we can see that most of the matches played by Sweden were friendly matches accompanied by a considerable percentage of matches in FIFA World Cup and UEFA Euro tournaments. &lt;/p&gt;
&lt;h3 id="which-team-played-the-largest-number-of-matches-in-fifa-world-cup"&gt;Which team played the largest number of matches in FIFA World Cup?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-played-more-wc.png"&gt;&lt;/p&gt;
&lt;p&gt;Considering World Cup alone changes the situation. Now &lt;strong&gt;Germany&lt;/strong&gt; and &lt;strong&gt;Brazil&lt;/strong&gt; come first with 109 matches followed by &lt;strong&gt;Italy&lt;/strong&gt; with 83 matches and then &lt;strong&gt;Argentina&lt;/strong&gt; with 81 matches.&lt;/p&gt;
&lt;h3 id="which-team-achieved-more-wins-than-others-over-the-years"&gt;Which team achieved more wins than others over the years?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-won-more.png"&gt;&lt;/p&gt;
&lt;p&gt;We can see that &lt;strong&gt;Brazil&lt;/strong&gt; achieved wins throughout history more than any other national team in the world; it achieved 617 wins. After Brazil comes &lt;strong&gt;England&lt;/strong&gt; with 565 wins followed by &lt;strong&gt;Germany&lt;/strong&gt; with 548 wins.&lt;/p&gt;
&lt;h3 id="which-team-lost-more-matches-than-others-over-the-years"&gt;Which team lost more matches than others over the years?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-lost-more.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Finland&lt;/strong&gt; lost more matches than all other teams; it lost 395 matches. Then comes &lt;strong&gt;Switzerland&lt;/strong&gt; with 342 defeats followed by &lt;strong&gt;Northern Ireland&lt;/strong&gt; with 329 defeats.&lt;/p&gt;
&lt;h3 id="wins-defeats"&gt;Wins - Defeats&lt;/h3&gt;
&lt;p&gt;We saw teams that won the most and teams that lost the most. Now, we want to subtract the number of defeats from the number of wins for each team and visualize the results. This will show us teams that won more than they lost and teams that lost more than won.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-wins-losses.png"&gt;&lt;/p&gt;
&lt;p&gt;The plot shows the top 20 teams ordered according to the &lt;em&gt;absolute value&lt;/em&gt; of (wins - defeats). We see that &lt;strong&gt;Brazil&lt;/strong&gt; comes first with a value of 461 &lt;em&gt;net wins&lt;/em&gt;. Then comes &lt;strong&gt;England&lt;/strong&gt; with a value of 372 then &lt;strong&gt;Germany&lt;/strong&gt; with a value of 349. These all have more wins than defeats and they are plotted with green color. &lt;/p&gt;
&lt;p&gt;On the other hand, there are countries with more defeats than wins and they are plotted with red color. The first of them is &lt;strong&gt;Luxembourg&lt;/strong&gt; with a value of -276. After Luxembourg comes &lt;strong&gt;Malta&lt;/strong&gt; with a value of -228 then &lt;strong&gt;Finland&lt;/strong&gt; with a value of -212. Notice the minus sign for these teams because we subtracted defeats from wins and the number of defeats for these teams was larger than the number of wins.&lt;/p&gt;
&lt;h3 id="which-team-scored-the-largest-number-of-goals-throughout-history"&gt;Which team scored the largest number of goals throughout history?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-scored-more.png"&gt;&lt;/p&gt;
&lt;p&gt;It turns out that &lt;strong&gt;England&lt;/strong&gt; scored more goals overall with 2170 goals, then &lt;strong&gt;Brazil&lt;/strong&gt; with 2116 goals, then &lt;strong&gt;Germany&lt;/strong&gt; with 2091 goals.&lt;/p&gt;
&lt;h3 id="which-team-scored-the-largest-number-of-goals-in-fifa-world-cup"&gt;Which team scored the largest number of goals in FIFA World Cup?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-scored-more-wc.png"&gt;&lt;/p&gt;
&lt;p&gt;Considering World Cup alone, &lt;strong&gt;Brazil&lt;/strong&gt; comes first in terms of the number of goals scored with 229 goals followed by &lt;strong&gt;Germany&lt;/strong&gt; with 226 goals followed by &lt;strong&gt;Argentina&lt;/strong&gt; with 137 goals.&lt;/p&gt;
&lt;h3 id="which-teams-played-against-each-other-the-most"&gt;Which teams played against each other the most?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-against-eachother.png"&gt;&lt;/p&gt;
&lt;p&gt;So the two teams that played against each other the most through history are &lt;strong&gt;Argentina and Uruguay&lt;/strong&gt;; they played 175 matches against each other. Then &lt;strong&gt;Austria and Hungary&lt;/strong&gt; which played against each other 133 matches. After that, &lt;strong&gt;Belgium and Netherlands&lt;/strong&gt; which played 125 matches against each other.&lt;/p&gt;
&lt;p&gt;If we look at the maps of these pairs, we can see that each pair consists of &lt;em&gt;adjacent&lt;/em&gt; countries. Look at the images below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-mp.png"&gt;&lt;/p&gt;
&lt;h3 id="do-friendly-matches-have-less-or-more-goals-than-non-friendly-matches"&gt;Do Friendly Matches Have Less or More Goals than Non-Friendly Matches?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-fr-vs-non.png"&gt;&lt;/p&gt;
&lt;p&gt;As can be seen in the plot, there is no considerable difference between the average number of goals in friendly matches and the average number of goals in non-friendly matches.&lt;/p&gt;
&lt;h3 id="in-which-tournament-players-tend-to-score-more-goals"&gt;In which tournament players tend to score more goals?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-tour-goals.png"&gt;&lt;/p&gt;
&lt;p&gt;From the plot, we can see that a match in the &amp;ldquo;British Championship&amp;rdquo; tournament has &lt;em&gt;on average&lt;/em&gt; 3.5 goals. The &amp;ldquo;CFU Caribbean Cup qualification&amp;rdquo; tournament has a very close average. After that, the &amp;ldquo;Merdeka Tournament&amp;rdquo; has an average of 3.3 goals per match.&lt;/p&gt;
&lt;p&gt;Also, we can see that friendly matches tend to have more goals than FIFA World Cup matches and that FIFA World Cup qualification matches tend to have more goals than FIFA World Cup matches.&lt;/p&gt;
&lt;h3 id="whats-the-percentage-of-matches-that-ended-in-draw"&gt;What&amp;rsquo;s the percentage of matches that ended in draw?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-draw-p.png"&gt;&lt;/p&gt;
&lt;h3 id="what-is-the-number-of-matches-played-in-each-tournament-throughout-history"&gt;What is the number of matches played in each tournament throughout history?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-tour-matches.png"&gt;&lt;/p&gt;
&lt;p&gt;From this treemap plot, we can see that &lt;strong&gt;friendly&lt;/strong&gt; matches constitute the largest part of international matches with 16,795 matches out of the total 40,407 matches. After friendly matches come &amp;ldquo;&lt;strong&gt;FIFA World Cup qualification&lt;/strong&gt;&amp;rdquo; matches, then &amp;ldquo;&lt;strong&gt;UEFA Euro qualification&lt;/strong&gt;&amp;rdquo; matches.&lt;/p&gt;
&lt;h3 id="how-does-the-number-of-matches-change-through-years-did-the-1990s-have-more-matches-than-the-1980s"&gt;How does the number of matches change through years? Did the 1990s have more matches than the 1980s?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-years.png"&gt;&lt;/p&gt;
&lt;p&gt;From this plot which shows the number of matches per year, we can notice that, generally, the number of matches tend to increase over the years. The year that witnessed more matches than all other years was &lt;strong&gt;2008&lt;/strong&gt; with1091 matches.&lt;/p&gt;
&lt;h3 id="how-does-the-number-of-goals-change-through-years"&gt;How does the number of goals change through years?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-years-goals.png"&gt;&lt;/p&gt;
&lt;p&gt;And to see the relationship between the number of matches and the number of goals through the years, the following plot combines the previous two plots.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-years-count-goals.png"&gt;&lt;/p&gt;
&lt;h3 id="which-month-through-history-had-more-matches-is-it-june-august-or-others-does-the-number-of-matches-actually-differ-from-month-to-month"&gt;Which month through history had more matches? Is it June, August, or others? Does the number of matches actually differ from month to month?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-months.png"&gt;&lt;/p&gt;
&lt;p&gt;We can see that the number of matches differs from one month to another. &lt;strong&gt;June&lt;/strong&gt; is the month of the year that witnessed more matches than other months with 5,706 out of the total 40,407 matches. On the opposite side, &lt;strong&gt;January&lt;/strong&gt; is the month that witnessed the least number of matches, 2,148.&lt;/p&gt;
&lt;h3 id="which-day-of-the-week-had-more-matches-through-history-did-most-matches-occur-in-weekends"&gt;Which day of the week had more matches through history? Did most matches occur in weekends?&lt;/h3&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/fban-day.png"&gt;&lt;/p&gt;
&lt;p&gt;We can see that more matches occurred on &lt;strong&gt;Sunday&lt;/strong&gt; than all other days of the week: 9,943 matches. Sunday is followed closely by &lt;strong&gt;Wednesday&lt;/strong&gt; with 9,808 matches. On the opposite side, &lt;strong&gt;Monday&lt;/strong&gt; witnessed the least number of matches: 2,313. &lt;/p&gt;
&lt;h2 id="summarized-results"&gt;Summarized Results&lt;/h2&gt;
&lt;p&gt;These summarized results don&amp;rsquo;t substitute the results above but can help you remember somethings from the analysis.&lt;/p&gt;
&lt;p&gt;During the period between 1872 and 2018:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sweden 🇸🇪 played matches more than any other country&lt;/li&gt;
&lt;li&gt;German 🇩🇪 played World Cup matches more than any other country&lt;/li&gt;
&lt;li&gt;Brazil 🇧🇷 won matches more than other countries&lt;/li&gt;
&lt;li&gt;Finland 🇫🇮 lost matches more than other countries&lt;/li&gt;
&lt;li&gt;Brazil 🇧🇷 has 461 &lt;em&gt;net&lt;/em&gt; wins—more than any other country&lt;/li&gt;
&lt;li&gt;Luxembourg 🇱🇺 has 276 &lt;em&gt;net&lt;/em&gt; defeats—more than any other country&lt;/li&gt;
&lt;li&gt;England 🏴󠁧󠁢󠁥󠁮󠁧󠁿 scored more goals than the rest&lt;/li&gt;
&lt;li&gt;Brazil 🇧🇷 scored more goals in World Cup than the rest&lt;/li&gt;
&lt;li&gt;Argentina 🇦🇷 and Uruguay 🇺🇾 played against each other more than any other two teams&lt;/li&gt;
&lt;li&gt;23.1% of international matches ended in draw&lt;/li&gt;
&lt;li&gt;June witnessed more matches than other months&lt;/li&gt;
&lt;li&gt;Sunday witnessed more matches than other days&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="future-work"&gt;Future Work&lt;/h2&gt;
&lt;p&gt;For future work, I might do more in-depth analysis focusing on particular teams or particular areas. For example, an in-depth analysis might be performed on Brazil team to see how its performance varied through the years. &lt;/p&gt;
&lt;p&gt;Also, an analysis can be done to see which teams have correlated performance (i.e. their performances improve together and worsen together). Moreover, an analysis can be done to compare continents with each other like comparing South American teams and European teams. Finally, an analysis can be performed on teams that share something in common like Gulf Cooperation Council teams.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Liked this post? Share it and help me a reach bigger audience: &lt;a href="/2020/analysis-of-international-football-matches-between-1872-and-2018.html?src=pstmsg"&gt;&lt;strong&gt;link to this post&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="data-analysis"/><category term="data-visualization"/><category term="football-analysis"/><category term="data-science-project"/><category term="python"/><category term="pandas"/><category term="matplotlib"/></entry><entry><title>Comparing and Clustering the Neighborhoods of New York City and Toronto</title><link href="https://ammar-alyousfi.com/2019/comparing-and-clustering-the-neighborhoods-of-new-york-city-and-toronto.html" rel="alternate"/><published>2019-11-20T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-11-20:/2019/comparing-and-clustering-the-neighborhoods-of-new-york-city-and-toronto.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2019/clustnt20.png" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In this post, I will talk about a project I&amp;rsquo;ve done in order to get IBM Data Science Professional Certificate. In this project, the neighborhoods of two important cities in the world—New York City (NYC) and Toronto—were clustered into groups of similar items. One can use …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2019/clustnt20.png" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In this post, I will talk about a project I&amp;rsquo;ve done in order to get IBM Data Science Professional Certificate. In this project, the neighborhoods of two important cities in the world—New York City (NYC) and Toronto—were clustered into groups of similar items. One can use the results of this analysis to understand the similarities and differences between the two cities neighborhoods.&lt;/p&gt;
&lt;p&gt;The clustering will be based on the types (categories) of venues in the neighborhoods. Each of the resulting clusters should have neighborhoods that contain similar distribution of venues. For example, one cluster may contain neighborhoods that have many Italian restaurants, many coffee shops, and few medical centers; another cluster may contain neighborhoods with many residential buildings, many barbershops, and few Italian restaurants.&lt;/p&gt;
&lt;p&gt;This post will explain the stages and results of this project broadly. For a more in-depth description, check the &lt;a href="https://github.com/ammar1y/Clustering-and-Comparing-the-Neighborhoods-of-New-York-City-and-Toronto"&gt;project report&lt;/a&gt;. The code used to perform this project is available as a &lt;a href="https://github.com/ammar1y/Clustering-and-Comparing-the-Neighborhoods-of-New-York-City-and-Toronto"&gt;Jupyter notebook&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="data-acquisition-and-preparation"&gt;Data Acquisition and Preparation&lt;/h2&gt;
&lt;p&gt;Since clustering will be based on the categories of venues in the neighborhoods, we need data that specifies the venues in the neighborhoods and their categories. Of course we, in the first place, need a list of the neighborhoods of NYC and Toronto. &lt;/p&gt;
&lt;p&gt;The figure below shows a map of NYC with its neighborhoods represented as orange circles on the left side and a map of Toronto with its neighborhoods represented as green circles on the right side.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt13.png"&gt;&lt;/p&gt;
&lt;p&gt;To acquire data on venues and their categories, Foursquare API is used. Foursquare is one of the world largest sources of location and venue data. To retrieve the venues and their categories in a given neighborhood, the coordinates—the latitude and the longitude—of the neighborhood are sent in the API request. The API-request URL looks like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://api.foursquare.com/v2/venues/search? &amp;amp;client_id=1234&amp;amp;client_secret=1234&amp;amp;v=20180605&amp;amp; ll=40.89470517661,-73.84720052054902&amp;amp;radius=500&amp;amp;limit=100
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;where search indicates the API endpoint used, client_id and client_secret are credentials used to access the API service and are obtained when registering a Foursquare developer account, v indicates the API version to use, ll indicates the latitude and longitude of the desired location, radius is the maximum distance in meters between the specified location and the retrieved venues, and limit is used to limit the number of returned results if necessary.&lt;/p&gt;
&lt;p&gt;The result of this data-acquisition-and-preparation stage is two tables (dataframes) that specify the neighborhoods and the venues of each of NYC and Toronto. Below is a part of the NYC table. In these tables, one neighborhood might take many rows depending on the number of retrieved venues for that neighborhood. &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt16.png"&gt;&lt;/p&gt;
&lt;p&gt;Several data-preparation techniques were used to arrive at this table. The details are all specified in the &lt;a href="https://github.com/ammar1y/Clustering-and-Comparing-the-Neighborhoods-of-New-York-City-and-Toronto"&gt;project report&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="exploratory-data-analysis"&gt;Exploratory Data Analysis&lt;/h2&gt;
&lt;p&gt;To get a better understanding of the venues data, we performed some exploratory analysis. In this analysis, we found the most common and the most widespread venue categories in NYC and Toronto. &lt;/p&gt;
&lt;p&gt;To explain the difference between &amp;ldquo;most common&amp;rdquo; and &amp;ldquo;most widespread&amp;rdquo;, we use an example: Suppose that there are 15 venues with the category “VR Games” and that these venues exist in 7 neighborhoods only out of 80 neighborhoods; also suppose that there are 10 venues with the category “Syrian Restaurant” and that these venues exist in 10 neighborhoods—each one of them in a different neighborhood. Then it can be said that the “VR Games” category is more com- mon than “Syrian Restaurant” category because there are more venues under this category, and it can be said that the “Syrian Restaurant” category is more widespread than the “VR Games” category because venues under this category exist in more neighborhoods than the other category. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; Before proceeding with exploratory data analysis and the subsequent steps, a data-preparation operation was performed: venues whose category is “Building”, “Office”, “Bus Line”, “Bus Station”, “Bus Stop”, or “Road” were excluded because they are not expected to add analytical value in this project. &lt;/p&gt;
&lt;p&gt;The figures below shows the most common venue categories in NYC.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt2.png"&gt;&lt;/p&gt;
&lt;p&gt;The figures below shows the most common venue categories in Toronto.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt3.png"&gt;&lt;/p&gt;
&lt;p&gt;The figures below shows the most widespread venue categories in NYC.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt4.png"&gt;&lt;/p&gt;
&lt;p&gt;The figures below shows the most widespread venue categories in Toronto.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt5.png"&gt;&lt;/p&gt;
&lt;h2 id="clustering-of-neighborhoods"&gt;Clustering of Neighborhoods&lt;/h2&gt;
&lt;p&gt;To perform clustering, we need to feed the clustering algorithm with features in appropriate format. The data format that we saw above—show also below—is not suitable for the clustering algorithm. &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt16.png"&gt;&lt;/p&gt;
&lt;p&gt;Since that we care most about the categories of the venues in the neighborhoods, &lt;a href="https://www.google.com/search?q=one-hot+encoding"&gt;one-hot encoding&lt;/a&gt; will be performed on the &amp;ldquo;Venue Category&amp;rdquo; field in the dataframe (table) shown above. A sample of the resulting dataframe of NYC is shown below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt6.png"&gt;&lt;/p&gt;
&lt;p&gt;The next step is aggregating the values for each neighborhood so that each neighborhood becomes represented by only one row. The aggregation will be done by grouping rows by neighborhood and by taking the mean of the frequency of occurrence of each category. So for example, if the Fieldston neighborhood has 15 venues (i.e. 15 rows in the dataframe shown above) and 4 of these venues are of the “Sandwich Place” category, then Fieldston row in the aggregated dataframe will have the value 4/15 = 0.27 for the “Sandwich Place” column. The figure below shows the aggregated dataframe of NYC.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt7.png"&gt;&lt;/p&gt;
&lt;p&gt;Now, we have two aggregated dataframes, one for NYC and another for Toronto. The next step is combining these two dataframes together while adding a suffix to the names of the neighborhoods to still be able to distinguish between NYC neighborhoods and Toronto neighborhoods. The figure below shows a sample of the combined dataframe.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt8.png"&gt;&lt;/p&gt;
&lt;p&gt;After that, clustering is applied. The clustering algorithm used is the K-means algorithm of Scikit-learn package and number of clusters is chosen to be 5 clusters.  The output of clustering is a label for each neighborhood indicating to which cluster this neighborhood belongs. The figure below shows a sample of a dataframe created with the cluster labels.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt9.png"&gt;&lt;/p&gt;
&lt;p&gt;We added columns that show the most common venue categories in each neighborhood along with its cluster label. &lt;/p&gt;
&lt;h3 id="cluster-analysis"&gt;Cluster Analysis&lt;/h3&gt;
&lt;p&gt;The table below shows the number of neighborhoods in each cluster.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt10.png"&gt;&lt;/p&gt;
&lt;p&gt;And the plot below shows the number of NYC neighborhoods and the number of Toronto neighborhoods in each cluster.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt11.png"&gt;&lt;/p&gt;
&lt;p&gt;The tables below show the most common venue categories in the neighborhoods of each cluster with the percentage of venues for each category.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/clustnt12.png"&gt;&lt;/p&gt;
&lt;p&gt;The differences between the clusters can be seen from the figure; each cluster distinguishably has different distribution of common venue categories than other clusters. Some of the observations that can be made are: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;While residential buildings constitute ~9% of venues in the neighborhoods of the first cluster, they constitute ~2% of the venues in the second and third clusters, ~4% of the venues in the fourth cluster, and 21% of the venues in the fifth cluster. &lt;/li&gt;
&lt;li&gt;Pizza places appear in the most common categories of the second, third, and fourth clusters only. &lt;/li&gt;
&lt;li&gt;Chinese restaurants appear in the most common categories of the third cluster only. &lt;/li&gt;
&lt;li&gt;Automative shops appear in the most common categories of the second cluster only; moreover, “Automative Shop” is the most popular category in that cluster. &lt;/li&gt;
&lt;li&gt;Doctor and dentist offices constitute ~18% of fourth-cluster venues while they constitute only 2% of each of the second-cluster and fifth-cluster venues.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Other differences can also be observed.&lt;/p&gt;
&lt;p&gt;To see the full detailed report of the analysis, &lt;a href="https://github.com/ammar1y/Clustering-and-Comparing-the-Neighborhoods-of-New-York-City-and-Toronto"&gt;click here&lt;/a&gt;, and to access the Jupyter notebook that contains all the code used in this project, &lt;a href="https://github.com/ammar1y/Clustering-and-Comparing-the-Neighborhoods-of-New-York-City-and-Toronto"&gt;click here&lt;/a&gt;.&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="machine-learning"/><category term="data-analysis"/><category term="data-visualization"/><category term="data-science-project"/><category term="clustering"/></entry><entry><title>Everyone Communicates, Few Connect - Book Notes</title><link href="https://ammar-alyousfi.com/2019/everyone-communicates-few-connect-book-notes.html" rel="alternate"/><published>2019-10-06T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-10-06:/2019/everyone-communicates-few-connect-book-notes.html</id><summary type="html">&lt;p&gt;In this post, I will share the notes that I&amp;rsquo;ve extracted for myself from &amp;ldquo;Everyone Communicates, Few Connect&amp;rdquo; by John C. Maxwell. I read the book because I realized that I&amp;rsquo;m not a good communicator with new people in my life, maybe because of my introverted personality. Let …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In this post, I will share the notes that I&amp;rsquo;ve extracted for myself from &amp;ldquo;Everyone Communicates, Few Connect&amp;rdquo; by John C. Maxwell. I read the book because I realized that I&amp;rsquo;m not a good communicator with new people in my life, maybe because of my introverted personality. Let&amp;rsquo;s begin.&lt;/p&gt;
&lt;p&gt;&lt;img src="/assets/images/2019/every-comm-1.jpg" width="300" style="border:1px solid #333333"&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.goodreads.com/book/show/29372448-everyone-communicates-few-connect"&gt;Book page on Goodreads&lt;/a&gt; | My rating: 3/5&lt;/p&gt;
&lt;p&gt;Why learning to connect? the author claims the following benefits of connecting with people:&lt;/p&gt;
&lt;p&gt;Maybe you are the most skilled person in an area at work, yet you never get promoted. Or you work hard and produce, but others don’t seem to appreciate what you do. Or maybe you desire to build relationships with people around you, but they don’t seem to listen to you the way they do to others. Or you want to create an effective team—or just become part of a good team—but you are made to feel like an outsider. What’s the problem? It’s connection. To succeed with other people, you need to be able to connect.&lt;/p&gt;
&lt;p&gt;In connecting one-on-one: talk &lt;strong&gt;more about the other person&lt;/strong&gt; and less about yourself. Prepare two or three &lt;strong&gt;questions&lt;/strong&gt; you can ask someone before a meeting or social gathering. Bring something of value, such as a helpful quote, story, book, or CD, to &lt;strong&gt;give&lt;/strong&gt; to someone when you get together. At the close of a conversation, ask if there is anything you can do to help them and then follow through.&lt;/p&gt;
&lt;p&gt;Show that you genuinely care; try to see thing from the &lt;strong&gt;perspective&lt;/strong&gt; of others.&lt;/p&gt;
&lt;p&gt;Connecting is all about others: you can connect with others if you’re willing to &lt;strong&gt;get off your own agenda&lt;/strong&gt;, to think about others, and to try to understand who they are and what they want.&lt;/p&gt;
&lt;p&gt;Find what they value and find out why; share your own values that are similar to theirs; build the relationship on these &lt;strong&gt;common values&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Even people who take pride in wearing a poker face and who work hard not to crack a smile or let others know what they’re thinking are conveying a message to others—&lt;strong&gt;detachment&lt;/strong&gt;. And that makes connecting with others nearly impossible. If your face is going to “talk” for you anyway, you might as well have it communicate something positive.&lt;/p&gt;
&lt;p&gt;🌟 &lt;strong&gt;Ten tips&lt;/strong&gt; when meeting new people from author and communication coach Susan RoAne. She says magnificent minglers:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Possess the ability to make others feel comfortable&lt;/li&gt;
&lt;li&gt;Appear to be confident and at ease&lt;/li&gt;
&lt;li&gt;Have an ability to laugh at themselves (not at others)&lt;/li&gt;
&lt;li&gt;Show interest in others; they maintain eye contact, self-disclose, ask questions, and actively listen&lt;/li&gt;
&lt;li&gt;Extend themselves to others; they lean into a greeting with a firm handshake and a smile&lt;/li&gt;
&lt;li&gt;Convey a sense of energy and enthusiasm—a joie de vivre&lt;/li&gt;
&lt;li&gt;Are well rounded, well informed, and well-mannered&lt;/li&gt;
&lt;li&gt;Prepare vignettes or stories of actual occurrences that are interesting, humorous, and appropriate&lt;/li&gt;
&lt;li&gt;Introduce people to each other with an infectious enthusiasm (there is no other kind) that motivates conversation between the introducees&lt;/li&gt;
&lt;li&gt;Convey respect and genuinely like people—the core of communicating&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" Talking It Over by Enoch Wood Perry, 1872" src="/assets/images/2019/every-comm-2.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Connecting always requires &lt;strong&gt;energy&lt;/strong&gt;: use your energy to focus on others and reach out to them.&lt;/p&gt;
&lt;p&gt;It has been my experience that &lt;strong&gt;&lt;u&gt;the perfect moment never arrives&lt;/u&gt;&lt;/strong&gt;. Initiating a conversation with someone often feels awkward. Offering help to someone means risking rejection. Giving to others can lead to misunderstanding. You won’t feel ready or comfortable in those moments. You just have to learn to get past those feelings of awkwardness or insecurity.&lt;/p&gt;
&lt;p&gt;Early in my career, I wanted to do things as quickly as possible and move on to the next thing. If someone didn’t want to move at my speed, I breezed right past him or her. But that leadership style hindered my ability to connect with others, and my relationships suffered. The good news was that I moved fast. The bad news was that &lt;strong&gt;I often moved alone&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Communicating with people can be very &lt;strong&gt;taxing&lt;/strong&gt; physically, mentally, and emotionally. You must also figure out what kinds of things fill your tank and leave you energized. I am &lt;strong&gt;recharged&lt;/strong&gt; by a good massage, a round of golf, a change of pace, or prayer during my daily swim. And my favorite is spending a day with Margaret with no agenda. Pay attention to what charges your batteries and start making it part of your schedule.&lt;/p&gt;
&lt;p&gt;If you want to increase your odds of connecting with others, then one of the choices to make everyday is to be &lt;strong&gt;available&lt;/strong&gt;; choose to spend time with others. Another choice is openness; decide to let people into your life.&lt;/p&gt;
&lt;p&gt;Television host Larry King, who has conducted thousands of interviews, says that &lt;strong&gt;asking questions is the secret of every good conversation&lt;/strong&gt;. “I’m curious about everything,” writes King in How to Talk to Anyone, Anytime, Anywhere, “and if I’m at a cocktail party, I often ask my favorite question: &amp;lsquo;&lt;strong&gt;Why?&lt;/strong&gt;&amp;rsquo; If a man tells me he and his family are moving to another city: &amp;lsquo;Why?&amp;rsquo; A woman is changing jobs: &amp;lsquo;Why?&amp;rsquo;&amp;hellip;&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2019/every-comm-3.png"&gt;&lt;/p&gt;
&lt;p&gt;If you aren’t especially outgoing or have a difficult time asking questions, you can use this trick that Duke Brekhus says he learned from Ron Puryear. Remember the word FORM, which stands for family, occupation, recreation, and message. Duke comments, “When we ask questions centered around these topics it is amazing how much we can learn about a person and how quickly we can get to know them.&lt;/p&gt;
&lt;p&gt;Anytime you are aware of a gap between you and the people with whom you are trying to connect, it’s wise to try to move to their world mentally, if not physically, and then search for something in your own background and experience that relates to theirs.&lt;/p&gt;
&lt;p&gt;🌟 Common ground is the base of connection. To &lt;strong&gt;find common ground&lt;/strong&gt;, ask questions with an eye for common interests and experiences. When you find common ground, tell stories, share emotions, and offer lessons learned from those experiences. And if possible, do something together that you both enjoy.&lt;/p&gt;
&lt;p&gt;As I begin writing, I think, What would make me want to read about this? After I have written a chapter, I try to read it from the perspective of people who might pick the book up. What will motivate them to turn the page? What will encourage them to finish the book?&lt;/p&gt;
&lt;p&gt;I take responsibility for creating an &lt;strong&gt;experience that others will enjoy&lt;/strong&gt; when I’m with a small group of people. If we’re having dinner, I work to create good conversation. I think, What can I say to get others involved around the table? How can I draw them in? If I take friends on a trip or out for a night on the town, I try to create memories.&lt;/p&gt;</content><category term="books"/><category term="book-summary"/><category term="communication-skills"/><category term="social-skills"/></entry><entry><title>Show Your Work! Book Notes</title><link href="https://ammar-alyousfi.com/2019/show-your-work-book-notes.html" rel="alternate"/><published>2019-10-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-10-01:/2019/show-your-work-book-notes.html</id><summary type="html">&lt;p&gt;I recently finished reading &amp;ldquo;Show Your Work!&amp;rdquo; book by Austin Kleon. I liked it and I found many useful ideas in it. Here, I will share what I liked most in this book.&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/18290401-show-your-work"&gt;Show Your Work!&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Show Your Work!" src="/assets/images/2019/show-your-work.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I like the following alluring quote from the book which …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I recently finished reading &amp;ldquo;Show Your Work!&amp;rdquo; book by Austin Kleon. I liked it and I found many useful ideas in it. Here, I will share what I liked most in this book.&lt;/p&gt;
&lt;p&gt;Book page on Goodreads: &lt;a href="https://www.goodreads.com/book/show/18290401-show-your-work"&gt;Show Your Work!&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Show Your Work!" src="/assets/images/2019/show-your-work.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I like the following alluring quote from the book which talks about the benefits of showing your work:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Imagine if your next boss didn’t have to read your résumé because he already reads your blog. Imagine being a student and getting your first gig based on a school project you posted online. Imagine losing your job but having a social network of people familiar with your work and ready to help you find a new one. Imagine turning a side project or a hobby into your profession because you had a following that could support you.&lt;/p&gt;
&lt;p&gt;Or imagine something simpler and just as satisfying: spending the majority of your time, energy, and attention practicing a craft, learning a trade, or running a business, while also allowing for the possibility that your work might attract a group of people who share your interests.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The book has 10 chapters; the title of each chapter is an advice related to showing your work.&lt;/p&gt;
&lt;h3 id="1-you-dont-have-to-be-a-genius"&gt;1. You don’t have to be a genius.&lt;/h3&gt;
&lt;p&gt;Today it is the amateur—the enthusiast who pursues her work in the spirit of love, regardless of the potential for fame, money, or career —who often has the advantage over the professional. Amateurs are &lt;strong&gt;willing to try anything&lt;/strong&gt; and share the results.&lt;/p&gt;
&lt;p&gt;The world is changing at such a rapid rate that it’s turning us all into amateurs. Even for professionals, the best way to flourish is to retain an &lt;strong&gt;amateur’s spirit&lt;/strong&gt; and embrace uncertainty and the unknown.&lt;/p&gt;
&lt;p&gt;The best way to get started on the path to sharing your work is to think about what you want to learn, and make a commitment to learning it in front of others. Find a scenius, pay attention to what others are sharing, and then start taking note of &lt;strong&gt;what they’re not sharing&lt;/strong&gt;. &lt;/p&gt;
&lt;h3 id="2-think-process-not-product"&gt;2. Think process, not product.&lt;/h3&gt;
&lt;p&gt;Today, by taking advantage of the Internet and social media, an artist can share the &lt;strong&gt;day-to-day stuff&lt;/strong&gt; that goes on behind the scenes in her studio, not only the final product.&lt;/p&gt;
&lt;p&gt;We’re not all artists or astronauts. A lot of us go about our work and feel like we have nothing to show for it at the end of the day. But whatever the nature of your work, there is an art to what you do, and there are people who would be interested in that art, if only you presented it to them in the right way.&lt;/p&gt;
&lt;p&gt;Become a &lt;strong&gt;documentarian&lt;/strong&gt; of what you do. Start a work journal: Write your thoughts down in a notebook, or speak them into an audio recorder. Keep a scrapbook. Take a lot of photographs of your work at different stages in your process. Shoot video of you working&amp;hellip;&lt;/p&gt;
&lt;h3 id="3-share-something-small-every-day"&gt;3. Share something small every day.&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;form of what you share doesn’t matter&lt;/strong&gt;. Your daily dispatch can be anything you want—a blog post, an email, a tweet, a YouTube video, etc.&lt;/p&gt;
&lt;p&gt;Science fiction writer Theodore Sturgeon once said that 90 percent of everything is crap. The same is true of our own work. The trouble is, &lt;strong&gt;we don’t always know what’s good&lt;/strong&gt; and what sucks. That’s why it’s important to get things in front of others and see how they react.&lt;/p&gt;
&lt;p&gt;Social networks are great, but they come and go; nothing beats owning &lt;strong&gt;your own space&lt;/strong&gt; online.&lt;/p&gt;
&lt;p&gt;One little blog post is nothing on its own, but publish a thousand blog posts over a decade, and it turns into your life’s work.&lt;/p&gt;
&lt;h3 id="4-open-up-your-cabinet-of-curiosities"&gt;4. Open up your cabinet of curiosities.&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The problem with &lt;strong&gt;hoarding&lt;/strong&gt; is you end up living off your reserves. Eventually, you’ll become stale. If you give away everything you have, you are left with nothing. This forces you to look, to be aware, to replenish. . . . Somehow the more you give away, the more comes back to you.&lt;/p&gt;
&lt;p&gt;—Paul Arden&lt;/p&gt;
&lt;p&gt;All of us who do creative work, we get into it because we have good taste but there is this gap. For the first &lt;strong&gt;couple years&lt;/strong&gt; you make stuff, it’s just not that good. It’s trying to be good, it has potential, but it’s not&amp;hellip;&lt;/p&gt;
&lt;p&gt;—Ira Glass&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id="5-tell-good-stories"&gt;5. Tell good stories.&lt;/h3&gt;
&lt;p&gt;Artists love to trot out the tired line, “My work speaks for itself,” but the truth is, our work doesn’t speak for itself. Human beings want to know where things came from, how they were made, and who made them. The &lt;strong&gt;stories you tell about the work&lt;/strong&gt; you do have a huge effect on how people feel and what they understand about your work, and how people feel and what they understand about your work effects how they value it.&lt;/p&gt;
&lt;p&gt;Emma Coats, a former storyboard artist at Pixar, outlined the basic &lt;strong&gt;structure&lt;/strong&gt; of a fairy tale as a kind of Mad Lib that you can fill in with your own elements: “Once upon a time, there was&lt;strong&gt;&lt;em&gt;_&lt;/em&gt;_. Every day, &lt;/strong&gt;&lt;strong&gt;&lt;em&gt;_. One day, &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;. Because of that, &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;. Because of that, &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;. Until finally, &lt;/em&gt;&lt;/strong&gt;___.” Pick your favorite story and try to fill in the blanks. It’s striking how often it works.&lt;/p&gt;
&lt;h3 id="6-teach-what-you-know"&gt;6. Teach what you know.&lt;/h3&gt;
&lt;p&gt;The minute you learn something, turn around and teach it to others. Share your reading list. Point to helpful reference materials. Create some tutorials and post them online. Use pictures, words, and video. Take people &lt;strong&gt;step&lt;/strong&gt;-by-step through part of your process. As blogger Kathy Sierra says, “Make people better at something they want to be better at.”&lt;/p&gt;
&lt;h3 id="7-dont-turn-into-human-spam"&gt;7. Don’t turn into human spam.&lt;/h3&gt;
&lt;p&gt;If you’re only pointing to your own stuff online, you’re doing it wrong. You have to be a &lt;strong&gt;connector&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Albini laments how many people waste time and energy trying to make connections instead of getting good at what they do&amp;hellip;&lt;/p&gt;
&lt;p&gt;Make stuff you love and talk about stuff you love and you’ll &lt;strong&gt;attract&lt;/strong&gt; people who love that kind of stuff. It’s that simple.&lt;/p&gt;
&lt;p&gt;I love meeting my online friends “IRL.” (IRL = in real life.) There’s never any small talk—we know all about one another and what one another does.&lt;/p&gt;
&lt;h3 id="8-learn-to-take-a-punch"&gt;8. Learn to take a punch.&lt;/h3&gt;
&lt;p&gt;Now, I have been on the Internet a long time. I get a lot of emails from people who are, as far as I can tell, sad, awful, or completely insane. I have a pretty good mental firewall that filters what I let get to me.&lt;/p&gt;
&lt;h3 id="9-sell-out"&gt;9. Sell out.&lt;/h3&gt;
&lt;p&gt;Put a little virtual tip jar or a donate now button on your website. These links do well with a little bit of human copy, such as “Like this? Buy me a coffee.”&lt;/p&gt;
&lt;p&gt;If you have work you want to attempt that requires some up-front capital, platforms like Kickstarter and Indiegogo make it easy to run fund-raising campaigns with tiered rewards for donors. It’s important to note that these platforms work best when you’ve already gathered a group of people who are into what you do.&lt;/p&gt;
&lt;p&gt;When people become patrons, they feel, not altogether wrongly, that they should have some say in how their money is being used. It’s partly for this reason that my business model is still pretty old-fashioned: I make something and sell it for money.&lt;/p&gt;
&lt;p&gt;I know people who run &lt;strong&gt;multimillion&lt;/strong&gt;-dollar businesses off of their &lt;strong&gt;mailing lists&lt;/strong&gt;. The model is very simple: They give away great stuff on their sites, they collect emails, and then when they have something remarkable to share or sell, they send an email. You’d be amazed at how well the model works.&lt;/p&gt;
&lt;h3 id="10-stick-around"&gt;10. Stick around.&lt;/h3&gt;
&lt;hr&gt;
&lt;p&gt;Blog-post prompts I got from the book:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Where do you get your inspiration? What sorts of things do you fill your head with? What do you read? Do you subscribe to anything? What sites do you visit on the Internet? What music do you listen to? What movies do you see? Do you look at art? What do you collect? What’s inside your scrapbook? What do you pin to the corkboard above your desk? What do you stick on your refrigerator? Who’s done work that you admire? Who do you steal ideas from? Do you have any heroes? Who do you follow online? Who are the practitioners you look up to in your field?&lt;/p&gt;
&lt;/blockquote&gt;</content><category term="books"/><category term="creativity"/><category term="book-summary"/><category term="portfolio"/></entry><entry><title>وأظلمت المدينة - مقتطفات من كتاب</title><link href="https://ammar-alyousfi.com/ar/2019/and-madinah-darkened.html" rel="alternate"/><published>2019-09-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-09-27:/ar/2019/and-madinah-darkened.html</id><summary type="html">&lt;h1 id="-"&gt;وأظلمت المدينة - مقتطفات من كتاب&lt;/h1&gt;
&lt;p&gt;&lt;img class="featured-image"
  src="/assets/images/2019/madinah-darkened.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;قرأت كتاب &amp;ldquo;وأظلمت المدينة&amp;rdquo; لنزار الريان وهو كتاب قليل الصفحات يسرد وقائع أيام وفاة النبي صلى الله عليه وسلم بناء على الأحاديث الصحيحة والحسنة فقط. في هذا المنشور سأشارك بعض ما أثار اهتمامي أو أثر بي في هذا الكتاب.&lt;/p&gt;
&lt;p&gt;كان آخر شيء أوصى به عليه …&lt;/p&gt;</summary><content type="html">&lt;h1 id="-"&gt;وأظلمت المدينة - مقتطفات من كتاب&lt;/h1&gt;
&lt;p&gt;&lt;img class="featured-image"
  src="/assets/images/2019/madinah-darkened.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;قرأت كتاب &amp;ldquo;وأظلمت المدينة&amp;rdquo; لنزار الريان وهو كتاب قليل الصفحات يسرد وقائع أيام وفاة النبي صلى الله عليه وسلم بناء على الأحاديث الصحيحة والحسنة فقط. في هذا المنشور سأشارك بعض ما أثار اهتمامي أو أثر بي في هذا الكتاب.&lt;/p&gt;
&lt;p&gt;كان آخر شيء أوصى به عليه الصلاة والسلام “الصلاة وما ملكت أيمانكم”. هل كون هذه آخر الوصايا يجعل هذين الأمرين - أي الصلاة وملك اليمين - في غاية الأهمية؟ غالباً نعم. ذهب ملك اليمين ولم يبق إلا الصلاة نتمسك بها. لكن لماذا ملك اليمين - دون غيره - مع الصلاة؟&lt;/p&gt;
&lt;p&gt;لفت نظري أيضاً قول أحد الصحابة (سيدنا أنس بن مالك) أنهم أنكروا قلوبهم بعد دفن النبي صلى الله عليه وسلم أي أحسوا بتغيرها وأحسوا بنقص الصفاء والنورانية التي كانت في حال حضوره الأنور وقال صحابي آخر (سيدنا أبي بن كعب): “كنا مع رسول الله صلى الله عليه وسلم وإنما وجهنا واحد، فلما قبض نظرنا هكذا وهكذا”.&lt;/p&gt;
&lt;p&gt;أحسست بألم الصحابة وإحساسهم بفقدان النبي صلى الله عليه وسلم؛ تخيلت نفسي في ذلك الزمان وتخيلت ألمي وحزني وإحساسي بعد فقد من كان وجوده رحمة ونوراً وأماناً وهدى. قرأت كيف بكى سيدنا ابن عباس حتى بلل الأرض عندما كان يحكي عن اشتداد وجع رسول الله صلى الله عليه وسلم “يوم الخميس، وما يوم الخميس؟!” وكيف بكى سيدنا أبو بكر على المنبر عندما بدأ يحكي عن حادثة في عهد النبي صلى الله عليه وسلم وكيف كان يبكي كلما أراد أن يذكر الحادثة. &lt;/p&gt;
&lt;p&gt;قرأت حديث أبي مويهبة مولى رسول الله صلى الله عليه وسلم: “أنبَهني رسولُ اللهِ صلَّى اللهُ عليْهِ وسلَّمَ منَ اللَّيلِ فقالَ : يا أبا مويْهِبةَ إنِّي قد أُمِرتُ أن أستغفرَ لأَهلِ البقيعِ ، فرفعَ يديْهِ ، فاستَغفرَ لَهم طويلًا ثمَّ قالَ : ليَهْنَ لَكم ما أصبَحتُم فيهِ مِمَّا أصبحَ فيهِ النَّاسُ ، أقبلتِ الفتنُ كقِطَعِ اللَّيلِ المظلِمِ ، يتبعُ آخرُها أوَّلَها ، الآخرةُ شرٌّ منَ الأولى ، يا أبا مويْهبةَ إنِّي قد أعطيتُ مفاتيحَ خزائنِ الدُّنيا والخُلدَ فيها ثمَّ الجنَّةَ ، فخيِّرتُ بينَ ذلِكَ وبينَ لقاءِ ربِّي والجنَّةِ فقلتُ : يا رسولَ اللهِ بأبي أنتَ وأمِّي ، فخُذ مفاتيحَ الدُّنيا والخُلدَ فيها ثمَّ الجنَّةَ فقالَ : واللهِ يا أبا مويْهبةَ لقدِ اخترتُ لقاءَ ربِّي والجنَّةَ . ثمَّ انصرفَ رسولُ اللهِ صلَّى اللهُ عليْهِ وسلَّمَ . فلمَّا أصبحَ ابتُدئَ بوجعِهِ الَّذي قبضَهُ اللهُ فيهِ”&lt;/p&gt;
&lt;p&gt;قرأت عن الرائحة التي لم تشم السيدة عائشة أطيب منها عندما فاضت روح النبي صلى الله عليه وسلم.&lt;/p&gt;
&lt;p&gt;سعدت لما قرأت قول النبي صلى الله عليه وسلم للسيدة فاطمة بعد أن قالت “واكرب أباه” لما شاهدت ما يصيبه في مرضه “ليس على أبيك كرب بعد اليوم”.&lt;/p&gt;
&lt;p&gt;&lt;span style="color:gold; background:#003049; font-weight:bold"&gt; صلى الله عليه وسلم &lt;/span&gt;&lt;/p&gt;</content><category term="كتب"/><category term="الإسلام"/><category term="ملخص-كتاب"/><category term="سيرة"/><category term="وفاة-النبي"/></entry><entry><title>My Approach to Solve Kaggle's VSB Power Line Fault Detection Competition</title><link href="https://ammar-alyousfi.com/2019/my-approach-to-solve-kaggle-vsb-power-line-fault-detection-competition.html" rel="alternate"/><published>2019-03-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-03-27:/2019/my-approach-to-solve-kaggle-vsb-power-line-fault-detection-competition.html</id><summary type="html">&lt;p class="featured-image"&gt;&lt;img
    src="/assets/images/2019/vsbsol3.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;In this document, I will briefly explain my way of solving the VSB Power Line Fault
  Detection competition. The metric used in that competition was Matthews correlation
  coefficient (MCC) between the predicted and the observed response. My final score was
  0.58655; the best score was 0.71899 (a difference …&lt;/p&gt;</summary><content type="html">&lt;p class="featured-image"&gt;&lt;img
    src="/assets/images/2019/vsbsol3.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;In this document, I will briefly explain my way of solving the VSB Power Line Fault
  Detection competition. The metric used in that competition was Matthews correlation
  coefficient (MCC) between the predicted and the observed response. My final score was
  0.58655; the best score was 0.71899 (a difference of 0.13244); the worst score was
  -0.28109.&lt;/p&gt;
&lt;p&gt;The goal of the competition was to detect partial discharge patterns in signals
  acquired from power lines. The competition data consists of 800,000 readings for around
  29,000 signals (8712 for training and the rest for testing). For each signal, we need to
  determine if it has a partial discharge or not. The signal data contains a lot of
  background noise according to the competition organizers.&lt;/p&gt;
&lt;h1 data-breakpage&gt;1. Exploratory Data Analysis (EDA)&lt;/h1&gt;
&lt;p&gt;EDA is the process that I started with and continued using throughout the competition
  to understand the data, to spot some useful patterns, and to choose proper parameters
  for some functions.&lt;/p&gt;
&lt;p&gt;The image below shows the 3 phases of some signal:&lt;/p&gt;
&lt;p&gt;&lt;img
    src='/assets/images/2019/vsbsol1.png'
    alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;h1 data-breakpage&gt;2. The Submission Code&lt;/h1&gt;
&lt;p&gt;The submission code is the code used to produce the submission file that competitors
  submit to Kaggle. &lt;/p&gt;
&lt;h2&gt;Reading the Data&lt;/h2&gt;
&lt;p&gt;The signal readings were provided in &lt;a
    href='https://en.wikipedia.org/wiki/Apache_Parquet'&gt;Parquet format&lt;/a&gt; which is a
  column-oriented storage format of the Apache Hadoop ecosystem. To read this data in
  Python and store it Pandas dataframe, we used a function from &lt;code&gt;pyarrow&lt;/code&gt;
  package, then transposed the output of the function to get a row-oriented storage
  format. &lt;/p&gt;
&lt;h2&gt;Feature Engineering&lt;/h2&gt;
&lt;p&gt;This is the most important part and the one that took most of the time. Because each of
  the signals has 800,000 readings, it&amp;#39;s essential that we extract features from those
  readings in order to build a proper training and test datasets. Training a model with
  800,000 features is not feasible with the machines that we have access to. In this part,
  for each of the training and test signals, I did the following:&lt;/p&gt;
&lt;h3&gt;Signal Filtering&lt;/h3&gt;
&lt;p&gt;All the operations described below are done after filtering the signals that contain a
  lot of noise as described above. To do so, we applied &lt;a
    href='http://scikit-image.org/docs/dev/auto_examples/filters/plot_denoise_wavelet.html'&gt;Scikit-image&amp;#39;s
    wavelet denoising&lt;/a&gt; followed by &lt;a
    href='https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html'&gt;Scipy&amp;#39;s
    Butterworth filter&lt;/a&gt;. The image below shows the same signal before filtering (in
  orange) and after filtering (in blue). The overlapping is shown in dark red:&lt;/p&gt;
&lt;p&gt;&lt;img
    src='/assets/images/2019/vsbsol2.png'
    alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;h3&gt;Peak Calculation&lt;/h3&gt;
&lt;p&gt;I used Scipy&amp;#39;s &lt;code&gt;scipy.signal.find_peaks&lt;/code&gt; function to extract useful
  features from the signals. Here is a part of &lt;a
    href='https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html'&gt;Scipy
    documentation about &lt;code&gt;find_peaks&lt;/code&gt;&lt;/a&gt; function:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Find peaks inside a signal based on peak properties.&lt;/p&gt;
  &lt;p&gt;This function takes a one-dimensional array and finds all local maxima by simple
    comparison of neighbouring values. Optionally, a subset of these peaks can be selected
    by specifying conditions for a peak’s properties.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I used this function with different parameter combinations. For example, one time I
  used it to find peaks in the signal whose height is more than 5; another time for when
  the height is bigger than 15; another for when peak height is bigger than 15 and the
  horizontal distance between neighboring peaks is more than 25 samples; another for when
  peak height is bigger than 25 and peak width is more than 10 samples; etc. I also used
  Scipy&amp;#39;s &lt;code&gt;scipy.signal.peak_prominences&lt;/code&gt; and
  &lt;code&gt;scipy.signal.peak_widths&lt;/code&gt; to get the maximum and minimum peak prominence and
  width. This gave us around 140 features.&lt;/p&gt;
&lt;p&gt;I performed the peak calculation process described above to calculate negative peaks.
  For example, to get the peaks whose height is bigger than 5 (positive peaks), you would
  write:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;scipy.signal.find_peaks(signal, height=(5, None))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But if you want the corresponding negative peaks (peaks whose height is smaller than
  -5), you would write:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;scipy.signal.find_peaks(signal, height=(None, -5))
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Signal Statistical Info&lt;/h3&gt;
&lt;p&gt;I used Numpy to calculate some statistics of the signals like the mean, standard
  deviation, minimum, maximum, skewness, 30th percentile, 70th percentile, etc.&lt;/p&gt;
&lt;h3&gt;Feature Selection&lt;/h3&gt;
&lt;p&gt;I used LightGBM&amp;#39;s &lt;code&gt;feature_importance&lt;/code&gt; function to get the most
  important features so instead of around 300 features, we selected the most important 68
  features and then added features that represent the subtraction of some features from
  others; that&amp;#39;s because we calculated peak information for positive and negative
  peaks, so I figured that it might be useful to subtract the features of negative peaks
  from the features of positive peaks.&lt;/p&gt;
&lt;h2&gt;Modeling&lt;/h2&gt;
&lt;p&gt;For modeling, I used multiple classification models where each model predicts the
  probability of the existence of partial discharge in some signal, then the probabilities
  produced by all models are added and averaged (weighted average), and finally, a
  threshold value is used to convert the final probability to 0 or 1 (for example, if the
  probability is less than 0.51, then 1, else 0).&lt;/p&gt;
&lt;p&gt;The models used are: LightGBM, XGBoost, CatBoost, Scikit-learn&amp;#39;s K Nearest
  Neighbors, Scikit-learn&amp;#39;s Neural Network, Scikit-learn&amp;#39;s Logistic Regression,
  Scikit-learn&amp;#39;s Gaussian Naive Bayes.&lt;/p&gt;
&lt;p&gt;The code used is available in &lt;a
    href='https://github.com/ammar1y/My-Solution-to-VSB-Power-Line-Fault-Detection-Competition'&gt;this
    Github repository&lt;/a&gt;. First &lt;code&gt;final_v1&lt;/code&gt; is run and the resulting dataframe
  is stored, then the same for &lt;code&gt;final_v2&lt;/code&gt;, and finally &lt;code&gt;final_sub&lt;/code&gt;
  is run which use the dataframes produced by the former two.&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="kaggle"/><category term="machine-learning"/><category term="python"/><category term="data-science-project"/></entry><entry><title>Lesser-Known Yet Beautiful Google Fonts</title><link href="https://ammar-alyousfi.com/2019/lesser-known-yet-beautiful-google-fonts.html" rel="alternate"/><published>2019-03-24T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-03-24:/2019/lesser-known-yet-beautiful-google-fonts.html</id><summary type="html">&lt;p class="featured-image"&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/gfont1.png" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://fonts.google.com/"&gt;Google Fonts&lt;/a&gt; is a library of open-source fonts,
  an interactive web directory for browsing the library, and APIs for conveniently using
  the fonts in websites and more. Google Fonts has now 915 fonts with more than &lt;strong&gt;28
    trillion&lt;/strong&gt; views. Anyone can download any font and use it in his work …&lt;/p&gt;</summary><content type="html">&lt;p class="featured-image"&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/gfont1.png" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://fonts.google.com/"&gt;Google Fonts&lt;/a&gt; is a library of open-source fonts,
  an interactive web directory for browsing the library, and APIs for conveniently using
  the fonts in websites and more. Google Fonts has now 915 fonts with more than &lt;strong&gt;28
    trillion&lt;/strong&gt; views. Anyone can download any font and use it in his work.&lt;/p&gt;

&lt;p&gt;On Google Fonts, there are some very popular fonts like Roboto, Open Sans, Lato,
  Montserrat, etc. For example, Open Sans was served by Google Fonts API around 30 billion
  times in the last week as it&amp;#39;s stated on Google Fonts website today.&lt;/p&gt;

&lt;p&gt;But I think that not all great fonts are popular. I built a web application (&lt;a
    href="https://pairandcompare.net/"&gt;Pair &amp;amp; Compart&lt;/a&gt;) last year to make it easier
  to try and compare different Google fonts without downloading or installing them. I
  recently used it to choose a font for some parts of my resume. During the process, I
  discovered some beautiful fonts that I&amp;#39;d like to share them here.&lt;/p&gt;

&lt;p&gt;For each font, I will list the font name, a picture showing the font in action with the
  following CSS properties:&lt;/p&gt;

&lt;pre&gt;
&lt;code class="language-css" lang="css"&gt;font-size: 32px;
line-height: 2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;, a link to the font page on Google Fonts where you can download the font or get a link
  for using it in your website, and some info or opinions about the font.&lt;/p&gt;

&lt;h2&gt;Josefin Sans&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/2-jose.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Josefin+Sans"
    target="_blank"&gt;https://fonts.google.com/specimen/Josefin+Sans&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This font is the Google font that is most similar to Futura font in my experience.
  It&amp;#39;s suitable for big text.&lt;/p&gt;

&lt;h4&gt;Similar Google Font: Reem Kufi&lt;/h4&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/3-reem.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Reem+Kufi"
    target="_blank"&gt;https://fonts.google.com/specimen/Reem+Kufi&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Averia Serif Libre&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/4-ave.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url"
    href="https://fonts.google.com/specimen/Averia+Serif+Libre"
    target="_blank"&gt;https://fonts.google.com/specimen/Averia+Serif+Libre&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Work Sans&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/5-work.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Work+Sans"
    target="_blank"&gt;https://fonts.google.com/specimen/Work+Sans&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Balthazar&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/6-balth.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Balthazar"
    target="_blank"&gt;https://fonts.google.com/specimen/Balthazar&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Fredericka the Great&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/7-fred.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url"
    href="https://fonts.google.com/specimen/Fredericka+the+Great"
    target="_blank"&gt;https://fonts.google.com/specimen/Fredericka+the+Great&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Vollkorn&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/8-vol.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Vollkorn"
    target="_blank"&gt;https://fonts.google.com/specimen/Vollkorn&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Charm&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/9-charm.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Charm"
    target="_blank"&gt;https://fonts.google.com/specimen/Charm&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Milonga&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/10-milon.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Milonga"
    target="_blank"&gt;https://fonts.google.com/specimen/Milonga&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Spectral&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/11-spec.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Spectral"
    target="_blank"&gt;https://fonts.google.com/specimen/Spectral&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Cormorant Upright&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/12-cor.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url"
    href="https://fonts.google.com/specimen/Cormorant+Upright"
    target="_blank"&gt;https://fonts.google.com/specimen/Cormorant+Upright&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Fondamento&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/13-fond.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Fondamento"
    target="_blank"&gt;https://fonts.google.com/specimen/Fondamento&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Sofia&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/14-sof.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Sofia"
    target="_blank"&gt;https://fonts.google.com/specimen/Sofia&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Amita&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/15-amita.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Amita"
    target="_blank"&gt;https://fonts.google.com/specimen/Amita&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Bellefair&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/16-belle.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Bellefair"
    target="_blank"&gt;https://fonts.google.com/specimen/Bellefair&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Dancing Script&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/17-dan.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url"
    href="https://fonts.google.com/specimen/Dancing+Script"
    target="_blank"&gt;https://fonts.google.com/specimen/Dancing+Script&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Montez&lt;/h2&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/18-montez.png" /&gt;
&lt;/p&gt;

&lt;p&gt;Google Fonts link: &lt;a class="url" href="https://fonts.google.com/specimen/Montez"
    target="_blank"&gt;https://fonts.google.com/specimen/Montez&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;</content><category term="design"/><category term="fonts"/><category term="typography"/><category term="web-design"/><category term="web-fonts"/></entry><entry><title>My Problem With Kaggle Competitions</title><link href="https://ammar-alyousfi.com/2019/my-problem-with-kaggle-competitions.html" rel="alternate"/><published>2019-03-24T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-03-24:/2019/my-problem-with-kaggle-competitions.html</id><summary type="html">&lt;p class="featured-image"&gt;&lt;img
    src="/assets/images/2019/race.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;For those who don&amp;#39;t know &lt;a href='https://www.kaggle.com/docs/competitions'&gt;Kaggle
    Competitions&lt;/a&gt;: they are machine-learning competitions where multiple teams (or
  individuals) compete for the best score.&lt;/p&gt;
&lt;p&gt;My problem is shown in the following three screenshots of the final ranking (the
  leaderboard) for three Kaggle competitions:&lt;/p&gt;
&lt;p&gt;&lt;a
    href='https://www.kaggle.com/c/predicting-red-hat-business-value/leaderboard'&gt;Predicting
    Red Hat Business Value:&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
    src='/assets/images/2019/kg1.png'
    alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href='https://www.kaggle.com/c/pubg-finish-placement-prediction/leaderboard'&gt;PUBG
    Finish Placement Prediction …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;p class="featured-image"&gt;&lt;img
    src="/assets/images/2019/race.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;For those who don&amp;#39;t know &lt;a href='https://www.kaggle.com/docs/competitions'&gt;Kaggle
    Competitions&lt;/a&gt;: they are machine-learning competitions where multiple teams (or
  individuals) compete for the best score.&lt;/p&gt;
&lt;p&gt;My problem is shown in the following three screenshots of the final ranking (the
  leaderboard) for three Kaggle competitions:&lt;/p&gt;
&lt;p&gt;&lt;a
    href='https://www.kaggle.com/c/predicting-red-hat-business-value/leaderboard'&gt;Predicting
    Red Hat Business Value:&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
    src='/assets/images/2019/kg1.png'
    alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href='https://www.kaggle.com/c/pubg-finish-placement-prediction/leaderboard'&gt;PUBG
    Finish Placement Prediction&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
    src='/assets/images/2019/kg2.png'
    alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href='https://www.kaggle.com/c/ga-customer-revenue-prediction/leaderboard'&gt;Google
    Analytics Customer Revenue Prediction competition:&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
    src='/assets/images/2019/kg3.png'
    alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;What do you notice in these screenshots?&lt;/p&gt;
&lt;p&gt;The difference in score that allows somebody to win a competition is &lt;em&gt;tiny&lt;/em&gt; and
  not practical in my opinion. Let&amp;#39;s take the Predicting Red Hat Business Value
  competition as an example. In this competition, participants are asked to identify which
  customers have the most potential business value for Red Hat based on their
  characteristics and activities; they are required to assign a probability (between 0 and
  1) to each customer. The metric used for evaluation is &lt;a
    href='http://en.wikipedia.org/wiki/Receiver_operating_characteristic'&gt;area under the
    ROC curve&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;We can see in the leaderboard that the score of the third team is 0.99459 while the
  score of the fourth team is 0.99400. The small difference between these two scores ( =
  &lt;strong&gt;0.00059&lt;/strong&gt;) qualified one to win the competition and deprived the other of
  that.&lt;/p&gt;
&lt;p&gt;Moreover, the difference between the first-ranked participant and the 300th-participant
  is only 0.00343. Does a difference of 0.00059 really reflect a practical difference
  between the two solutions? I doubt that.&lt;/p&gt;
&lt;h2&gt;So is there an alternative?&lt;/h2&gt;
&lt;p&gt;I think that a better alternative would be to define score ranges for evaluation. For
  example, for the Predicting Red Hat Business Value competition, consider those whose
  scores are higher than 0.992 as the winners of the competition, those whose scores are
  higher than 0.9917 as gold-medal winners, and so on. This will leave us with 94
  competition winners and 150 gold-medal winners for example (the number of participants
  in this competition was 2271). &lt;/p&gt;
&lt;p&gt;And for money prize, the current approach can be followed where the first three get the
  money since it is not reasonable to distribute it to 94 teams.&lt;/p&gt;
&lt;p&gt;I think that this alternative encourages the development of more generalized models,
  and it will allow people with similar skill levels to have similar rank in the
  competition as well. This is what I think at the moment based on my understanding of
  Kaggle competitions.&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="kaggle"/><category term="machine-learning"/></entry><entry><title>House Price Prediction: An End-to-End Machine Learning Project</title><link href="https://ammar-alyousfi.com/2019/house-price-prediction-an-end-to-end-machine-learning-project.html" rel="alternate"/><published>2019-03-10T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-03-10:/2019/house-price-prediction-an-end-to-end-machine-learning-project.html</id><summary type="html">&lt;p class="featured-image"&gt;&lt;img
    src="/assets/images/2019/header-img.jpg" /&gt;
&lt;/p&gt;

&lt;p&gt;I had a course named &amp;quot;Data Analytics&amp;quot; in the previous semester of my study at
  University of Malaya. We were required to do a project in this course that involves the
  main steps in the data-science process including data cleaning and preparation, data
  exploration, predictive modeling, validation, etc.&lt;/p&gt;

&lt;p&gt;I decided …&lt;/p&gt;</summary><content type="html">&lt;p class="featured-image"&gt;&lt;img
    src="/assets/images/2019/header-img.jpg" /&gt;
&lt;/p&gt;

&lt;p&gt;I had a course named &amp;quot;Data Analytics&amp;quot; in the previous semester of my study at
  University of Malaya. We were required to do a project in this course that involves the
  main steps in the data-science process including data cleaning and preparation, data
  exploration, predictive modeling, validation, etc.&lt;/p&gt;

&lt;p&gt;I decided to put an extra effort in doing this project to produce an excellent paper.
  And here you can find the resulting paper in PDF format and as a &lt;a
    href="https://jupyter.org/"&gt;Jupyter Notebook&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;PDF&lt;/h2&gt;

&lt;p&gt;You can view and download the PDF file using this link: &lt;a
    href="/assets/documents/house-price-prediction.pdf"&gt;Click
    here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Jupyter Notebook&lt;/h2&gt;

&lt;p&gt;You can use the Jupyter Notebook to play with code or edit anything in the document.
  You can view and download the Jupyter Notebook file using this link: &lt;a
    href="https://www.kaggle.com/ammar111/house-price-prediction-an-end-to-end-ml-project"&gt;Click
    here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="machine-learning"/><category term="python"/><category term="pandas"/><category term="matplotlib"/><category term="seaborn"/><category term="data-science-project"/><category term="exploratory-data-analysis"/></entry><entry><title>How to Produce Professional and Neat Documents Using LyX and LaTeX</title><link href="https://ammar-alyousfi.com/2019/how-to-produce-professional-and-neat-documents-using-lyx-and-latex.html" rel="alternate"/><published>2019-03-08T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-03-08:/2019/how-to-produce-professional-and-neat-documents-using-lyx-and-latex.html</id><summary type="html">&lt;p class="featured-image"&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx11.jpg" /&gt;
&lt;/p&gt;

&lt;p&gt;LaTeX is a document preparation system for high-quality typesetting. It is one of the
  most sophisticated tools to produce professional and perfected documents.&lt;/p&gt;

&lt;p&gt;LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much
  about the appearance of their documents but to concentrate on getting the …&lt;/p&gt;</summary><content type="html">&lt;p class="featured-image"&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx11.jpg" /&gt;
&lt;/p&gt;

&lt;p&gt;LaTeX is a document preparation system for high-quality typesetting. It is one of the
  most sophisticated tools to produce professional and perfected documents.&lt;/p&gt;

&lt;p&gt;LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much
  about the appearance of their documents but to concentrate on getting the right content.
  LaTeX is based on the idea that it is better to leave document design to document
  designers, and to let authors get on with writing documents.&lt;/p&gt;

&lt;p&gt;LaTeX is widely used in academia, for the communication and publication of scientific
  documents in many fields, including mathematics, statistics, computer science,
  engineering, philosophy, etc.&lt;/p&gt;

&lt;h4&gt;In simple words...&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;LaTeX is to a book what a set of blueprints is to a building.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;What can you do with LaTeX?&lt;/h2&gt;

&lt;p&gt;Below is a set of examples of what you can do with LaTeX:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx1.png" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx2.png" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx3.png" /&gt;
&lt;/p&gt;

&lt;p&gt;And more fancy examples:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx4.jpg" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx5.png" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx6.png" /&gt;
&lt;/p&gt;

&lt;p&gt;To see more examples, visit &lt;a
    href="https://tex.stackexchange.com/questions/1319/showcase-of-beautiful-typography-done-in-tex-friends"&gt;this
    post on TEX Stack Exchange&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;But&lt;/h2&gt;

&lt;p&gt;But there is one difficulty: to use LaTeX, you should learn it first. It is not a
  regular word processor application with a user interface that allows you to write,
  change font and color, etc.&lt;/p&gt;

&lt;p&gt;For example, to produce this simple document in LaTeX:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx7.png" /&gt;
&lt;/p&gt;

&lt;p&gt;you will use the following LaTeX code:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx8.png" /&gt;
&lt;/p&gt;

&lt;p&gt;This is a simple example, and it is not hard. If you want to do more than the examples
  shown above, you need to learn more. You can find good resources for beginners in &lt;a
    href="https://tex.stackexchange.com/questions/11/what-are-good-learning-resources-for-a-latex-beginner"&gt;this
    post on TEX Stack Exchange&lt;/a&gt;. After that you can find intermediate-level resources
  &lt;a
    href="https://tex.stackexchange.com/questions/385649/a-latex-course-for-intermediate-users-stuck-on-the-learning-curve"&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;h2&gt;Here comes Lyx&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.lyx.org/"&gt;LyX&lt;/a&gt; is open source document processor based on the
  LaTeX typesetting system. Unlike most word processors, which follow the &amp;quot;what you
  see is what you get&amp;quot; (WYSIWYG) paradigm, LyX has a &amp;quot;what you see is what you
  mean&amp;quot; (WYSIWYM) approach.&lt;/p&gt;

&lt;p&gt;LyX combines the power and flexibility of TeX/LaTeX with the ease of use of a graphical
  interface. LyX started in 1995, so it has been there for a long time.&lt;/p&gt;

&lt;p&gt;LyX interface looks like this:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx9.png" /&gt;
&lt;/p&gt;

&lt;p&gt;and the output of what is shown looks like this:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" referrerpolicy="no-referrer"
    src="/assets/images/2019/lyx10.png" /&gt;
&lt;/p&gt;

&lt;p&gt;LyX has a lot of options; it allows you to insert LaTeX code if you want. LyX comes
  with a set of helpful files that can help you start using it efficiently. There are
  Introduction, Tutorial, and User&amp;#39;s Guide files that you can access from the Help
  menu.&lt;/p&gt;

&lt;p&gt;LyX works on Linux, Mac, and Windows. You can download LyX and read installation
  instruction from &lt;a href="https://www.lyx.org/Download"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;LyX will help you produce documents that are beautiful, professional, and neat. Try it
  and I think you will never regret that.&lt;/p&gt;

&lt;h2&gt;References&lt;/h2&gt;

&lt;p&gt;&lt;a class="url"
    href="https://tex.stackexchange.com/questions/94889/how-can-i-explain-the-meaning-of-latex-to-my-grandma"
    target="_blank"&gt;https://tex.stackexchange.com/questions/94889/how-can-i-explain-the-meaning-of-latex-to-my-grandma&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a class="url" href="https://www.latex-project.org/about/"
    target="_blank"&gt;https://www.latex-project.org/about/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a class="url" href="https://en.wikipedia.org/wiki/LaTeX"
    target="_blank"&gt;https://en.wikipedia.org/wiki/LaTeX&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a class="url" href="https://tex.stackexchange.com/questions/339/latex-editors-ides"
    target="_blank"&gt;https://tex.stackexchange.com/questions/339/latex-editors-ides&lt;/a&gt;&lt;/p&gt;</content><category term="tools"/><category term="latex"/><category term="writing"/><category term="lyx"/></entry><entry><title>How to Create Beautiful Plots with matplotlib</title><link href="https://ammar-alyousfi.com/2019/how-to-create-beautiful-plots-with-matplotlib.html" rel="alternate"/><published>2019-02-25T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2019-02-25:/2019/how-to-create-beautiful-plots-with-matplotlib.html</id><summary type="html">&lt;p&gt;Python is one of the main tools in the data science world today. Python has many packages and libraries for plotting. &lt;a href='https://matplotlib.org/'&gt;Matplotlib&lt;/a&gt; is one of the most used packages for plotting. However, the default plots are not that beautiful, in my opinion at least. Take a look below to see …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Python is one of the main tools in the data science world today. Python has many packages and libraries for plotting. &lt;a href='https://matplotlib.org/'&gt;Matplotlib&lt;/a&gt; is one of the most used packages for plotting. However, the default plots are not that beautiful, in my opinion at least. Take a look below to see a plot produced with the default settings:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg1.jpeg' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;In this post, I will share my way in producing beautiful plots with Matplotlib. &lt;/p&gt;
&lt;p&gt;We will start with a plot produced with default settings. We will use the following code to generate some data and produce a histogram plot:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;import numpy as np
from matplotlib import pyplot as plt

%config InlineBackend.figure_format = &amp;#39;retina&amp;#39;

np.random.seed(3)
x = np.random.randn(250)
plt.hist(x);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives us the following plot:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg1.jpeg' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;Now we want to improve this plot by using some of the options provided by Matplotlib.&lt;/p&gt;
&lt;h2&gt;Figure size&lt;/h2&gt;
&lt;p&gt;The default size of a Matplotlib figure (which is the space on which plots are drawn) is 6 x 4 inches. This is sometimes not big enough for your plot. To change that, we create a figure with our desired dimensions then we plot what we need to plot. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;fig, ax = plt.subplots(figsize=(8, 5.5))
plt.hist(x);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Axis labels&lt;/h2&gt;
&lt;p&gt;As seen in the default plot, there are no labels on the x-axis and y-axis. Sometimes we need labels so we can know what each axis represents. We can set the labels as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;ax.set_xlabel(&amp;quot;Weight&amp;quot;, labelpad=15, fontsize=12, color=&amp;quot;#333533&amp;quot;);
ax.set_ylabel(&amp;quot;Count&amp;quot;, labelpad=15, fontsize=12, color=&amp;quot;#333533&amp;quot;);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We labeled the x-axis with &amp;quot;Weight&amp;quot; assuming that our data represents weights of people. We set the space between the x-axis and the label to 15pt so it is not so close to the axis. Also, we made the label a little bit bigger (the default size is 10pt), and we chose a somewhat gray color for the label so it doesn&amp;#39;t distract the reader from the plot. Similar things were applied to the y-axis. The result is:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg2.jpeg' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;h2&gt;Colors&lt;/h2&gt;
&lt;p&gt;With Matplotlib, we can change the color of a lot of objects. In our example, we can change the color of the histogram, the color of the background inside the axes and outside the axes, the color of the text, etc.&lt;/p&gt;
&lt;p&gt;We will use the same command we used before to plot the histogram but with a parameter that specify the color:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;plt.hist(x, color=&amp;quot;#073642&amp;quot;);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This results in the following graph:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg3.jpeg' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;Or you might go for something like the following:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;plt.hist(x, color=&amp;quot;#d1ae45&amp;quot;);
# to change background color inside the axes
ax.set_facecolor(&amp;quot;#2E2E2E&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which produces this graph:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg4.jpeg' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;h2&gt;Matplotlib plot system&lt;/h2&gt;
&lt;p&gt;To be able to customize the plot, it is important to know the plotting system of Matplotlib. In Matplotlib, everything is plotted and written on a &lt;em&gt;figure&lt;/em&gt;. A figure might contain more than one plot (subplots). A plot is represented as axes that contain the desired shape (histogram, scatter plot, etc.). You can control a lot of things in Matplotlib by working with these three items: &lt;a href='https://matplotlib.org/api/_as_gen/matplotlib.pyplot.figure.html'&gt;the figure&lt;/a&gt;, &lt;a href='https://matplotlib.org/api/axes_api.html'&gt;the axes&lt;/a&gt;, and the shape which you can customize it using its corresponding function (for example, when we plot a histogram using &lt;code&gt;plt.hist(data)&lt;/code&gt; function, we can specify the color of the histogram with &lt;code&gt;plt.hist(data, color=&amp;quot;darkblue&amp;quot;)&lt;/code&gt;. There are many other parameters to play with ).&lt;/p&gt;
&lt;p&gt;Personally, I create my Matplotlib plots using something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;fig, ax = plt.subplots(figsize=(10, 7))
ax.hist(data, color=&amp;quot;#333333&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives me the &lt;code&gt;fig&lt;/code&gt; and &lt;code&gt;ax&lt;/code&gt; objects with which I can control many aspects.&lt;/p&gt;
&lt;h2&gt;Grid&lt;/h2&gt;
&lt;p&gt;Sometimes we need a grid in our graph to make it easier to read. The following code draws a grid with a light gray color so it does not distract the reader.&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;# The following line is to prevent the grid
# from appearing on the histogram
ax.set_axisbelow(True)
# alpha is used to control the transparency
plt.grid(True, color=&amp;quot;#93a1a1&amp;quot;, alpha=0.3)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The result can be seen below:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg5.jpeg' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;h2&gt;Color combinations&lt;/h2&gt;
&lt;p&gt;Some types of visualizations can be made with more than one color. For example, pie charts, bar charts, a plot with more than one histogram on it, etc. In this case, choosing the colors for the plot becomes more effective in determining the beauty of the plot. There are a lot of websites that show many beautiful color combinations. For example, &lt;a href='http://colorhunt.co/' target='_blank' class='url'&gt;http://colorhunt.co/&lt;/a&gt;, &lt;a href='https://coolors.co/browser/best/1' target='_blank' class='url'&gt;https://coolors.co/browser/best/1&lt;/a&gt;, &lt;a href='https://flatuicolors.com/' target='_blank' class='url'&gt;https://flatuicolors.com/&lt;/a&gt;, etc. There are also websites that suggests colors specifically for data visualization like &lt;a href='https://learnui.design/tools/data-color-picker.html' target='_blank' class='url'&gt;https://learnui.design/tools/data-color-picker.html&lt;/a&gt; and &lt;a href='http://tristen.ca/hcl-picker' target='_blank' class='url'&gt;http://tristen.ca/hcl-picker&lt;/a&gt;. Here are some examples from a previous data analysis I&amp;#39;ve done:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg6.png' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2019/mg7.png' alt='' referrerPolicy='no-referrer' /&gt;&lt;/p&gt;
&lt;h2&gt;Don&amp;#39;t repeat yourself&lt;/h2&gt;
&lt;p&gt;If you have particular settings that you want to apply to all of your plots, you can use Matplotlib rcParams to do so. Changing the settings of rcParams will affect all subsequent plots. For example, if you want all plots to have the size 12 x 8 inches instead of the default 6 x 4 inches, you can write:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;plt.rc(&amp;#39;figure&amp;#39;, figsize=(8, 5))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To change rcParams settings, you pass first the group you want to change its settings (in the example above, the group is &lt;code&gt;&amp;#39;figure&amp;#39;&lt;/code&gt;) then you pass the settings you want to change with their values. For a complete list of rcParams, click &lt;a href='https://matplotlib.org/users/customizing.html#a-sample-matplotlibrc-file'&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;High quality plots in Jupyter notebooks&lt;/h2&gt;
&lt;p&gt;To get clearer and high-quality plots when using Matplotlib in Jupyter notebooks, use the following line in any cell before you plot:&lt;/p&gt;
&lt;pre&gt;&lt;code class='language-python' lang='python'&gt;%config InlineBackend.figure_format = &amp;#39;retina&amp;#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;When you choose the color of some text, make sure the contrast between the text and its background is enough so the text is clearly readable. Search for &amp;quot;contrast checker&amp;quot; and you will find many websites that offer that service. For example, &lt;a href='https://contrastchecker.com/' target='_blank' class='url'&gt;https://contrastchecker.com/&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;</content><category term="data-science"/><category term="data-analysis"/><category term="data-science"/><category term="data-visualization"/><category term="python"/><category term="matplotlib"/></entry><entry><title>Machine Learning: Linear Regression, Simply Explained</title><link href="https://ammar-alyousfi.com/2018/machine-learning-linear-regression-simply-explained.html" rel="alternate"/><published>2018-11-20T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-11-20:/2018/machine-learning-linear-regression-simply-explained.html</id><summary type="html">&lt;p&gt;&lt;img class="featured-image" src="/assets/images/2018/linear-reg.png" /&gt;&lt;/p&gt;

&lt;p&gt;Linear regression is fitting a line to our data.&lt;/p&gt;

&lt;p&gt;First, let&amp;#39;s explore linear regression when we have only one variable (one feature; one independent variable).&lt;/p&gt;

&lt;p&gt;Suppose that we have a table that describes house prices based on one feature which is the size of the house:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size in m …&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;/table&gt;</summary><content type="html">&lt;p&gt;&lt;img class="featured-image" src="/assets/images/2018/linear-reg.png" /&gt;&lt;/p&gt;

&lt;p&gt;Linear regression is fitting a line to our data.&lt;/p&gt;

&lt;p&gt;First, let&amp;#39;s explore linear regression when we have only one variable (one feature; one independent variable).&lt;/p&gt;

&lt;p&gt;Suppose that we have a table that describes house prices based on one feature which is the size of the house:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size in m&lt;sup&gt;2&lt;/sup&gt; (x)&lt;/th&gt;
&lt;th&gt;Price in $ (y)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2104&lt;/td&gt;
&lt;td&gt;460,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1416&lt;/td&gt;
&lt;td&gt;232,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1002&lt;/td&gt;
&lt;td&gt;112,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1721&lt;/td&gt;
&lt;td&gt;382,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1590&lt;/td&gt;
&lt;td&gt;266,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1302&lt;/td&gt;
&lt;td&gt;201000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Let \(m\) be the number of examples, \(x^i\) be the i-th element for variable \(x\) , and \(y^i\) be the i-th element for variable \(y\). For our example, \(m=4\), \(x^2=1416\), and \(y^3=112,000\). In real cases, \(m\) is much large than 4. We use four entries here just for clarification.&lt;/p&gt;

&lt;p&gt;The variable \(x\) is called feature, and variable \(y\) is called target.&lt;/p&gt;

&lt;p&gt;We call these examples the training examples, meaning that they are used to train a machine-learning model (in our case, linear regression) so we can use that model to predict the target variable for new data.&lt;/p&gt;

&lt;p&gt;To do so, we need to calculate a function called the hypothesis (\(h_\theta(x)\)) that can be used to predict house price knowing its size. This function has the following form:&lt;/p&gt;

&lt;p&gt;$$ h_\theta(x)=\theta_0+\theta_1x $$&lt;/p&gt;

&lt;p&gt;Note that this equation looks like the &lt;a href="https://www.mathsisfun.com/algebra/linear-equations.html"&gt;line equation&lt;/a&gt; (\(y=b+mx\)) where \(m\) is the slope of the line and \(b\) is the where the line intersects with the y axis.&lt;/p&gt;

&lt;p&gt;In our equation, \(x\) is our one feature, the size of the house. \(\theta_0\) and \(\theta_1\) are unknowns; we need to find the optimal values for these two parameters. \(h_\theta(x)\) represents the predicted price. We want \(h_\theta(x)\) to be a good predictor, we want its value to be as close as possible to the actual \(y\) value.&lt;/p&gt;

&lt;p&gt;Let&amp;#39;s suppose that we have these data points:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="/assets/images/2018/regp1.png" /&gt;&lt;/p&gt;

&lt;p&gt;where each point represents a house, where the size of this house is on the x-axis and its price is on the y-axis.&lt;/p&gt;

&lt;p&gt;We want to find a line that fit this data better than any other line. In other words, we want to find the optimal values for \(\theta_0\) and \(\theta_1\) in the following equation:&lt;/p&gt;

&lt;p&gt;$$ h_\theta(x)=\theta_0+\theta_1x $$&lt;/p&gt;

&lt;p&gt;which represents a line as we said earlier. We can try many values for \(\theta_0\) and \(\theta_1\) until we reach a satisfactory results, but this is not a practically efficient way. Instead, we will use a function called the cost function with an algorithm called gradient descent to reach the optimal values for our two parameters.&lt;/p&gt;

&lt;p&gt;The cost function is used to calculate the error in our model, to know, for given values of \(\theta_0\) and \(\theta_1\), how good is our hypothesis, how close are the predicted values to the actual values. The cost function for linear regression can have the following formula:&lt;/p&gt;

&lt;p&gt;$$ \text{Cost}=J(\theta)=\frac{1}{2m}\sum_{i=1}^m(h_\theta(x^i)-y^i)^2 $$&lt;/p&gt;

&lt;p&gt;So this cost function calculates the difference between the predicted value and the actual value for all the training examples that we have. Our goal is to choose values for theta0 and theta1 that minimize the cost function.&lt;/p&gt;

&lt;p&gt;For example, let&amp;#39;s calculate the cost function value for the training examples in the table above, assuming that theta0=1 and theta1=2 (This is just random. We will see later how to get the optimal values for theta0 and theta1):&lt;/p&gt;

&lt;p&gt;$$ J(\theta)=\frac{1}{2\times6}\sum_{i=1}^m(\theta_0+\theta_1x^i-y^i)^2=\\~\\\frac{1}{12}[(1+2\times2104-460000)^2+\\~\\(1+2\times1416-232000)^2+\\~\\(1+2\times1002-112000)^2+\\~\\(1+2\times1721-382000)^2+\\~\\(1+2\times1590-266000)^2+\\~\\(1+2\times1302-201000)^2] $$&lt;/p&gt;

&lt;p&gt;Now how to choose theta values? We do so using Gradient Descent algorithm, which is the &lt;em&gt;repeat&lt;/em&gt; of:&lt;/p&gt;

&lt;p&gt;$$ \theta_j:=\theta_j-\alpha\frac{\partial}{\partial\theta_j}J(\theta) \qquad\text{ for }j=0,1 $$&lt;/p&gt;

&lt;p&gt;until convergence.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;:=&lt;/code&gt; means that we compute the right side and assign it to the left side. \(\alpha\) is the learning rate, it controls the step size of gradient descent. \(\frac{\partial}{\partial\theta_j}J(\theta)\) is the partial derivative of the cost function with respect to \(\theta_j\).&lt;/p&gt;

&lt;p&gt;Gradient descent algorithm starts with random values of thetas. It calculates the right side of the assignment for all thetas then updates all thetas simultaneously. This happens because to calculate the right side of the assignment for some \(\theta\), you need the values of other thetas:&lt;/p&gt;

&lt;p&gt;$$ \theta_j:=\theta_j-\alpha\frac{\partial}{\partial\theta_j}\left(\frac{1}{2m}\sum_{i=1}^m(h_\theta(x^i)-y^i)^2\right)=\\~\\\theta_j-\alpha\frac{\partial}{\partial\theta_j}\left(\frac{1}{2m}\sum_{i=1}^m(\theta_0+\theta_1x^i-y^i)^2\right) $$&lt;/p&gt;

&lt;p&gt;The partial derivative of the cost function gives us the direction in which the gradient descent should move toward the optimal point at which the cost function has its smallest value. The partial derivative also has a magnitude that decreases as we get close to the optimal point.&lt;/p&gt;

&lt;p&gt;So gradient descent algorithm iterates and continues updating the parameters (thetas) until convergence, until the cost function value is not decreasing anymore. At that point, we can say that the values of thetas are optimal, meaning they produce the smallest cost (error) function value. This means that we can now use the equation:&lt;/p&gt;

&lt;p&gt;$$ h_\theta(x)=\theta_0+\theta_1x $$&lt;/p&gt;

&lt;p&gt;to get the predicted value (\(h_\theta(x)\)) for an input value (\(x\)). Let&amp;#39;s say that we trained the model and got the optimal values for thetas, and that we got thete0 = 1 and theta1 = 212. Now, we want to predict the price of a new house whose size is 1333 m&lt;sup&gt;2&lt;/sup&gt;, we apply our model (the hypothesis):&lt;/p&gt;

&lt;p&gt;$$ h_\theta(x)=\theta_0+\theta_1x = 1+212\times1333=282597 $$&lt;/p&gt;

&lt;p&gt;So we got a predicted value of $ 282597 for the house price.&lt;/p&gt;

&lt;h2&gt;Multivariate linear regression&lt;/h2&gt;

&lt;p&gt;Until now, we have been talking about linear regression with one input variable (one feature). In real-world problems, there are much more features. Data for multivariate linear regression might look like:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size in m&lt;sup&gt;2&lt;/sup&gt; (x&lt;sub&gt;1&lt;/sub&gt;)&lt;/th&gt;
&lt;th&gt;Number of Bedrooms (x&lt;sub&gt;2&lt;/sub&gt;)&lt;/th&gt;
&lt;th&gt;Number of Floors (x&lt;sub&gt;3&lt;/sub&gt;)&lt;/th&gt;
&lt;th&gt;Age in years (x&lt;sub&gt;4&lt;/sub&gt;)&lt;/th&gt;
&lt;th&gt;Price in $ (y)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2104&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;40&lt;/td&gt;
&lt;td&gt;460,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1416&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;42&lt;/td&gt;
&lt;td&gt;232,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1002&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;31&lt;/td&gt;
&lt;td&gt;112,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1721&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;382,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1590&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;td&gt;266,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1302&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;44&lt;/td&gt;
&lt;td&gt;201000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Here \(x_1\) is the first feature, \(x_2\) is the second one, and so on. \(x_2^1\) in this case represents the first value of the second feature (number of bedrooms), which is 3.&lt;/p&gt;

&lt;p&gt;The number of features is denoted by \(n\). In our example, \(n\) is 4.&lt;/p&gt;

&lt;p&gt;The same techniques used with univariate linear regression (linear regression with one variable) are used with multivariate linear regression. The difference is that we just add the new input variables with their corresponding parameters.&lt;/p&gt;

&lt;p&gt;So, the hypothesis function becomes:&lt;/p&gt;

&lt;p&gt;$$ h_\theta(x)=\theta_0+\theta_1x_1+\theta_2x_2+\theta_3x_3 + \cdots +\theta_nx_n $$&lt;/p&gt;

&lt;p&gt;The cost function retain its general form:&lt;/p&gt;

&lt;p&gt;$$ \text{Cost}=J(\theta)=\frac{1}{2m}\sum_{i=1}^m(h_\theta(x^i)-y^i)^2$$&lt;/p&gt;

&lt;p&gt;but \(h_\theta(x)\) will make it different. Also, gradient descent becomes:&lt;/p&gt;

&lt;p&gt;$$ \theta_j:=\theta_j-\alpha\frac{\partial}{\partial\theta_j}J(\theta) \qquad\text{ for }j=0,1,2,\cdots,n $$&lt;/p&gt;

&lt;h2&gt;Illustrated Example with Simple Python Code&lt;/h2&gt;

&lt;p&gt;Let&amp;#39;s say that we have these data points as our training data:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="/assets/images/2018/regp1.png" /&gt;&lt;/p&gt;

&lt;p&gt;Now, we want to fit a line to this data so we can use it to predict the output value for new data. First let&amp;#39;s see a bad example of such a line:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="/assets/images/2018/regp2.png" /&gt;&lt;/p&gt;

&lt;p&gt;This line clearly is not the best fit. All points are on one of its sides. Let&amp;#39;s see a better solution:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="/assets/images/2018/regp3.png" /&gt;&lt;/p&gt;

&lt;p&gt;This one is better but still not good enough. Let&amp;#39;s write a simple Python code using &lt;a href="https://scikit-learn.org/"&gt;scikit-learn&lt;/a&gt; library, which is a great Python library that allows us to build many machine-learning models easily with a few lines of code:&lt;/p&gt;

&lt;pre&gt;
&lt;span style="color:#006a00"&gt;# import the part that we need from scikit-learn&lt;/span&gt;
&lt;span style="color:#aa0d91"&gt;from&lt;/span&gt; sklearn.linear_model &lt;span style="color:#aa0d91"&gt;import&lt;/span&gt; LinearRegression

&lt;span style="color:#006a00"&gt;# Create the features array. &lt;/span&gt;
&lt;span style="color:#006a00"&gt;# We have one feature in our example =&amp;gt; &lt;/span&gt;
&lt;span style="color:#006a00"&gt;# one column in feature array&lt;/span&gt;
x = [[&lt;span style="color:#1c00cf"&gt;1375&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1737&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1702&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1411&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;2119&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1735&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1545&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1566&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1754&lt;/span&gt;],
[&lt;span style="color:#1c00cf"&gt;1930&lt;/span&gt;]]

&lt;span style="color:#006a00"&gt;# Create the target array&lt;/span&gt;
y = [&lt;span style="color:#1c00cf"&gt;263928&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;344085&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;345505&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;289701&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;445548&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;348764&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;328066&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;319531&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;372130&lt;/span&gt;,
&lt;span style="color:#1c00cf"&gt;383157&lt;/span&gt;]

&lt;span style="color:#006a00"&gt;# Create an instance of LinearRegression model&lt;/span&gt;
model = LinearRegression()

&lt;span style="color:#006a00"&gt;# Fit the model to our data with one command&lt;/span&gt;
model.fit(x, y)

&lt;span style="color:#006a00"&gt;# Now we can see the value of the parameters&lt;/span&gt;
&lt;span style="color:#006a00"&gt;# theta_0 and theta_1&lt;/span&gt;
&lt;span style="color:#006a00"&gt;# theta_0 is stored in model.intercept_&lt;/span&gt;
print(&lt;span style="color:#c41a16"&gt;&amp;quot;theta_0 =&amp;quot;&lt;/span&gt;, model.intercept_)
&lt;span style="color:#006a00"&gt;# -22610.91211103683&lt;/span&gt;
&lt;span style="color:#006a00"&gt;# theta_1 is stored in model.coef_&lt;/span&gt;
print(&lt;span style="color:#c41a16"&gt;&amp;quot;theta_1 =&amp;quot;&lt;/span&gt;, model.coef_)
&lt;span style="color:#006a00"&gt;# [217.28837982]&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;When we run these lines of code, we get the values of \(\theta_0\) and \(\theta_1\):&lt;/p&gt;

&lt;pre&gt;
theta_0 = &lt;span style="color:#1c00cf"&gt;-22610.91211103683&lt;/span&gt;
theta_1 = [&lt;span style="color:#1c00cf"&gt;217.28837982&lt;/span&gt;]&lt;/pre&gt;

&lt;p&gt;Now that we have the optimal values for our parameters, let&amp;#39;s plot the line using these values:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="/assets/images/2018/regp4.png" /&gt;&lt;/p&gt;

&lt;p&gt;We can see that this line represents a better fit to the data than the previous two lines. And now, we can use the equation of this line that we talked about earlier:&lt;/p&gt;

&lt;p&gt;$$ h_\theta(x)=\theta_0+\theta_1x $$&lt;/p&gt;

&lt;p&gt;to predict the output for new data. Let&amp;#39;s have an example: suppose that we get a new data, which is the size of a house, and we want to predict its price using our model. If the size is 2030 m&lt;sup&gt;2&lt;/sup&gt;. We can calculate the predicted values as follows:&lt;/p&gt;

&lt;p&gt;$$ h_\theta(2030)=-22610.91211103683+217.28837982\times2030\\~\\=418484.49892356317 $$&lt;/p&gt;

&lt;p&gt;So the predicted price is $418484.5. We can get the same value using the model that we built in Python:&lt;/p&gt;

&lt;pre&gt;
print(model.predict([[&lt;span style="color:#1c00cf"&gt;2030&lt;/span&gt;]]))&lt;/pre&gt;

&lt;p&gt;This would be the new data point that we just predicted its target value; it is shown in yellow:&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="/assets/images/2018/regp5.png" /&gt;&lt;/p&gt;

&lt;p&gt;This post is highly influenced by &lt;a href="https://www.coursera.org/learn/machine-learning"&gt;Machine Learning course&lt;/a&gt; by Prof. Andrew Ng.&lt;/p&gt;
&lt;script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
async&gt;&lt;/script&gt;</content><category term="data-science"/><category term="data-science"/><category term="linear-regression"/><category term="machine-learning"/></entry><entry><title>YouTube Trending Videos Analysis (40,000+ Videos)</title><link href="https://ammar-alyousfi.com/2018/youtube-trending-video-analysis-40000-videos.html" rel="alternate"/><published>2018-10-11T00:00:00+04:00</published><updated>2026-05-10T18:19:15.245732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-10-11:/2018/youtube-trending-video-analysis-40000-videos.html</id><summary type="html">&lt;p&gt;&lt;img class="featured-image"
    src="/assets/images/2018/ytanalysisp.png" /&gt;
&lt;/p&gt;

&lt;p&gt;YouTube is the most popular and most used video platfrom in the world today. YouTube
  has &lt;a href="https://www.youtube.com/feed/trending"&gt;a list of &lt;strong&gt;trending
      videos&lt;/strong&gt;&lt;/a&gt; that is updated constantly. Here we will use
  &lt;strong&gt;Python&lt;/strong&gt; with some packages like &lt;strong&gt;Pandas&lt;/strong&gt; and
  &lt;strong&gt;Matplotlib&lt;/strong&gt; to analyze a dataset that was collected over 205 days. For
  each of …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img class="featured-image"
    src="/assets/images/2018/ytanalysisp.png" /&gt;
&lt;/p&gt;

&lt;p&gt;YouTube is the most popular and most used video platfrom in the world today. YouTube
  has &lt;a href="https://www.youtube.com/feed/trending"&gt;a list of &lt;strong&gt;trending
      videos&lt;/strong&gt;&lt;/a&gt; that is updated constantly. Here we will use
  &lt;strong&gt;Python&lt;/strong&gt; with some packages like &lt;strong&gt;Pandas&lt;/strong&gt; and
  &lt;strong&gt;Matplotlib&lt;/strong&gt; to analyze a dataset that was collected over 205 days. For
  each of those days, the dataset contains data about the trending videos of that day. It
  contains data about &lt;strong&gt;more than 40,000 trending videos&lt;/strong&gt;. We will analyze
  this data to get insights into YouTube trending videos, to see what is common between
  these videos. Those insights might also be used by people who want to increase
  popularity of their videos on YouTube.&lt;/p&gt;

&lt;p&gt;The dataset that we will use is obtained from Kaggle &lt;a
    href="https://www.kaggle.com/datasnaek/youtube-new"&gt;here&lt;/a&gt;. It contains data about
  trending videos for many countries. Here we will analyze USA trending videos.&lt;/p&gt;

&lt;h2&gt;Goals of the analysis&lt;/h2&gt;

&lt;p&gt;We want to answer questions like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How many views do our trending videos have? Do most of them have a large number of
    views? Is having a large number of views required for a video to become trending?&lt;/li&gt;
  &lt;li&gt;The same questions above, but applied to likes and comment count instead of views.
  &lt;/li&gt;
  &lt;li&gt;Which video remained the most on the trendin-videos list?&lt;/li&gt;
  &lt;li&gt;How many trending videos contain a fully-capitalized word in their titles?&lt;/li&gt;
  &lt;li&gt;What are the lengths of trending video titles? Is this length related to the video
    becoming trendy?&lt;/li&gt;
  &lt;li&gt;How are views, likes, dislikes, comment count, title length, and other attributes
    correlate with (relate to) each other? How are they connected?&lt;/li&gt;
  &lt;li&gt;What are the most common words in trending video titles?&lt;/li&gt;
  &lt;li&gt;Which YouTube channels have the largest number of trending videos?&lt;/li&gt;
  &lt;li&gt;Which video category (e.g. Entertainment, Gaming, Comedy, etc.) has the largest
    number of trending videos?&lt;/li&gt;
  &lt;li&gt;When were trending videos published? On which days of the week? at which times of
    the day?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To see the answers of these questions and more, with tables and many visualizations,
  and with the code used step-by-step, visit the analysis notebook on Kaggle:&lt;/p&gt;

&lt;h3&gt;&lt;a href="https://www.kaggle.com/ammar111/youtube-trending-videos-analysis/"&gt;YouTube
    Trending Video Analysis&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;If you like the analysis, please consider voting for it.&lt;/p&gt;</content><category term="data-science"/><category term="data-analysis"/><category term="data-science"/><category term="data-visualization"/><category term="data-science-project"/><category term="python"/><category term="exploratory-data-analysis"/></entry><entry><title>لماذا ترك الغرب الدين وراءه؟ - ملخص كتاب "ماذا خسر العالم بانحطاط المسلمين"</title><link href="https://ammar-alyousfi.com/ar/2018/a-summary-of-what-the-world-lost-due-to-the-downfall-of-muslims.html" rel="alternate"/><published>2018-08-01T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-08-01:/ar/2018/a-summary-of-what-the-world-lost-due-to-the-downfall-of-muslims.html</id><summary type="html">&lt;p&gt;&lt;img class="featured-image"
  src="/assets/images/2018/what-west.jpg" /&gt;&lt;/p&gt;
&lt;h3&gt;مقدمة&lt;/h3&gt;
&lt;p&gt;فيما يلي ملخص مختصَر - مع بعض التصرف - لكتاب رائع اسمه &amp;quot;ماذا خسر العالم بانحطاط
  المسلمين&amp;quot; من تأليف أبي الحسن علي الندوي. أفضل ما استفدته من الكتاب أنه عرفني أسباب
  وقصة وصول العالم وخاصة العالم الغربي إلى ما هو عليه اليوم من نسيان لأمر الآخرة ومن عدم
  وجود مكان …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img class="featured-image"
  src="/assets/images/2018/what-west.jpg" /&gt;&lt;/p&gt;
&lt;h3&gt;مقدمة&lt;/h3&gt;
&lt;p&gt;فيما يلي ملخص مختصَر - مع بعض التصرف - لكتاب رائع اسمه &amp;quot;ماذا خسر العالم بانحطاط
  المسلمين&amp;quot; من تأليف أبي الحسن علي الندوي. أفضل ما استفدته من الكتاب أنه عرفني أسباب
  وقصة وصول العالم وخاصة العالم الغربي إلى ما هو عليه اليوم من نسيان لأمر الآخرة ومن عدم
  وجود مكان للدين والإله في حياته ومن انطلاقه إلى علمه وبحثه مستنداً على المادية، ربما
  كردة فعل على أحداث تاريخية، وما سببه ذلك من تبعات.&lt;/p&gt;
&lt;p&gt;رابط الكتاب على Goodreads: &lt;/p&gt;
&lt;p&gt;&lt;a href='https://www.goodreads.com/book/show/2905549' target='_blank'
    class='url'&gt;https://www.goodreads.com/book/show/2905549&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;ما قبل الإسلام&lt;/h3&gt;
&lt;p&gt;كان القرن السادس والسابع (لميلاد المسيح) من أحط أدوار التاريخ بلا خلاف، فكانت الإنسانية
  متدلية منحدرة منذ قرون، وما على وجه الأرض قوة تمسك بيدها وتمنعها من التردي، فقد زادتها
  الأيام سرعة في هبوطها وشدة في إسفافها، وكأنَّ الإنسان في هذا القرن قد نسي خالقه، فنسي
  نفسه ومصيره، وفقد رشده، وقوة التمييز بين الخير والشر، والحسن والقبيح، وقد خفتت دعوة
  الأنبياء من زمن، والمصابيح التي أوقدوها قد انطفأت من العواصف التي هبت بعدهم أو بقيت،
  ونورها ضعيف ضئيل لا ينير إلا بعض القلوب فضلاً عن البيوت فضلاً عن البلاد. &lt;/p&gt;
&lt;h3&gt;العصر الذهبي للإسلام&lt;/h3&gt;
&lt;p&gt;لم يتولى المسلمون الحكم في هذه الفترة إلا وقد تخلصت نفوسهم من أمراضها بعد تزكيتها
  وتربيتها على يد النبي صلى الله عليه وسلم. صار الورع والزهد والعفاف والأمانة وخشية الله
  والإيثار من جملة أخلاقهم. لم يفرقوا بين أبيض وأسود ولم يفضلوا عربياً على عجمي.&lt;/p&gt;
&lt;p&gt;النظرة الإسلامية للدنيا نظرة متوازنة، فلا ينظر المسلمون إلى الدنيا نظرة الماديين: فرصة
  وحيدة للتمتع والتنعم فيتسابقون ويتكالبون عليها بجشع وشراهة، ويقهرون الشعوب الضعيفة
  ويسرقون خيراتها ويقتلون أهلها. ولا ينظرون إلى الدنيا على أنها عقوبة وعذاب من الله
  فينصرفون عن إعمار الأرض وإصلاحها. بل يعدون هذه الحياة نعمة من الله هي أصل كل خير وسبب كل
  بر، يتقربون فيها إلى الله ويحاولون الوصول إلى ما يستطيعونه من كمال؛ يرونها فرصة عمل
  وجهاد {الذي خلق الموت والحياة ليبلوكم أيكم أحسن عملاً}&lt;/p&gt;
&lt;h3&gt;عهد الأمويين والعباسيين&lt;/h3&gt;
&lt;p&gt;وقع فصل بين الدين والسياسة عملياً، فإن خلفاء هاتين الدولتين بشكل عام لم يكونوا من العلم
  والدين بمكان يستغنون به عن العلماء وأهل الدين، واستعانوا بهؤلاء متى شاؤوا واستغنوا عنهم
  متى شاؤوا.&lt;/p&gt;
&lt;p&gt;إن العلماء المفكرين في ذلك العصر لم يعتنوا بالعلوم الطبيعية التجريبية والعلوم العملية
  المثمرة المفيدة اعتناءهم بعلوم ما بعد الطبيعة والفلسفة الإلهية التي تلقوها من اليونان
  وما هي إلا وثنيتهم القومية التي ترجموها في لغتهم الفلسفية، وقد أغنى الله المسلمين عنها
  وكفاهم هذا البحث والتنقيب، ولكن المسلمين لم يشكروا هذه النعمة، بل بذلوا قسطاً كبيراً من
  جهودهم وذكائهم فيها وفي مباحث الروح وفلسفة الإشراق ومسائل وحدة الوجود. &lt;/p&gt;
&lt;p&gt;إن ما وصل إليه المسلون في العلوم الطبيعية والتجريبية، فإنه وإن كان أرقى من العصور
  السابقة وأكثر ثروة في العلم والاختبار، إلا أنه لا يتناسب مع فتوحهم الواسعة في دوائر
  علمية أخرى، ولا يتلاءم مع المدة الطويلة التي تمتعوا بها في التاريخ. إن ما خلفوه من كتب
  في الطبيعيات والكونيات والتجارب العلمية، وإن كان مما استفادت منه أوروبا في نهضتها، فإنه
  يتضاءل أمام ما أنتجته أوروبا في القرنين السابع عشر والثامن عشر فقط.&lt;/p&gt;
&lt;h3&gt;عهد العثمانيين&lt;/h3&gt;
&lt;p&gt;تقول الكاتبة خالدة أديب هانم: “لما بدأ الغرب في دراسة الطبيعة بواسطة المشاهدة والاختبار
  والتحليل والتجزئة سقط في أيدي رجال الكنيسة، ولما وصل العلماء بطرق عملية إلى اكتشافات
  مهمة خاف علماء النصرانية على سيادة الكنيسة أن تنقرض، فحدث صراع عنيف بين الدين والعلم،
  وذهب كبار علماء الطبيعة الذين كانوا عاكفين على دراستهم وتحقيقهم ضحية علمهم. واضطرت
  الكنيسة النصرانية بعد المعارك الدموية بين الدين والعلم أن تواجه الواقع، فأدخلت علوم
  الطبيعة في برنامج مدارسها وكلياتها.&lt;/p&gt;
&lt;p&gt;وكان العلماء في تركيا العثمانية على الضد من ذلك، فلم يعنوا باكتساب العلوم الحديثة، بل
  منعوا الأفكار الجديدة أن تدخل في منطقتهم، وإذ كانوا متصرفين بزمام تعليم الأمة الإسلامية
  ولم يسمحوا لشيء طريف بأن يقرب منهم، فإن الجمود قد تغلب على نظامهم التعليمي. فلم تزل
  المدارس الإسلامية في القرن التاسع عشر المسيحي، كما كانت في القرن الثالث عشر المسيحي.”
&lt;/p&gt;
&lt;h3&gt;الغرب إلى الواجهة&lt;/h3&gt;
&lt;p&gt;كان القرن السادس عشر والسابع عشر المسيحي من أهم أدوار التاريخ الإنساني الذي له ما بعده،
  قد استيقظت فيه أوربا من هجعتها الطويلة، وهبت من مرقدها مجنونة تتدارك زمان الغفلة والجهل
  وتفتح فتوحاً جديدة في كل علم وفن، ونبغ في هذه المدة القصيرة رجال ومبتكرون في كل علم
  وعبقرية مثل Copernicus و Newton وغيرهم.&lt;/p&gt;
&lt;p&gt;بداية، هناك حادثة عظيمة يجب أن يسجلها المؤرخ وينوه بها، وهي اعتلاء النصرانية عرش رومة
  الوثنية، وكان ذلك بجلوس قسطنطين الذي اعتنق النصرانية على سرير الأباطرة سنة 305م حيث وصل
  إلى الملك على جسر من أشلاء النصارى الذين نصروه وذبوا عنه.&lt;/p&gt;
&lt;p&gt;يقول درابر (John William Draper): “إن الجماعة النصرانية وإن كانت قد بلغت من القوة بحيث
  ولَّت فسطنطين الملك ولكنها لم تتمكن من أن تقطع دابر الوثنية وتقتلع جرثومتها، وكان نتيجة
  كفاحها أن اختلطت مبادئها، ونشأ من ذلك دين جديد تتجلى فيه النصرانية والوثنية سواء بسواء -
  هنالك يختلف الإسلام عن النصرانية، إذ قضى الإسلام على منافسه (الوثنية) قضاء باتاً، ونشر
  عقائده خالصة بغير غش. وإن هذا الإمبراطور الذي كان عبداً للدنيا والذي لم تكن عقائده
  الدينية تساوي شيئاً رأى لمصلحته الشخصية ولمصلحة الحزبين المتنافسين -النصراني والوثني- أن
  يوحدهما ويؤلف بينهما، حتى إن النصارى الراسخين أيضاً لم ينكروا عليه هذه الخطة، ولعلهم
  كانوا يعتقدون أن الديانة الجديدة ستزدهر إذا طمست ولقحت بالعقائد الوثنية القديمة، وسيخلص
  الدين النصراني عاقبة الأمر من أدناس الوثنية وأرجاسها&lt;/p&gt;
&lt;p&gt;لم تستطع هذه النصرانية الملقحة بالوثنية المشوهة التي فقدت روحها وجمالها أن تغير من سيرة
  الروم المنحطة وأن تبعث فيهم حياة جديدة، حياة دينية نقية طاهرة وأن تفتح عهداً زاهراً في
  تاريخ الروم، بل إنها ابتدعت رهبانية لعلها كانت شراً على الإنسانية والمدنية من بهيمية
  رومة الوثنية. وصار الناس بين الرهبانية العاتية والمادية الجامحة.&lt;/p&gt;
&lt;p&gt;وانتشر الفساد في المراكز الدينية، ويصف الراهب جروم (Jarum) انحطاط أخلاق البابوات وبيعهم
  المناصب وتأجيرهم أرض الجنة ومنحهم شهادات النجاة وإجازات حل المحرمات. لكن من أعظم أخطاء
  رجال الدين في أوربا أنهم دسوا في كتبهم الدينية المقدسة معلومات بشرية ومسلمات عصرية ربما
  كانت أقصى ما وصل إليه العلم تلك الأيام. وكان ذلك سبباً للكفاح المشؤوم بين الدين والعلم
  حيث أعلن علماء ذلك العصر عدم إيمانهم ببعض ما في الكتب المقدسة مما كان قد دسه رجال الدين،
  فقامت قيامة الكنيسة وقام رجالها بتكفير واستحلال دماء أولئك العلماء، وأنشؤوا محاكم
  التفتيش. هنالك ثار المجددون المتنورون وأصبحوا حرباً لرجال الدين ومقتوا كل ما يتصل بهم،
  وعادوا الدين المسيحي أولاً والدين المطلق ثانياً. انهزم الدين المختلِط بعلم البشر أمام
  العلم في تلك المعركة، وسقط رجال الدين سقوطاً لم ينهضوا بعده. وشر من ذلك أن أوربا أصبحت
  لا دينية.&lt;/p&gt;
&lt;p&gt;انصرف اتجاه الغرب إلى المادية بكل معانيها، فقام علماء الفلسفة والعلوم الطبيعية ينظرون
  في الكون نظراً مؤسساً على أنه على أنه لا خالق ولا مدبر ولا آمر، وليس هناك قوة وراء
  الطبيعة والمادة تتصرف في هذا العالم. وسموا كل بحث وفكر يعتقد بوجود إله ويؤمن به طريقاً
  تقليدياً لا يقوم عندهم على أساس العلم والحكمة، واستهزأوا به واتخذوه سخرياً، ثم انتهى بهم
  طريقهم الذي اختاروه وبحثهم ونظرهم إلى أنهم جحدوا كل شيء وراء الحركة والمادة. &lt;/p&gt;
&lt;p&gt;وأحدث الأدباء والمؤلفون، خصوصاً في ثورة فرنسا وبعدها، الثورة على الأخلاق القديمة،
  والنظم الاجتماعية، وزينوا للناس الإثم، ونشروا دعوة الإباحة، وإطلاق الطبائع من كل قيد،
  والفرد من كل مسئولية، ودعوا إلى إرضاء الشهوات، وانتهاب المسرات، وغلوا وأسرفوا في تقدير
  قيمة هذه الحياة وجحدوا كل شيء سوى اللذة العاجلة والنفع المادي الظاهر المحسوس. يقول
  الأستاذ محمد أسد (ليوبولد فايس سابقاً): &amp;quot;إن الحضارة الغربية لا تجحد الله في شدة
  وصراحة، ولكن ليس في نظامها الفكري موضع لله في الحقيقة ولا تعرف له فائدة ولا تشعر بحاجة
  إليه&amp;quot;. &lt;/p&gt;
&lt;p&gt;وكان من نتائج هذه المادية الجارفة، والتربية اللادينية التي ليس فيها نصيب للأخلاق ومخافة
  الله عز وجل، والإيمان بالآخرة أن أصحاب المراكز الكبيرة، ورجال السياسة والمسئولية يرتكبون
  في بعض الأحيان جنايات لا يتنزل إليها أكبر الآثمين. وذلك لمصلحة سياسية وهمية لبلادهم
  وأمتهم أو لجاه شخصي أو ربح مالي مثل تأييد ترومان للصهيونية، ودولة إسرائيل في فلسطين،
  ومعارضته للقضية العربية التي لا غبار عليها، لأجل أن يكسب ود اليهود ويتمتع بنفوذهم
  السياسي والمالي والصحافي، وليكسب انتخابه، وتعاميه عن براهين الدولة العربية الساطعة،
  وسكوت أمريكا على فظائع فرنسا في الجزائر، ووقوفها بجوار هذه الدولة الجائرة في قضية
  الجزائر العربية الإسلامية، وتعاونها على الإثم والعدوان. &lt;/p&gt;
&lt;p&gt;إن البذرة الخبيثة التي ألقيت في تربة أوربا في نهضتها الثانية لم تأت عليها قرون حتى نبتت
  منها دوحة خبيثة، ثمارها حلوة ولكنها سامة، أزهارها جميلة ولكنها شائكة، فروعها مخضرة
  ولكنها تنفث غازاً ساماً لا يرى، ولكنه يسمم دم النوع البشري. &lt;/p&gt;
&lt;p&gt;إن رجل العصر قد لزم الحياد التام في مسائل الآخرة وصرف النظر عنها , فلا عليه إن كانت بعد
  هذه الحياة حياة ثانية وكانت الجنة والنار والثواب والعقاب والنجاة والهلاك أو لم تكن، لأن
  شيئاً من ذلك لا يمس مسائلة اليومية أو في آخر الشهر، ولا يتصل بشخصه وعياله في الساعة
  الحاضرة، فهو رجل جد وعمل، لا يعرف إلا حياة المصانع والإدارات وسير الماكينات ولا يهتم إلا
  بتسلية النفس وترويحها في آخر النهار والنوم الهادئ في آخر الليل والأجرة في آخر الأسبوع أو
  الراتب في أواخر الشهور وحساب الأرباح في آخر السنة وإعادة الصحة والشباب في آخر العمر وأما
  ما بعد الحياة فهو عنده مجهول ووهم من الأوهام: {بَلِ ادَّارَكَ عِلْمُهُمْ فِي الْآخِرَةِ
  بَلْ هُمْ فِي شَكٍّ مِّنْهَا بَلْ هُم مِّنْهَا عَمِونَ}. ذلك الضرب من الناس لم يترك
  اشتغالهم بالحياة الدنيا والعكوف عليها فراغاً لدعوة دينية، وإن الذين يدعوهم إلى الدين
  والحياة الأخروية ليتحير معهم فلا يجد منفذاً يدخل منه إلى عقولهم، ويدخل به دعوته الدينية
  إلى نفوسهم، فقد أقفلت الحياة المادية ومسائلها جميع أبوابها وسدت جميع نوافذ فكرهم. والذي
  مني بهذا الضرب من الناس يفهم السر في قوله تعالى: {خَتَمَ اللهُ عَلَى قُلُوبِهمْ وَعَلَى
  سَمْعِهِمْ وَعَلَى أَبْصَارِهِمْ غِشَاوَةٌ} ، {أَمْ تَحْسَبُ أَنَّ أَكْثَرَهُمْ
  يَسْمَعُونَ أَوْ يَعْقِلُونَ إِنْ هُمْ إِلَّا كَالْأَنْعَامِ بَلْ هُمْ أَضَلُّ سَبِيلاً}
  ولم يلق في شرحها وتعليلها ما لقيه المفسرون الذين لم يشاهدوا هذا النوع من صعوبة. &lt;/p&gt;
&lt;h3&gt;بعد المادية&lt;/h3&gt;
&lt;p&gt;لما طغى بحر المادية في العالم الإسلامي في العهد الأخير وفاض، كون رجال الدين جزراً صغيرة
  في بحر المادية المحيط، يلجأ إليها الفارون إلى الله والمتبرمون من الحياة المادية والغفلة،
  كان فيها رجال هم كمنارات النور في بحر الظلمات، فمثلاً كان السيد آدم البنوري الهندي (م
  1053 هـ) دفين البقيع يأكل على مائدته كل يوم ألف رجل، ويمشي في ركابه ألوف الرجال ومئات من
  العلماء. وهذا الشيخ محمد معصوم (م 1079) ابن الشيخ الكبير أحمد السرهندي قد بايعه وتاب على
  يده تسعمائة ألف من الرجال، واستخلف في دعاء الخلق إلى الله وإرشاد الناس وتربيتهم الدينية
  سبعة آلاف من الرجال. وهذه ابنه الشيخ سيف الدين السرهندي (م 1096) كان يأكل على مائدته ألف
  وأربعمائة، ويقترحون الأطعمة ويتخيرونها… وهذه أمثلة التقطناها على عجل من تاريخ الهند
  الإسلامي ولمحات عابرة فيه؛ ولو ذهبنا نستقصي أمثلته وشواهده من تاريخ الإسلام العام ومن
  تراجم الرجال الدينيين وسيرهم في بلاد الشام ومصر والمغرب الأقصى والعراق لكان مجلداً
  كبيراً.&lt;/p&gt;
&lt;p&gt;واستمر هذا الإقبال على الدين والهجرة في طلب العلم النافع والعمل الصالح، وتجشم الأسفار
  والأخطار لزكية النفس وتهذيب الخلق والتوصل إلى معالم الرشد والاستعداد للآخرة إلى أول عهد
  الاستعمار الأوربي.&lt;br /&gt;&lt;/p&gt;
&lt;h4&gt;استعمار الإنجليز للهند&lt;/h4&gt;
&lt;p&gt;استعمر الإنجليز الهند ورسخت قدمهم فيها وأصبح نظامهم التعليمي - وهو من أكبر جنودهم -
  يؤتي أكله كل حين، وتسربت في الناس أفكارهم وميولهم، فصارت تقلب نظام الحياة ونظام الفكر في
  الهند رأساً على عقب من حيث لا يشعر أهلها فتقاصرت الهمم في الدين وخمدت جذوة القلوب
  وانطفأت شعلة الحياة الدينية، وانصرفت الرغبات والأهواء والتنافس الطبيعي من الدين
  والروحانية إلى المعاش والمادة.&lt;/p&gt;
&lt;p&gt;سرى الشك وسوء الظن في الأوساط الدينية والبيوت العريقة في الدين والعلم بتأثير المحيط
  وبتأثير التعاليم الإفرنجية وضعفت الثقة بالله وبصفاته وبمواعيده، فأصبح الآباء يضنون
  بأولادهم على الدين، ولا يخاطرون بأوقاتهم وقواهم في سبيل الدين وعلوم الدين، وأصبحوا
  يعلمونهم العلوم المعاشية واللغات الإفرنجية، لا رغبة في تحصيل المفيد النافع ولا دفاعاً عن
  الإسلام بل زهداً في الدين وفراراً من خطر المستقبل وخوفاً على أفلاذ أكبادهم من الضياع
  واستسلاماً للدهر المتقلب، وتسلط عليهم خوف الفقر حتى أصبحوا من خوف الموت في الموت.&lt;/p&gt;
&lt;h3&gt;ماذا بعد؟&lt;/h3&gt;
&lt;p&gt;إذا كان العالم الإسلامي لا يرمي إلا إلى ما تراه أوربا من العرض القريب، ولا يطمح إلا
  فيما تطمح فيه أوربا من حطام الدنيا، ولا يؤمن إلا بما تؤمن به أوربا من المحسوسات
  والماديات، كانت أوربا بقوتها المادية أحق بالانتصار والسيادة من العالم الإسلامي الذي
  يتخلف عنها في القوة المادية تخلفاً شائناً ولا يفوقها في القوة المعنوية. &lt;/p&gt;
&lt;p&gt;فالمهم الأهم لقادة العالم الإسلامي، وجمعياته وهيئاته الدينية وللدول الإسلامية غرس
  الإيمان في قلوب المسلمين وإشعال العاطفة الدينية، ونشر الدعوة إلى الله ورسوله، والإيمان
  بالآخرة على منهاج الدعوة الإسلامية الأولى، لا تدخر في ذلك وسعاً، وتستخدم لذلك جميع
  الوسائل القديمة والحديثة. والقرآن وسيرة محمد صلى الله عليه وسلم قوتان عظيمتان تستطيعان
  أن تشعلا في العالم الإسلامي نار الحماسة والإيمان، وتحدثا في كل وقت ثورة عظيمة على العصر
  الجاهلي.&lt;/p&gt;
&lt;p&gt;ولكن مهمة العالم الإسلامي لا تنتهي هنا، فإذا أراد أن يضطلع برسالة الإسلام ويملك قيادة
  العالم فعليه بالمقدرة الفائقة، والاستعداد التام في العلوم والصناعة والتجارة وفن الحرب،
  وأن يستغني عن الغرب في كل مرفق من مرافق الحياة، وفي كل حاجة من الحاجات. إن العالم العربي
  لا يستطيع أن يحارب الغرب - إذا احتاج إلى ذلك ودعت إليه الظروف - وهو مدين له في ماله،
  عيال عليه في لباسه وبضائعه، لا يجد قلماً يوقع به على ميثاق مع الغرب إلا القلم الذي صنع
  في الغرب، ولا يجد ما يقاتل به الغرب إلا الرصاص الذي أفرغ في الغرب، إن عاراً على الأمة
  العربية أن تعجز عن الانتفاع بمنابع ثروتها وقوتها، وأن يجري ماء الحياة في عروقها
  وشرايينها إلى أجسام غيرها، وأن يدرب جيوشها وكلاء الغرب وضباطه، ويدير بعض مصالح حكومتها
  رجاله، فلابد للعالم العربي أن يقوم هو نفسه بحاجاته: تنظيم التجارة والمالية، وحركة
  التوريد والتصدير، والصناعة الوطنية، وتدرب الجيش، وصنع الآلات والماكينات وتربية الرجال
  الذين يضطلعون بجميع مهمات الدولة ووظائف الحكومة في خبرة ومهارة فنية، وأمانة ونصيحة. &lt;/p&gt;
&lt;h3&gt;عن الحروب الإسلامية&lt;/h3&gt;
&lt;p&gt;{الَّذِينَ آمَنُواْ يُقَاتِلُونَ فِي سَبِيلِ اللهِ وَالَّذِينَ كَفَرُواْ يُقَاتِلُونَ
  فِي سَبِيلِ الطَّاغُوتِ فَقَاتِلُواْ أَوْلِيَاء الشَّيْطَانِ إِنَّ كَيْدَ الشَّيْطَانِ
  كَانَ ضَعِيفاً}. هذه الحروب التي لم يشهد التاريخ أيمن منها وأقل إراقة للدماء وذهاباً
  بالنفس، ولا أعود منها على الإنسانية بالصالح العام والخير المشترك والسعادة جمعاء فلا يربو
  عدد المقتولين من الفريقين (المسلم والكافر) في جميع الغزوات والسرايا والمناوشات التي
  ابتدأت من السنة الثانية للهجرة، ودامت إلى السنة التاسعة على ألف وثمانية عشر نفساً 1018
  المسلمون منهم 259 والكفار 759، أما المصابون في حرب 1914-1918 الكونية فيبلغ عددهم على
  الأصح واحداً وعشرين مليون نسمة، عدد المقتولين منهم سبعة ملايين. أما القنبلة الذرية التي
  جربتها أمريكا مرة في صحراء نيوميكسيكو، وثانية على رؤوس البشر في مدينة هيروشيما، وبعدها
  في نجازاكي المدينتين اليابانيتين، فقد أذاع رئيس بلدة (هيروشيما) في 20 أغسطس آب 1949 م أن
  الذين هلكوا في اليوم السادس من أغسطس آب 1945 م من اليابانيين يتراوح عددهم بين مائتي ألف
  وعشرة آلاف ومائتي ألف وأربعين ألفاً. &lt;/p&gt;
&lt;p&gt;ثم كانت الحروب الدينية الإسلامية حاقنة للدماء عاصمة للنفوس والأموال وفاتحة عهد السعادة
  والغبطة في العالم، أما حرب التنافس والحمية الجاهلية التي تدعى الحرب الكبرى فقد كانت
  مقدمة حروب متسلسلة.&lt;/p&gt;
&lt;p&gt;يقول الأستاذ جود (Joad): الانجليزي يعتقد أن الإنجليز أمة سلمية ويرمي اليابانيين بحب
  القتال والضراوة بالحروب. والإنجليز لا شك أمة سلمية، ولكن مسالمتهم مسالمة لص قد اعتزل
  حرفته القديمة، وقد أحرز شرفاً وجاهاً بفضل غنائمه السابقة، وهو يبغض الذين يدخلون جديداً
  في حرفته القديمة.&lt;/p&gt;</content><category term="كتب"/><category term="ملخص-كتاب"/><category term="الإسلام"/><category term="الحضارة-الإسلامية"/><category term="الحضارة-الغربية"/><category term="تحديات-العصر"/></entry><entry><title>موقع مفيد قبل أن تشتري عطراً</title><link href="https://ammar-alyousfi.com/ar/2018/a-useful-website-before-you-buy-a-perfume.html" rel="alternate"/><published>2018-05-26T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-05-26:/ar/2018/a-useful-website-before-you-buy-a-perfume.html</id><summary type="html">&lt;p&gt;رابط الموقع: &lt;a href='https://www.fragrantica.com/'&gt;https://www.fragrantica.com/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;موقع رائع لمن يريد أن يشتري عطراً؛ يعرض الموقع معلومات تفصيلية عن كل نوع من أنواع
  العطور: النكهات التي يحتويها العطر (العليا، والمتوسطة، والأساسية)، وتقييم الناس له ومتى
  يفضلون استخدامه (ليلاً أم نهاراً؛ صيفاً أم شتاء)، وكم تبقى رائحته، وصوره، وغير ذلك.&lt;/p&gt;
&lt;p&gt;يمكنك أيضا …&lt;/p&gt;</summary><content type="html">&lt;p&gt;رابط الموقع: &lt;a href='https://www.fragrantica.com/'&gt;https://www.fragrantica.com/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;موقع رائع لمن يريد أن يشتري عطراً؛ يعرض الموقع معلومات تفصيلية عن كل نوع من أنواع
  العطور: النكهات التي يحتويها العطر (العليا، والمتوسطة، والأساسية)، وتقييم الناس له ومتى
  يفضلون استخدامه (ليلاً أم نهاراً؛ صيفاً أم شتاء)، وكم تبقى رائحته، وصوره، وغير ذلك.&lt;/p&gt;
&lt;p&gt;يمكنك أيضاً تصفح العطور التي تحتوي على نكهة معينة (ياسمين؛ كرز؛ عود هندي؛ كهرمان؛ شجر
  خشب الأبنوس، إلخ) من &lt;a href='https://www.fragrantica.com/notes/'&gt;هنا&lt;/a&gt;. وهناك أيضاً
  قوائم لأفضل العطور على مر الزمان، وأفضل عطور الرجال حسب تصويت النساء، وأفضل العطور ذات
  الأسعار المنخفضة نسبياً، وغيرها يمكن تصفحها من &lt;a
    href='https://www.fragrantica.com/awards/'&gt;هنا&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</content><category term="أدوات"/><category term="عطور"/></entry><entry><title>A Great Resource to Enjoyably Start Learning Python</title><link href="https://ammar-alyousfi.com/2018/a-great-resource-to-enjoyably-start-learning-python.html" rel="alternate"/><published>2018-05-19T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-05-19:/2018/a-great-resource-to-enjoyably-start-learning-python.html</id><summary type="html">&lt;p&gt;I think it is one of the best resources to start learning Python in a way that lets you
  really build interesting applications that you can use in your life; for example,
  applications that let you do things that would take normally a long time in a very short
  time …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I think it is one of the best resources to start learning Python in a way that lets you
  really build interesting applications that you can use in your life; for example,
  applications that let you do things that would take normally a long time in a very short
  time, applications that harness the great computing power of your device for your uses.
  With this resource, you will be able to make programs that can show you real-world uses
  of programming. The resource is a book named &amp;quot;Automate the Boring Stuff With
  Python&amp;quot; by Al Sweigart. It is available online for free on this link: &lt;a
    href='https://automatetheboringstuff.com/'&gt;Click here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Check the book, and let me know if it worked for you like it did for me.&lt;/p&gt;</content><category term="Python"/><category term="data-science"/><category term="python"/><category term="resources"/></entry><entry><title>Biomimicry: Mimicking Nature to Solve Problems</title><link href="https://ammar-alyousfi.com/2018/biomimicry-mimicking-nature-to-solve-problems.html" rel="alternate"/><published>2018-04-09T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-04-09:/2018/biomimicry-mimicking-nature-to-solve-problems.html</id><summary type="html">&lt;p&gt;
  &lt;img class="featured-image"
    src="/assets/images/2018/biomimicry.png" /&gt;
&lt;/p&gt;
&lt;p&gt;In 1989, Japan&amp;#39;s Shinkansen Bullet Train had a problem: it caused a loud sound
  whenever it exited a tunnel, a sound that could be heard 400 meters away. This
  constituted an annoying problem for people who were living near those tunnels. So, Japan
  decided to design a new train …&lt;/p&gt;</summary><content type="html">&lt;p&gt;
  &lt;img class="featured-image"
    src="/assets/images/2018/biomimicry.png" /&gt;
&lt;/p&gt;
&lt;p&gt;In 1989, Japan&amp;#39;s Shinkansen Bullet Train had a problem: it caused a loud sound
  whenever it exited a tunnel, a sound that could be heard 400 meters away. This
  constituted an annoying problem for people who were living near those tunnels. So, Japan
  decided to design a new train; the new train had components that were based on birds:
  Owls inspired the &lt;a
    href='https://www.google.com/search?tbm=isch&amp;amp;q=train+pantograph'&gt;pantogragh&lt;/a&gt;;
  the Adelie Penguin inspired the pantograph supporting shaft; and most notably, the
  kingfisher whose unique beak inspired the train nose which reduced the noise to be under
  the noise limit in residential areas. There is a name for designs like this: it is
  called &lt;strong&gt;biomimicry&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The term &amp;quot;Biomimicry&amp;quot; was coined by Janine Benyus who wrote a book named
  &amp;quot;Biomimicry: Innovation Inspired by Nature&amp;quot; that told the story of innovations
  in computing, energy, and health that were inspired by the natural world. She suggests
  that designers should bring a biologist to the table to help in solving problems by
  mimicking nature.&lt;/p&gt;

&lt;p&gt;This post is based completely on the following video from Vox:&lt;/p&gt;
&lt;p&gt;&lt;iframe width="560" height="315"
    src="https://www.youtube-nocookie.com/embed/iMtXqTmfta0?rel=0" frameborder="0"
    allow="autoplay; encrypted-media" allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</content><category term="design"/></entry><entry><title>A Simple Introduction to Understand Machine Learning</title><link href="https://ammar-alyousfi.com/2018/a-simple-introduction-to-understand-machine-learning.html" rel="alternate"/><published>2018-03-12T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-03-12:/2018/a-simple-introduction-to-understand-machine-learning.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2018/intro-ml.jpg" class="featured-image"&lt;&lt;/p&gt;
&lt;h3&gt;What Is Machine Learning?&lt;/h3&gt;
&lt;p&gt;Machine learning is a field of computer science that gives computer systems the ability to &amp;quot;learn&amp;quot; (i.e. gradually improve performance on a specific task) with data, without being explicitly programmed.&lt;/p&gt;
&lt;p&gt;Machine learning is employed in a range of computing tasks where designing and programming explicit …&lt;/p&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2018/intro-ml.jpg" class="featured-image"&lt;&lt;/p&gt;
&lt;h3&gt;What Is Machine Learning?&lt;/h3&gt;
&lt;p&gt;Machine learning is a field of computer science that gives computer systems the ability to &amp;quot;learn&amp;quot; (i.e. gradually improve performance on a specific task) with data, without being explicitly programmed.&lt;/p&gt;
&lt;p&gt;Machine learning is employed in a range of computing tasks where designing and programming explicit algorithms with good performance is difficult or impossible.&lt;/p&gt;
&lt;p&gt;Machine learning, when used as a data-analytics tool, allows researchers, data scientists, engineers, and analysts to produce reliable, repeatable decisions and results, and uncover hidden insights through learning from historical relationships and trends in the data.&lt;/p&gt;
&lt;p&gt;If machine learning isn&amp;#39;t new, why is there so much interest today?
Machine learning algorithms need a lot of data and computing power to produce useful results. Today, we have more data than ever, and computing power is common and cheap. Now we can automatically apply complex mathematical calculations to big data over and over, faster and faster. &lt;/p&gt;
&lt;p&gt;Think of machine learning as a means of building models of data. Once these models have been fit to previously seen data, they can be used to predict and understand aspects of newly observed data. &lt;/p&gt;
&lt;p&gt;Traditional computer science faces a major limitation regarding the task of extending human intelligence: we first need to explain to the computer how to perform the task we want to accomplish. For example, to create a mathematical software, we first must write a program that explains to the computer how to do each mathematical operation.However, what if the task we want to program is a more complex one? Or what if we need to program a task but we don’t even know how such a task is done?Let’s think about when we teach a kid how to identify different kinds of animals. You cannot start describing the characteristics of every animal like: “If the animal is within this range of colors and has black vertical stripes with a slightly elliptical shape and has a nose like… then it is a tiger”. Can you imagine using that teaching strategy with kids? It would be impossible and would take forever. In most cases you wouldn’t even be sure which features of each animal you are using to identify it. Instead, what we do is to show pictures of animals to children together with some specific tips, and this way they unconsciously learn what features are those that identify each animal.The need to make a program that explains to computers how to perform each task is the great limitation faced by traditional computer science programming. It has prevented computers from further extending our intelligence to solve more complex tasks. Here is where Machine Learning comes to the rescue.for the task of teaching a computer to identify animals, we will show to the computer a bunch of labeled pictures (e.g. this picture is a tiger, this pictures is a cat, etc.), the same way we do it when we teach children. The Machine Learning algorithm will use these samples to identify which are the features that differentiate one animal from another, and with this information it will write its own program to perform the task of identifying animals&lt;/p&gt;
&lt;h3&gt;Methods of Machine Learning&lt;/h3&gt;
&lt;p&gt;There are two broad methods of machine learning algorithms, depending on whether there is a feedback available to the learning system:&lt;/p&gt;
&lt;h5&gt;Supervised learning&lt;/h5&gt;
&lt;p&gt;The computer is presented with example inputs and their desired outputs, given by a &amp;quot;teacher&amp;quot;, and the goal is to learn a general rule that maps inputs to outputs. Supervised learning is commonly used in applications where historical data predicts likely future events. For example, it can anticipate when credit card transactions are likely to be fraudulent or which insurance customer is likely to file a claim.
Supervised learning involves somehow modeling the relationship between measured features of data and some label associated with the data; once this model is determined, it can be used to apply labels to new, unknown data. This is further subdivided into classification tasks and regression tasks: in classification, the labels are discrete categories, while in regression, the labels are continuous quantities.
For example, with supervised learning, an algorithm may be fed data with images of sharks labeled as &lt;code&gt;fish&lt;/code&gt; and images of oceans labeled as &lt;code&gt;water&lt;/code&gt;. By being trained on this data, the supervised learning algorithm should be able to later identify unlabeled shark images as &lt;code&gt;fish&lt;/code&gt; and unlabeled ocean images as &lt;code&gt;water&lt;/code&gt;.
&lt;h5&gt;Unsupervised learning&lt;/h5&gt;
&lt;p&gt;No labels are given to the learning algorithm, leaving it on its own to find structure in its input. The goal is to explore the data and find some structure within. For example, it can identify segments of customers with similar attributes who can then be treated similarly in marketing campaigns. Or it can find the main attributes that separate customer segments from each other.
Unsupervised learning involves modeling the features of a dataset without reference to any label, and is often described as &amp;quot;letting the dataset speak for itself.&amp;quot; These models include tasks such as clustering and dimensionality reduction. Clustering algorithms identify distinct groups of data, while dimensionality reduction algorithms search for more succinct representations of the data.
You may have a large dataset of customers and their purchases, but as a human you will likely not be able to make sense of what similar attributes can be drawn from customer profiles and their types of purchases. With this data fed into an unsupervised learning algorithm, it may be determined that women of a certain age range who buy unscented soaps are likely to be pregnant, and therefore a marketing campaign related to pregnancy and baby products can be targeted to this audience in order to increase their number of purchases.&lt;/p&gt;

&lt;p&gt;There are some other methods also like semi-supervised learning and reinforcement learning.&lt;/p&gt;
&lt;h3&gt;Machine Learning Applications&lt;/h3&gt;
&lt;p&gt;There are a lot of interesting applications of machine learning. Some are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Self-driving Google car.&lt;/li&gt;
&lt;li&gt;Fraud detection.&lt;/li&gt;
&lt;li&gt;Web search results.&lt;/li&gt;
&lt;li&gt;Real-time ads on web pages and mobile devices.&lt;/li&gt;
&lt;li&gt;Text-based sentiment analysis.&lt;/li&gt;
&lt;li&gt;Prediction of equipment failure.&lt;/li&gt;
&lt;li&gt;Email spam filtering.&lt;/li&gt;
&lt;li&gt;A computer program &amp;quot;AlphaGo&amp;quot; defeated one of the best human players at Go which is a strategy game. Many masters could not fathom how it would be possible for a machine to grasp the full nuance and complexity of this ancient Chinese war strategy game, with its 10¹⁷⁰ possible board positions. Watch a 3-minutes video about this &lt;a href='https://www.youtube.com/watch?v=SUbqykXVx0A'&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;On August 11, 2017, OpenAI reached yet another incredible milestone by defeating the world’s top professionals in 1v1 matches of the online multiplayer game Dota 2. See the full match at The International 2017, with Dendi (human) vs. OpenAI (bot), on &lt;a href='https://www.youtube.com/watch?v=wiOopO9jTZw'&gt;YouTube&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In 2012, co-founder of Sun Microsystems Vinod Khosla predicted that 80% of medical doctors jobs would be lost in the next two decades to automated machine learning medical diagnostic software.&lt;/li&gt;
&lt;li&gt;In 2014, it has been reported that a machine learning algorithm has been applied in Art History to study fine art paintings, and that it may have revealed previously unrecognized influences between artists.&lt;/li&gt;
&lt;li&gt;Facial recognition technology which for example allows social media platforms to help users tag and share photos of friends.&lt;/li&gt;
&lt;li&gt;Recommendation engines, powered by machine learning, suggest what movies or television shows to watch next based on user preferences.&lt;/li&gt;
&lt;li&gt;Speech and handwriting recognition.&lt;/li&gt;
&lt;li&gt;Adaptive websites which are websites that build a model of user activity and modify the information and/or presentation of information to the user in order to better address the user&amp;#39;s needs.&lt;/li&gt;
&lt;li&gt;Affective computing which is the study and development of systems and devices that can recognize, interpret, process, and simulate human emotions.&lt;/li&gt;
&lt;li&gt;Natural-language processing which is a field concerned with the interactions between computers and human (natural) languages.&lt;/li&gt;

&lt;/ul&gt;
&lt;h3&gt;Programming Languages for Machine Learning&lt;/h3&gt;
&lt;p&gt;From &lt;a href='https://www.ibm.com/developerworks/community/blogs/jfp/entry/What_Language_Is_Best_For_Machine_Learning_And_Data_Science'&gt;data taken from job ads&lt;/a&gt; on indeed.com in December 2016, it can be inferred that Python is the most sought-for programming language in the machine learning professional field. Python is followed by Java, then R, then C++.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt;’s popularity may be due to the increased development of deep learning frameworks available for this language recently, including &lt;a href='https://www.tensorflow.org/'&gt;TensorFlow&lt;/a&gt;, &lt;a href='http://pytorch.org/'&gt;PyTorch&lt;/a&gt;, and &lt;a href='https://keras.io/'&gt;Keras&lt;/a&gt;. As a language that has readable syntax and the ability to be used as a scripting language, Python proves to be powerful and straightforward both for preprocessing data and working with data directly.&lt;/p&gt;
&lt;h3&gt;Bias!&lt;/h3&gt;
&lt;p&gt;Although data and computational analysis may make us think that we are receiving objective information, this is not the case; being based on data does not mean that machine learning outputs are neutral. Human bias plays a role in how data is collected, organized, and ultimately in the algorithms that determine how machine learning will interact with that data.&lt;/p&gt;
&lt;p&gt;If, for example, people are providing images for “fish” as data to train an algorithm, and these people overwhelmingly select images of goldfish, a computer may not classify a shark as a fish. This would create a bias against sharks as fish, and sharks would not be counted as fish.&lt;/p&gt;
&lt;p&gt;Because human bias can negatively impact others, it is extremely important to be aware of it, and to also work towards eliminating it as much as possible. One way to work towards achieving this is by ensuring that there are diverse people working on a project and that diverse people are testing and reviewing it. &lt;/p&gt;
&lt;h3&gt;References&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href='https://www.cloudera.com/glossary/what-is-machine-learning.html'&gt;What is machine learning? - Cloudera&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://en.wikipedia.org/wiki/Machine_learning#Applications'&gt;Machine learning - Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://en.wikipedia.org/wiki/Affective_computing'&gt;Affective computing - Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://en.wikipedia.org/wiki/Adaptive_website'&gt;Adaptive website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://en.wikipedia.org/wiki/Natural-language_processing'&gt;Natural-language processing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://www.sas.com/en_sg/insights/analytics/machine-learning.html'&gt;Machine Learning. What it is and why it matters - SAS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://medium.com/machine-learning-for-humans/why-machine-learning-matters-6164faf1df12'&gt;Machine Learning for Humans🤖👶 - Medium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://jakevdp.github.io/PythonDataScienceHandbook/05.01-what-is-machine-learning.html'&gt;Python Data Science Handbook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://www.quora.com/What-is-machine-learning-4'&gt;What is machine learning? - Quora answer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://www.digitalocean.com/community/tutorials/an-introduction-to-machine-learning'&gt;An Introduction to Machine Learning - Digital Ocean&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;</content><category term="data-science"/><category term="data-science"/><category term="machine-learning"/></entry><entry><title>A Short Introduction to Data Science</title><link href="https://ammar-alyousfi.com/2018/a-short-introduction-to-data-science.html" rel="alternate"/><published>2018-02-11T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-02-11:/2018/a-short-introduction-to-data-science.html</id><summary type="html">&lt;p&gt;&lt;img src="/assets/images/2018/f-data-science.jpg" class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Harvard Business Review&lt;/em&gt; calls data science the “sexiest” job of the 21st century and it’s showing huge promise for those looking to switch careers or get started with a rewarding position.&lt;/p&gt;
&lt;h4&gt;What Is Data Science?&lt;/h4&gt;
&lt;p&gt;It is the process of drawing useful conclusions from data using computers.&lt;/p&gt;
&lt;h5&gt;What Is …&lt;/h5&gt;</summary><content type="html">&lt;p&gt;&lt;img src="/assets/images/2018/f-data-science.jpg" class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Harvard Business Review&lt;/em&gt; calls data science the “sexiest” job of the 21st century and it’s showing huge promise for those looking to switch careers or get started with a rewarding position.&lt;/p&gt;
&lt;h4&gt;What Is Data Science?&lt;/h4&gt;
&lt;p&gt;It is the process of drawing useful conclusions from data using computers.&lt;/p&gt;
&lt;h5&gt;What Is A Data Scientist?&lt;/h5&gt;
&lt;p&gt;The following diagram illustrates the skills a data scientist is expected to have:&lt;/p&gt;
&lt;p&gt;&lt;img src='/assets/images/2018/ds-skills.png' /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href='http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram'&gt;Source&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hacking skills in the diagram means programming-related skills.&lt;/p&gt;
&lt;p&gt;If you are working with a team, you don&amp;#39;t have to have all of the skills in the diagram; for example you might be strong in hacking skills and statistics, and your colleague might have the substantive expertise required, so you can complete each other and form a team.&lt;/p&gt;
&lt;h4&gt;Different Names&lt;/h4&gt;
&lt;p&gt;Data analysis have different names depending on the field it is used in. For example, it can be called:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bioinformatics: when dealing with medical data&lt;/li&gt;
&lt;li&gt;Data Science: for data from web analytics.&lt;/li&gt;
&lt;li&gt;Machine Learning: for data in computer science or computer vision.&lt;/li&gt;
&lt;li&gt;Natural Language Processing: when dealing with data in the text form&lt;/li&gt;
&lt;li&gt;Signal Processing: when dealing with electrical signals&lt;/li&gt;
&lt;li&gt;Business Analytics: when dealing with data on customers&lt;/li&gt;
&lt;li&gt;Econometrics: when dealing with economic data, etc&lt;/li&gt;

&lt;/ul&gt;
&lt;h4&gt;Where does data come from?&lt;/h4&gt;
&lt;p&gt;There are a lot or sources that data can come from. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customer behavior records: what customers buy and when&lt;/li&gt;
&lt;li&gt;Text: text from books, magazines, and the Internet&lt;/li&gt;
&lt;li&gt;Video&lt;/li&gt;
&lt;li&gt;Climate records: data about weather for the past ten years&lt;/li&gt;
&lt;li&gt;Health records: hospital records about its patients and their related data&lt;/li&gt;
&lt;li&gt;Governmental records: about crimes; when they happen and where&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;These are a few examples. In our world now, there are a multitude of resources that data can come from.&lt;/p&gt;
&lt;h4&gt;Why Data Science?&lt;/h4&gt;
&lt;p&gt;Now, data is everywhere in huge amounts; with 400 hours of video uploaded to YouTube every minute, and 350000 tweets sent on Twitter every minute; with many organizations collecting data like what United States government does in &lt;a href='https://www.data.gov/'&gt;data.gov&lt;/a&gt; where it shares data it collects in multiple domains like health, climate, education, etc. With all of that data, and considering the complexity of our world nowadays, we need an efficient, fast, and reliable way to deal with data and get useful conclusions from it, and here where comes data science which uses computer power to deal with data rather than using human power because humans need a very long time to process and analyze the huge amounts of data available today, and they might overlook some aspects in their conclusions.&lt;/p&gt;
&lt;h4&gt;Where Data Science Is Used?&lt;/h4&gt;
&lt;p&gt;Data science is used in an increasing number of fields. It is used in the domains of healthcare, retailing, mobile networks, economy and finance, oil and gas, etc. &lt;/p&gt;
&lt;p&gt;Generally, data science uses data for two purposes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;to describe some phenomenon&lt;/li&gt;
&lt;li&gt;to predict the future&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;Data science has many interesting applications. For example, it is used to build recommendation systems like product recommendation on Amazon and connection recommendation on LinkedIn; it is used also in image and speech recognition where computer can identify the contents of an image and the words of a speech; it is used by companies to detect fraudulent activities; it is used in building self-driving cars and robots; it is used to predict medical diagnosis, and the list goes on and on.&lt;/p&gt;
&lt;h4&gt;What Tools Data Scientists Use?&lt;/h4&gt;
&lt;p&gt;This question actually needs a dedicated post to talk about because there are a lot of tools to use. However, one of the most used tools in data science is Python: it has useful libraries like NumPy which facilitates dealing with multidimensional arrays and provides many useful mathematical functions, and Pandas which handles data in a way suited for analysis; it takes the best parts of R programming language and implements them in Python.&lt;/p&gt;
&lt;h4&gt;Data Science Specialties&lt;/h4&gt;
&lt;p&gt;Some of data science specialties are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data Visualization: make infographics that are great tools to visualize.&lt;/li&gt;
&lt;li&gt;Educator: start a blog or a YouTube channel. A lot of people want to learn about data science these days.&lt;/li&gt;
&lt;li&gt;Programmer: there is a lot of programming in data science.&lt;/li&gt;
&lt;li&gt;Researcher: going to a graduate school is one of the best strategies here.&lt;/li&gt;

&lt;/ul&gt;
&lt;h4&gt;Sources&lt;/h4&gt;
&lt;p&gt;&lt;a href='https://www.youtube.com/watch?v=KOAeaZrS418'&gt;Demystifying Data Science (video)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href='http://public.dhe.ibm.com/software/data/sw-library/analytics/smart-papers/watson-analytics-23-reasons/'&gt;23 Reasons to Get Excited About Data&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jeff Leek’s Data Analysis Coursera Class&lt;/p&gt;
&lt;p&gt;Udacity course: Intro to Data Science&lt;/p&gt;</content><category term="data-science"/><category term="data-science"/><category term="machine-learning"/><category term="data-scientist"/></entry><entry><title>مقتطفات من "الدليل المطلق لتصبح أفضل ما يمكن أن تكون عليه"</title><link href="https://ammar-alyousfi.com/ar/2018/summary-of-how-to-become-the-best-version-of-yourself.html" rel="alternate"/><published>2018-01-07T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2018-01-07:/ar/2018/summary-of-how-to-become-the-best-version-of-yourself.html</id><summary type="html">&lt;p&gt;هناك مقالة اشتُهرت على الإنترنت بعنوان &lt;a
    href='https://open.buffer.com/daily-success-routine/'&gt;&amp;quot;The Ultimate Guide to
    Becoming Your Best Self: Build your Daily Routine by Optimizing Your Mind, Body and
    Spirit&amp;quot;&lt;/a&gt; تتحدث عن تطوير روتين يومي في سبيل الوصول إلى تحسين نفسك إلى أعلى
  الدرجات، وهنا أضع بعض المقتطفات من هذه المقالة الطويلة؛ هذه المقتطفات …&lt;/p&gt;</summary><content type="html">&lt;p&gt;هناك مقالة اشتُهرت على الإنترنت بعنوان &lt;a
    href='https://open.buffer.com/daily-success-routine/'&gt;&amp;quot;The Ultimate Guide to
    Becoming Your Best Self: Build your Daily Routine by Optimizing Your Mind, Body and
    Spirit&amp;quot;&lt;/a&gt; تتحدث عن تطوير روتين يومي في سبيل الوصول إلى تحسين نفسك إلى أعلى
  الدرجات، وهنا أضع بعض المقتطفات من هذه المقالة الطويلة؛ هذه المقتطفات لا تعتبر ملخصاً
  للمقالة. سأعبر عن المقتطفات بطريقتي بعيداً عن الترجمة الحرفية:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;من فوائد أن تضع روتيناً يومياً أنه سيعطيك الدافع في الأيام التي لا تشعر فيها بالرغبة
    في العمل والتخطيط، وأنه سيقلل اعتمادك على التحفيز وقوة الإرادة.&lt;/li&gt;
  &lt;li&gt;قل لنفسك شيئاً إيجابياً أول ما تستيقظ مثل &amp;quot;اليوم سيكون أفضل يوم على الإطلاق إن
    شاء الله&amp;quot;؛ يساعد هذا على توجيه عقليتك وذهنك نحو الوجهة الصحيحة.&lt;/li&gt;
  &lt;li&gt;تصور نجاحك وتخيله لتسخر قوة عقلك الباطن.&lt;/li&gt;
  &lt;li&gt;اكتب ثلاث صفحات تفرغ فيها ما في عقلك؛ ليس من الضروري أن تكون مرتبة متناسقة الأفكار؛
    فقط فرغ ما في رأسك.&lt;/li&gt;
  &lt;li&gt;خذ قيلولة خلال يومك. استناداً إلى مؤسسة النوم الوطنية فإن قيلولة مدتها 20-30 دقيقة
    يمكن أن تساعد على تحسين المزاج والانتباه وحتى الأداء.&lt;/li&gt;
  &lt;li&gt;قم بأداء تنفس الطاقة ثلاث مرات في اليوم، في كل مرة قم به عشر مرات. طريقة التنفس هي
    أن تقوم بالشهيق لمدة خمس ثوان ثم تحبس النفس لمدة عشرين ثانية ثم تقوم بالزفير لمدة عشر
    ثوان. يمكن أن تعدل هذه الفترات كما تشاء، المهم أن تحافظ على النسبة فيما بينها.&lt;/li&gt;
  &lt;li&gt;اشرب 13 كوباً من الماء إن كنت رجلاً، و9 إن كنتِ امرأة؛ هذه هي الكميات الموصى بها من
    قبل المنظمة الطبية Mayo Clinic.&lt;/li&gt;
  &lt;li&gt;تقول كلية هارفرد الطبية أن البوليفينولات الموجودة في الشاي له عدة فوائد لجسمك مثل
    كونها مضادة للالتهابات وكونها تعطي فوائد شبيهة بفوائد مضادات الأكسدة. اشرب شاياً.&lt;/li&gt;
  &lt;li&gt;هناك مخاطر للجلوس طويلاً. يُنصح بأن تقف كل عشرين دقيقة لتقليل المخاطر.&lt;/li&gt;
  &lt;li&gt;تحرك. قم بأداء تمارين الدقائق السبع والتي يقول العلماء بفعاليتها. هناك تطبيقات
    مجانية على أجهزة الهاتف المحمول ترشدك بوضوح إلى كيفية أداء هذه التمارين.&lt;/li&gt;
  &lt;li&gt;قم بالنوم والاستيقاظ في نفس الوقت كل يوم ما أمكنك ذلك.&lt;/li&gt;
  &lt;li&gt;لا بد أن تمارس التأمل؛ فكر فيه على أنه وقت هادئ للجلوس مع نفسك. استعد لجني فوائده.
  &lt;/li&gt;
  &lt;li&gt;كن شاكراً. سؤال جميل يساعدك على معرفة كمية النعم في حياتك: إذا استيقظت غداً وعندك
    فقط الأشياء التي كنت شاكراً عليها اليوم، فماذا سيكون عندك؟؟&lt;/li&gt;
  &lt;li&gt;ابدأ صغيراً. الرابطة الأميركية لعلم النفس تقترح أنه لكي تحسن نجاحك، تحتاج لأن تركز
    على هدف أو تغيير واحد في وقت ما.&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;المقالة تحتوي على أكثر مما ذكرت، وبتفصيل أكثر. يمكنك الاطلاع عليها، لكن ما رأيك إن بدأت
  بفعل شيء من الأشياء المذكورة أعلاه وجعله عادة من عاداتك أولاً؟&lt;/p&gt;</content><category term="تطوير-ذات"/><category term="تنمية-ذات"/><category term="عادات-جيدة"/><category term="مقالة-مترجمة"/></entry><entry><title>نماذج من جمال الخط و المخطوطات العربية</title><link href="https://ammar-alyousfi.com/ar/2017/examples-of-the-beauty-of-arabic-font-and-manuscripts.html" rel="alternate"/><published>2017-11-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2017-11-27:/ar/2017/examples-of-the-beauty-of-arabic-font-and-manuscripts.html</id><summary type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-burdah-manuscript.png"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p style="color: #808080;"&gt;
  &lt;em&gt;هذا المنشور قابل لإضافة محتويات جديدة دائماً.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;إن كنت ممن تجد جمالاً أخاذاً في المخطوطات القديمة، فهذا المكان لك لتجد مجموعة من
  مخطوطات عربية جميلة متقنة، قديمة و لكن لها
  أثر ساحر يتجدد في النفوس. هي توحي بوجه مشرق لتلك الحقبة في تاريخنا. هذه صفحات من مخطوطة
  &lt;span style="color: #ff6600;"&gt;لقصيدة البردة للبوصيري …&lt;/span&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-burdah-manuscript.png"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p style="color: #808080;"&gt;
  &lt;em&gt;هذا المنشور قابل لإضافة محتويات جديدة دائماً.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;إن كنت ممن تجد جمالاً أخاذاً في المخطوطات القديمة، فهذا المكان لك لتجد مجموعة من
  مخطوطات عربية جميلة متقنة، قديمة و لكن لها
  أثر ساحر يتجدد في النفوس. هي توحي بوجه مشرق لتلك الحقبة في تاريخنا. هذه صفحات من مخطوطة
  &lt;span style="color: #ff6600;"&gt;لقصيدة البردة للبوصيري&lt;/span&gt; رحمه الله، انظر للجمال:&lt;/p&gt;

&lt;p&gt;
  &lt;img
    src="/assets/images/2017/2-burdah-manuscript-1.png" /&gt;
&lt;/p&gt;

&lt;p&gt;
  &lt;img
    src="/assets/images/2017/3-burdah-manuscript-2.png" /&gt;
&lt;/p&gt;

&lt;p&gt;و هذه صفحات تنبض بالإتقان و الحسن من مخطوطة لكتاب
  &lt;span style="color: #993366;"&gt;الشفا للقاضي عياض&lt;/span&gt; رحمه الله:&lt;/p&gt;

&lt;p&gt;
  &lt;img
    src="/assets/images/2017/4-Alshifa-manuscript-1.png" /&gt;
&lt;/p&gt;

&lt;p&gt;
  &lt;img
    src="/assets/images/2017/5-Alshifa-manuscript-2.png" /&gt;
&lt;/p&gt;

&lt;p&gt; و هذه صفحة من مخطوطة أخرى لكتاب
  &lt;span style="color: #993366;"&gt;الشفا&lt;/span&gt;:&lt;/p&gt;

&lt;p&gt;
  &lt;img
    src="/assets/images/2017/6-Alshifa-manuscript-3.png" /&gt;
&lt;/p&gt;

&lt;p&gt;و هذه صفحة من كتاب عن
  &lt;span style="color: #ff6600;"&gt;المنطق&lt;/span&gt;:&lt;/p&gt;

&lt;p&gt;
  &lt;img
    src="/assets/images/2017/7-a-book-about-logic.png" /&gt;
&lt;/p&gt;
&lt;p&gt;جميع الصور السابقة هي من مخطوطات مأخوذة من
  &lt;a href="http://manuscripts.thewalters.org/" target="_blank" rel="noopener"&gt;The Walters
    Art Museum&lt;/a&gt;
&lt;/p&gt;</content><category term="جمال"/><category term="خطوط"/><category term="مخطوطات-عربية"/><category term="فن-الخط-العربي"/></entry><entry><title>كيف تتعلم وتستفيد من خبرة وتجربة غيرك أو كيف تعرف من أين تبدأ</title><link href="https://ammar-alyousfi.com/ar/2017/how-to-learn-and-benefit-from-others-experience.html" rel="alternate"/><published>2017-11-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2017-11-27:/ar/2017/how-to-learn-and-benefit-from-others-experience.html</id><summary type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-how-to-benefit-from-othe_ijtZs1d.jpg"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;يقول نيوتن :
  &lt;p dir="ltr"&gt;
    &lt;em&gt;
      &lt;span style="color:#374140;"&gt;If I have seen further than others, it is by standing
        upon the shoulders of giants. &lt;/span&gt;
    &lt;/em&gt;
  &lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;والذي يمكن أن يترجم إلى: "
  &lt;strong&gt;إن كانت رؤيتي أبعد من رؤية الآخرين، فذلك بوقوفي على أكتاف العمالقة&lt;/strong&gt;".
  إذا أردت تعلم مهارة ما، أو أردت أن تدرس فرعاً
  من فروع العلم لوحدك، أو …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-how-to-benefit-from-othe_ijtZs1d.jpg"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;يقول نيوتن :
  &lt;p dir="ltr"&gt;
    &lt;em&gt;
      &lt;span style="color:#374140;"&gt;If I have seen further than others, it is by standing
        upon the shoulders of giants. &lt;/span&gt;
    &lt;/em&gt;
  &lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;والذي يمكن أن يترجم إلى: "
  &lt;strong&gt;إن كانت رؤيتي أبعد من رؤية الآخرين، فذلك بوقوفي على أكتاف العمالقة&lt;/strong&gt;".
  إذا أردت تعلم مهارة ما، أو أردت أن تدرس فرعاً
  من فروع العلم لوحدك، أو ما شابه ذلك، فهناك نصيحة من الممكن أن
  &lt;span style="color:#374140;"&gt;تختصر&lt;/span&gt; عليك جهداً وتفكيراً ووقتاً، وهي أن تستفيد من
  الخبراء في المجال الذي تنوي الدخول فيه. فمثلاً ابحث عن شخص قام
  بما تريد القيام به ونجح فيه ثم انظر ما هي الخطوات التي اتبعها والطرق التي سلكها حتى وصل.
  ويمكن أن نستفيد من الإنترنت وخدماته
  التي يقدمها والأبواب التي يفتحها في ذلك. لنفترض أنك تريد تعلم تطوير الويب (web
  development)، ولكنك لا تعرف من أين تبدأ ولا
  المواد التعليمية التي تختارها خاصة مع وجود العديد والعديد من مصادر التعليم في الوقت
  الحاضر (طبعاً أقصد المصادر الانكليزية،
  أما العربية فهي قليلة). فما عليك فعله هو التوجه إلى
  &lt;span style="color:#374140;"&gt;Google&lt;/span&gt; والبحث عن:&lt;/p&gt;

&lt;p style="text-align:left;"&gt;
  &lt;strong&gt;
    &lt;span style="color:#7d8a2e;"&gt;
      &lt;em&gt;How I became a web developer&lt;/em&gt;
    &lt;/span&gt;
  &lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;أو ما شابهها، وسيظهر لك في نتائج البحث تجارب لآخرين يشاركونك فيها الطريق الذي سلكوه
  ليصبحوا على ما هم عليه، وقد يظهر لك دليل
  كتبه خبير في هذا المجال. ابحث وتصفح نتائج البحث وقارن بينها واختر أفضلها ثم ابدأ طريقك
  وثابر عليه. لا أعرف إن كانت هذه الطريقة
  مجدية في كل الحالات، ولكن أنا جربتها في طريقي لتعلم web development وأنا الآن ما زلت
  أتعلم وفق مقالة ظهرت لي عندما بحثت باستخدام
  الطريقة المذكورة. يمكن تطبيق هذه الفكرة في العديد من المجالات، وليس فقط في تعلم البرمجة.
  أياً كان ما تريد تعلمه، استخدمها
  لتطلع على نتاج خبرات الآخرين.&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;الصورة من تصوير
&lt;a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, 'San Francisco', 'Helvetica Neue', Helvetica, Ubuntu, Roboto, Noto, 'Segoe UI', Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;"
  title="Download free do whatever you want high-resolution photos from Ethan Sykes"
  href="http://unsplash.com/@e_sykes?utm_medium=referral&amp;amp;utm_campaign=photographer-credit&amp;amp;utm_content=creditBadge"
  target="_blank" rel="noopener noreferrer"&gt;
  &lt;span style="display:inline-block;padding:2px 3px;"&gt;Ethan Sykes&lt;/span&gt;
&lt;/a&gt;&lt;/p&gt;</content><category term="تطوير-ذات"/><category term="تعلم"/><category term="مهارات"/></entry><entry><title>من أفضل الوسائل لتعلم اللغة الإنجليزية</title><link href="https://ammar-alyousfi.com/ar/2017/some-of-the-best-ways-to-learn-english.html" rel="alternate"/><published>2017-11-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.237732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2017-11-27:/ar/2017/some-of-the-best-ways-to-learn-english.html</id><summary type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-best-ways-to-learn-english.jpg"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;تعلم اللغة الإنجليزية أمر هام في هذا الوقت لمن يريد التعمق في الكثير من مجالات العلوم
  كعلوم الحاسب مثلاً، فمعظم الإنتاج العلمي
  -للأسف- باللغة الإنجليزية. خلال طريقي في تعلم اللغة الإنجليزية - و الذي لا أزال أسير فيه
  - جربت و اطلعت على العديد من
  القواميس و الخدمات التي تساعد متعلم الانكليزية …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-best-ways-to-learn-english.jpg"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;تعلم اللغة الإنجليزية أمر هام في هذا الوقت لمن يريد التعمق في الكثير من مجالات العلوم
  كعلوم الحاسب مثلاً، فمعظم الإنتاج العلمي
  -للأسف- باللغة الإنجليزية. خلال طريقي في تعلم اللغة الإنجليزية - و الذي لا أزال أسير فيه
  - جربت و اطلعت على العديد من
  القواميس و الخدمات التي تساعد متعلم الانكليزية. سأكتفي بوضع أفضل ما وجدت في هذا المنشور
  آملاً أن تفيدكم كما أفادتني.&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#808080;"&gt;
  &lt;small&gt;معلومة جانبية: مستواي في الإنجليزية جيد جداً و أحرزت 102 في امتحان TOEFL)، لكي
    تزداد ثقتك في هذه القائمة ؛)&lt;/small&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;
  &lt;span style="color:#900f2e;"&gt;قواميس إنجليزي-إنجليزي&lt;/span&gt;
&lt;/h2&gt;
&lt;h3&gt;
  &lt;a href="https://www.collinsdictionary.com/" target="_blank"&gt;Collins Dictionary&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;
  قاموس ممتاز يعرض ترجمة الكلمات بطريقة تراعي السياقات التي تستخدم فيها مع أمثلة، ويمكّنك
  من الاستماع لنطق الكلمة، كما أنه
  يعرض درجة انتشار استخدام الكلمة عبر السنوات، وصيغة الفعل في الماضي والمضارع المستمر إلخ،
  ومرادفات الكلمة، وغير ذلك.
&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.oxfordlearnersdictionaries.com/" target="_blank"&gt;Oxford Learner's
    Dictionary&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;قاموس يعرض ترجمة الكلمات بطريقة تراعي السياقات التي تستخدم فيها مع أمثلة، ويمكن فيه
  الاستماع لنطق الكلمة، ويعرض صيغة الفعل
  في الماضي والمضارع المستمر إلخ، والكلمات التي عادة ما تستخدم مع الكلمة التي تم البحث
  عنها، وغير ذلك. إذا رأيت رمز مفتاح بجانب
  الكلمة التي بحثت عنها، فهذا يعني أنها من أهم 3000 كلمة انكليزية يمكن تعلمها. ملاحظة: إذا
  كانت الكلمة التي تم البحث عنها لها
  أكثر من استخدام، مثلاً إن كانت تستخدم كاسم وفعل مثل love، فإن الموقع يعرض ترجمة واحد من
  هذه الاستخدامات، ويعرض على اليمين
  لائحة تحوي الاستخدامات الأخرى حيث يمكنك النقر على أحدها ليقوم بعرض الترجمة الخاصة به.
&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="http://www.learnersdictionary.com/" target="_blank"
    rel="noopener"&gt;Merriam-Webster's Learner's Dictionary&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;هذا الموقع يعرض الترجمة بطريقة مبسطة ومنظمة.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="http://www.thesaurus.com/" target="_blank" rel="noopener"&gt;Thesaurus.com&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;هذا الموقع يعرض مرادفات الكلمة التي يتم البحث عنها، وكلما زاد التشابه في المعنى بين
  الكلمة وأحد المرادفات كلما كان لون خلفية
  ذاك المرادف أغمق. ويعرض أيضاً الكلمات المضادة في المعنى وكلمات أخرى متعلقة بالكلمة
  المبحوث عنها.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.vocabulary.com/dictionary/" target="_blank"
    rel="noopener"&gt;Vocabulary.com&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;هذا الموقع غير مشابه لبقية القواميس، فهو يشرح ترجمة الكلمة و يضرب أمثلة خلال الشرح كيف
  تفهم معنى الكلمة و كيف تُستخدم، و
  يوفر نطق الكلمة. بالإضافة لما ذكرت، تستطيع إنشاء قوائم بالكلمات التي تريد دراستها و
  تذكرَها، حيث تستطيع الدخول في تدريبات
  عليها، و تزداد نقاطك في الموقع و تُمنح أوسمة أرفع كلما درست فيه أكثر، ويعرض الموقع أفضل
  مستخدميه بناء على هذه النقاط، ، و
  غير ذلك.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="http://wordnetweb.princeton.edu/perl/webwn" target="_blank"
    rel="noopener"&gt;WordNet&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;هذا المشروع من جامعة برينستون. هو عبارة عن قاعدة بيانات معجمية كبيرة تحوي على الكلمات
  الإنجليزية مرتبة في مجموعات، وكل مجموعة
  تعبر عن مفهوم معين. و هو يوفر الاطلاع على عدة علاقات بين الكلمات أيضاً، فمثلاً إذا كانت
  لديك كلمة "spoon" و التي تعني "ملعقة"،
  فإنه يتيح لك معرفة الكلمات التي تدل على معنى محدد أكثر منها مثل "teaspoon" و التي تعني
  "ملعقة شاي" أو "ملعقة صغيرة"، و يتيح
  أيضاً معرفة الكلمات التي تدل على معنى أوسع مثل "cutlery" و التي تعني "أدوات المائدة"،
  بالإضافة إلى علاقات أخرى.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="http://www.thefreedictionary.com/" target="_blank" rel="noopener"&gt;The Free
    Dictionary&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;هذا الموقع يعرض ترجمة الكلمة المطلوبة من أكثر من مصدر مع أمثلة، و فيه
  &lt;a href="http://www.freethesaurus.com/" target="_blank" rel="noopener"&gt;قسم&lt;/a&gt; لإيجاد
  الكلمات المرادفة و المعاكسة في المعنى للكلمة المطلوبة، و فيه
  &lt;a href="http://idioms.thefreedictionary.com/" target="_blank" rel="noopener"&gt;قسم&lt;/a&gt;
  لترجمة التعابير و المصطلحات.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.google.com/" target="_blank" rel="noopener"&gt;Google&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;نعم Google. فهذا الموقع العظيم يمكنه أيضاً أن يقوم بالترجمة. فقط اكتب في مكان البحث
  "define" و بجانبها الكلمة أو المصطلح
  الذي تريد ترجمته ليقوم بعرض الترجمة و معلومات أخرى مثل مدى انتشار استخدام الكلمة عبر
  الزمن.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.wiktionary.org/" target="_blank" rel="noopener"&gt;Wiktionary&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;هذا الموقع هو ابن عم Wikipedia. يعرض ترجمة موسوعية للكلمات، و يحتوي على ترجمة عربية.
&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.macmillandictionary.com/" target="_blank" rel="noopener"&gt;Macmillan
    Dictionary&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;على الرغم من أن الموقع يبدو للوهلة الأولى عادياً و قد لا يجذب المستخدم، إلا أنني أجد
  نفسي أثق بهذا القاموس و ترجماته. هو
  يعرض الترجمة و كلمات مرادفة و أحياناً أمثلة.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;
  &lt;span style="color:#900f2e;"&gt;قواميس إنجليزي-عربي&lt;/span&gt;
&lt;/h2&gt;
&lt;h3&gt;
  &lt;a href="http://context.reverso.net/translation/english-arabic/" target="_blank"
    rel="noopener"&gt;Reverso&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;يعرض معاني الكلمة مع أمثلة مترجمة.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="http://dictionary.sensagent.com/singular/en-ar/" target="_blank"
    rel="noopener"&gt;sensagent&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;يعرض عادة معان أكثر من السابق.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://en.glosbe.com/en/ar" target="_blank" rel="noopener"&gt;Glosbe&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;يتميز بترجمة المصطلحات. على العموم، أنا أستخدم Reverso و sensagent أكثر، ويغنونني
  غالباً عن بقية مواقع الترجمة من الإنجليزية
  للعربية.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;
  &lt;span style="color:#900f2e;"&gt;مواقع لإيجاد أمثلة&lt;/span&gt;
&lt;/h2&gt;
&lt;p&gt;و هذه مواقع يمكنك من خلالها إيجاد جمل تحوي الكلمة التي تريد إيجاد أمثلة على
  استخداماتها:&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.goodreads.com/quotes" target="_blank" rel="noopener"&gt;Goodreads
    Quotes&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;من هنا يمكنك البحث في الكثير من الاقتباسات المأخوذة من العديد و العديد من الكتب.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://www.brainyquote.com/" target="_blank" rel="noopener"&gt;Binary Quotes&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;وهذا موقع يحتوي على الكثير من الاقتباسات عن الرموز و المشاهير و التي يمكنك البحث فيها
  أيضاً.&lt;/p&gt;
&lt;h3&gt;
  &lt;a href="https://translate.google.com/" target="_blank" rel="noopener"&gt;Google
    Translate&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;رغم أنه مخصص أساساً للترجمة، لكنه يوفر عدة أمثلة -يظهر أنها مُختارة- على الكلمة التي
  تقوم بترجمتها فيه. انزل في الصفحة لقسم
  الأمثلة (Examples) لتجدها.&lt;/p&gt;</content><category term="أدوات"/><category term="تعلم-الإنجليزية"/><category term="قواميس"/><category term="أفضل-مترجم"/></entry><entry><title>لماذا لا يجب عليك أن تتمرن لتقلل وزنك؟</title><link href="https://ammar-alyousfi.com/ar/2017/why-you-do-not-need-to-excercise-to-lose-weight.html" rel="alternate"/><published>2017-11-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2017-11-27:/ar/2017/why-you-do-not-need-to-excercise-to-lose-weight.html</id><summary type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-exercise-does-not-reduce-weight.jpg"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;مقالة منشورة على موقع
  &lt;span style="color: #eb1515;"&gt;Vox&lt;/span&gt; تقول بأن التمارين الرياضية ليست فعالة لخسارة
  الوزن كما هو منتشر. المقالة تعتمد على أكثر من
  &lt;span style="color: #003366;"&gt;60&lt;/span&gt; دراسة في ما تقوله.&lt;/p&gt;

&lt;p&gt;
  &lt;a href="http://www.vox.com/2016/4/28/11518804/weight-loss-exercise-myth-burn-calories"
    target="_blank" rel="noopener"&gt;رابط المقالة على Vox&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;المقالة طويلة، بإمكانك قراءتها، أو يمكنك قراءة هذا
  &lt;strong&gt;الملخص&lt;/strong&gt; السريع  :)&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;قام Herman Pontzer بدراسة على إحدى القبائل البدائية في تنزانيا …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;&lt;img
    src="/assets/images/2017/f-exercise-does-not-reduce-weight.jpg"
    class="featured-image" /&gt;&lt;/p&gt;

&lt;p&gt;مقالة منشورة على موقع
  &lt;span style="color: #eb1515;"&gt;Vox&lt;/span&gt; تقول بأن التمارين الرياضية ليست فعالة لخسارة
  الوزن كما هو منتشر. المقالة تعتمد على أكثر من
  &lt;span style="color: #003366;"&gt;60&lt;/span&gt; دراسة في ما تقوله.&lt;/p&gt;

&lt;p&gt;
  &lt;a href="http://www.vox.com/2016/4/28/11518804/weight-loss-exercise-myth-burn-calories"
    target="_blank" rel="noopener"&gt;رابط المقالة على Vox&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;المقالة طويلة، بإمكانك قراءتها، أو يمكنك قراءة هذا
  &lt;strong&gt;الملخص&lt;/strong&gt; السريع  :)&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;قام Herman Pontzer بدراسة على إحدى القبائل البدائية في تنزانيا و التي تعتمد على
    الصيد و جمع الطعام في الحياة، و التي
    كان متوقعاً أن يكونوا كآلات حرق سعرات حرارية تمشي على الأرض. الصادم في الدراسة أن
    Pontzer وجد أن استهلاك الطاقة لدى
    أفراد هذه القبيلة ليس أعلى من استهلاك الطاقة لدى الأمريكيين و الأوروبيين.&lt;/li&gt;
  &lt;li&gt;يقول الباحث Kevin Hall أنه إذا قام رجل يزن 95 كيلوجراماً بالركض (متوسط السرعة) لـ 60
    دقيقة أربعة أيام في الأسبوع مع المحافظة
    على مستواه السابق لاكتساب السعرات الحرارية، و قام بذلك لمدة ثلاثين يوماً، سوف يفقد
    2.25 كيلوجراماً فقط.&lt;/li&gt;
  &lt;li&gt;هناك حد أعلى للسعرات الحرارية التي يمكن أن تحرقها من خلال التمرن: "كلما تمرنت أكثر
    كلما خسرت سعرات حرارية أكثر" مقولة
    غير صحيحة.&lt;/li&gt;
  &lt;li&gt;إذاً ماذا تعمل لتفقد الوزن؟ دراسة من National Weight Control Registry أجريت على أكثر
    من 10000 شخص بالغ، كل منهم خسر على
    الأقل 13.6 كيلوجراماً و حافظوا على ذلك لسنة على الأقل. حللت الدراسة سماتهم و عاداتهم و
    سلوكهم لتجد أن هناك أفعال
    مشتركة بين هؤلاء الناس و هي أنهم يزنون أنفسهم على الأقل مرة في الأسبوع، و يحدّون من
    كمية اكتسابهم للسعرات الحرارية،
    و يبتعدون عن الأطعمة كثيرة الدهون، و يراقبون حجم وجباتهم، و بالإضافة إلى ذلك فإنهم
    يمارسون التمارين الرياضية بانتظام.&lt;/li&gt;
  &lt;li&gt;لا يُفهم من الكلام السابق أن التمرين غير مفيد. بل إنه
    &lt;span style="text-decoration: underline;"&gt;ممتاز&lt;/span&gt; لصحتك و لجسمك. إنه فقط الأداة
    غير المناسبة لتقليل وزنك.&lt;/li&gt;
&lt;/ul&gt;</content><category term="تطوير-ذات"/><category term="مترجم"/><category term="صحة"/><category term="رياضة"/><category term="حمية"/></entry><entry><title>ملخص كتاب العزيمة: قوة الشغف و المثابرة</title><link href="https://ammar-alyousfi.com/ar/2017/grit-book-notes.html" rel="alternate"/><published>2017-04-27T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2017-04-27:/ar/2017/grit-book-notes.html</id><summary type="html">&lt;p&gt;&lt;img alt="ملخص كتاب العزيمة" src="/assets/images/2020/grit-cover.jpg"&gt;&lt;/p&gt;
&lt;p&gt;العنوان الأصلي للكتاب : Grit: The Power of Passion and Perseverance&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.goodreads.com/book/show/27213329-grit"&gt;صفحة الكتاب على Goodreads&lt;/a&gt;: تقييم الكتاب وقت كتابة المنشور: &lt;strong&gt;4.06&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id="_1"&gt;من ملاحظاتي على الكتاب:&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;الموهبة ⨉ الجهد = المهارة&lt;/strong&gt;   ،   &lt;strong&gt;المهارة ⨉ الجهد = الإنجاز&lt;/strong&gt;
الموهبة هي مدى السرعة التي تتحسن بها مهاراتك عندما تبذل جهداً. و الإنجاز هو ما يحصل عندما تأخذ مهاراتك …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="ملخص كتاب العزيمة" src="/assets/images/2020/grit-cover.jpg"&gt;&lt;/p&gt;
&lt;p&gt;العنوان الأصلي للكتاب : Grit: The Power of Passion and Perseverance&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.goodreads.com/book/show/27213329-grit"&gt;صفحة الكتاب على Goodreads&lt;/a&gt;: تقييم الكتاب وقت كتابة المنشور: &lt;strong&gt;4.06&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id="_1"&gt;من ملاحظاتي على الكتاب:&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;الموهبة ⨉ الجهد = المهارة&lt;/strong&gt;   ،   &lt;strong&gt;المهارة ⨉ الجهد = الإنجاز&lt;/strong&gt;
الموهبة هي مدى السرعة التي تتحسن بها مهاراتك عندما تبذل جهداً. و الإنجاز هو ما يحصل عندما تأخذ مهاراتك المكتسبة و تستخدمها. بالطبع، تلعب فرصك – مثلاً، أن يكون لديك مدرب أو معلم رائع – دوراً مهماً جداً أيضاً… لا تتطرأ نظريتي إلى هذه القوى الخارجية، كما لا تتضمن الحظ.&lt;/p&gt;
&lt;p&gt;يقول نيتشه إن “تفاخرنا الزائف و حبنا لأنفسنا يروج لنظرية العبقري. لأننا عندما نعتبر العبقري كائناً عجيباً، لن نضطر إلى مقارنة أنفسنا به و بالتالي اكتشاف أننا نفتقر لخصائص مماثلة لخصائصه… عندها لن نحتاج إلى أن نتنافس معه”.
بمعنى آخر، إضفاء طابع الأسطورة على الموهبة الفطرية يمكننا من الإفلات من المواجهة. يتيح لنا أن نسترخي في وضعنا الراهن.&lt;/p&gt;
&lt;p&gt;توصل نيتشه إلى نفس استنتاج دان تشامبليس، بأن الأشياء العظيمة ينجزها “أشخاص ينشط تفكيرهم في اتجاه واحد، و يستخدمون كل شيء كأدوات، و يراقبون الحياة الداخلية لأنفسهم و الآخرين بحماسة دائمة، و يلحظون المثل العليا و الحوافز في كل مكان، و لا يتعبون أبداً من دمج كل الوسائل المتوفرة لهم”.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;الحماسة شائعة؛ الثبات نادر.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;تخيل الأهداف في هرمية:&lt;/p&gt;
&lt;p&gt;&lt;img alt="هرمية الأهداف" src="/assets/images/2020/goals-hier.png"&gt;&lt;/p&gt;
&lt;p&gt;في أسفل هذه الهرمية تقف معظم أهدافنا الملموسة و المحددة – الأعمال التي نضعها على قائمة مهامنا قصيرة الأجل: “أريد الخروج اليوم قبل الثامنة صباحاً”. تتواجد هذه الأهداف فقط كوسيلة لتحقيق غاية. بالمقابل، كلما كان الهدف أعلى في هذه الهرمية، كلما كان مجرداً و عاماً و مهماً أكثر، و كلما كان غاية بحد ذاته.
التخلي عن الأهداف متدنية المستوى ليس أمراً يمكن التسامح عنه فحسب، بل و ضرورياً جداً أحياناً. يجب أن تستسلم عندما يمكن استبدال أحد الأهداف المتدنية المستوى بواحد آخر عملي أكثر، أو ذي فعالية أكبر، أو ممتع أكثر، أو منطقي أكثر.&lt;/p&gt;
&lt;p&gt;ما أعنيه بالشغف ليس فقط أن لديك شيئاً تهتم لأمره. ما أعنيه هو أنك تهتم لنفس ذلك الهدف المطلق بطريقة دائمة و حازمة و وفية. لست متقلباً. تسير في نفس الاتجاه، متلهفاً لكي تخطو حتى أصغر الخطوات إلى الأمام بدلاً من أن تخطو خطوة جانبية نحو وجهة أخرى… و تستمد معظم نشاطاتك أهميتها من ولائها لهمك المطلق، فلسفة حياتك.&lt;/p&gt;
&lt;p&gt;قصة بوب مانكوف الذي رفضت رسومه الكاريكاتورية من قبل “نيويوركر” ألفي مرة قبل أن تقبل رسمه لأول مرة. و فيما بعد، أصبح يعمل معها بالتعاقد.&lt;/p&gt;
&lt;p&gt;في دراسة تفهرس مميزات المتفوقين قامت بها طبيبة نفسية في ستانفورد تدعى كاثرين كوكس حيث درست التفاصيل المتعلقة بسيرة 301 شخصية بارعة بشكل استثنائي، منهم الشعراء و القادة السياسيون و العلماء و الجنود و الفلاسفة و الفنانين و الموسيقيين: وجدت الدراسة أن ما يميز المتفوقين عن بقية الناس كان مجموعة من أربعة مؤشرات. و قد ميزت تلك المؤشرات أيضاً بين العشرة الأوائل و العشرة الأخيرين من المتفوقين (أي بين المتفوقين بقوة و المتفوقين فحسب). جمعت كوكس تلك المؤشرات و أسمتها “&lt;strong&gt;إصرار الدافع&lt;/strong&gt;“. يمكن بسهولة إعادة صياغة مؤشرَين كبنود شغف لمقياس العزيمة:&lt;/p&gt;
&lt;p&gt;– الدرجة التي يعمل بها مع الكائنات البعيدة في المستقبل (على عكس العيش من دون استعداد أو تخطيط)&lt;/p&gt;
&lt;p&gt;– ميل إلى عدم التخلي عن إنجاز المهام لمجرد قابلية تغييرها. عدم السعي وراء شيء جديد بحجة التجديد&lt;/p&gt;
&lt;p&gt;سألت هستر عما تعلمته من أحاديثها مع أكثر من مئتي شخص “ناجح جداً” مثلما وصفتهم خلال محادثتنا. أجابت: “هناك شيء يتم التطرق إليه كل مرة هو: ‘أحب ما أفعله’. و يعبر عنه الأشخاص بشكل مختلف…”.&lt;/p&gt;
&lt;p&gt;تبين الأبحاث أن الأشخاص سيكونون راضين أكثر بكثير عن وظائفهم عندما يقومون بشيء يلائم اهتماماتهم الشخصية. هذا هو استنتاج تحليل تلوي (أي تحليل إحصائي لنتائج عدة دراسات) جمّع بيانات من حوالي مئة دراسة مختلفة شملت راشدين يعملون في كل مهنة ممكن تخيلها. مثلاً، الأشخاص الذين يستمتعون بالتفكير بأفكار مجردة ليسوا سعداء في إدارة تفاصيل مشاريع معقدة لوجستياً؛ بل يفضلون حل مسائل رياضيات. و الأشخاص الذين يستمتعون حقاً بالتفاعل مع الاخرين ليسوا سعداء عندما تتطلب منهم وظيفتهم العمل بمفردهم أمام الكومبيوتر طوال اليوم؛ سيكونون أفضل بكثير عندما يعملون في وظائف مثل المبيعات أو التعليم.&lt;/p&gt;
&lt;p&gt;عندما بدأت بإجراء مقابلات مع أصحاب العزيمة الذين يحتذى بهم، افترضت أنه ستكون لديهم جميعاً قصص عن اللحظة الفريدة التي اكتشفوا فيها شغفهم فجأة، و أعتقد أن هذا هو أيضاً ما يتخيل المتخرجون اليافعون أنه سيحصل عندما يكتشفون شغف حياتهم. فلا تكون لديهم أي فكرة عما سيفعلونه في حياتهم، و فجأة، يصبح كل شيء واضحاً… لكن الواقع هو أن معظم أصحاب العزيمة الذين أجريت مقابلة معهم أخبروني أنهم أمضوا سنوات عديدة في استكشاف اهتمامات مختلفة، و أن الاهتمام الذي استحوذ في نهاية المطاف على كل تفكيرهم في اليقظة لم يكن واضحاً من لحظة الاكتشاف الأولى أنه سيكون نصيبهم من الحياة.&lt;/p&gt;
&lt;p&gt;لا تُكتشف الاهتمامات من خلال الاستبطان (و هو فحص المرء لدوافعه و مشاعره)، بل تحفزها التفاعلات مع العالم الخارجي… لا يمكنك أن تعرف من دون اختبار ما هي الاهتمامات التي ستتعلق بها و التي لن تتعلق بها. من السابق لأوانه في أي مسعى جديد أن تسأل نفسك بعصبية كل بضعة أيام عما إذا كنت قد عثرت على شغفك أم لا.
و من النتائج المهمة التي توصل لها بلوم أن تطور المهارة يتم عبر ثلاث مراحل مختلفة، و كل مرحلة منها تدوم لعدة سنوات. و يتم اكتشاف الاهتمامات و تطويرها في ما يسميه بلوم “السنوات المبكرة”.&lt;/p&gt;
&lt;p&gt;هناك احتياجات تحفيزية مختلفة للخبراء و المبتدئين. ففي بداية أي مسعى، نحتاج إلى تشجيع و حرية لكي نعرف ما الذي نستمتع به، و نحتاج إلى انتصارات صغيرة، و نحتاج إلى تصفيق. نعم، يمكننا تحمل قليل من الانتقاد و الملاحظات التصحيحية. نعم، نحتاج إلى تمرن. و لكن ليس كثيراً جداً و ليس باكراً جداً. مارس ضغطاً على مبتدئ و ستقضي على اهتمامه الناشئ.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;يملك بعض الأشخاص خبرة عشرين سنة، بينما يملك البعض الآخر خبرة سنة واحدة… عشرين مرة متتالية.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;إذا كنت قد قرأت بحث إريكسون (و هو الطبيب النفسي الإدراكي الذي أمضى حياته المهنية في دراسة كيف يكتسب الخبراء مهارات من الطراز العالمي) الأصلي، ستعرف أن عشر آلاف ساعة من التمرين على فترة عشر سنوات هو مجرد معدل وسطي تقريبي، فالمطلوب ليس بضع ساعات أو عشرات أو مئات الساعات، بل آلاف و آلاف ساعات التمرن على امتداد سنوات و سنوات.
لكن البصيرة الحاسمة في بحث إريكسون ليست أن الخبراء يتمرنون لعدد أكبر من الساعات، بل أنهم يتمرنون بشكل مختلف. فخلافاً لمعظمنا، يسجل الخبراء آلاف و آلاف الساعات مما يسميه إريكسون “&lt;strong&gt;تمرن متعمَّد&lt;/strong&gt;“.
كل واحد من المتطلبات الأساسية للتمرن المتعمد غير جدير بالملاحظة:&lt;/p&gt;
&lt;p&gt;– هدف مرن معرّف بوضوح&lt;/p&gt;
&lt;p&gt;– تركيز و جهد كاملان&lt;/p&gt;
&lt;p&gt;– ملاحظات مباشرة و مثقِّفة&lt;/p&gt;
&lt;p&gt;– تكرار مع تفكير و تحسين&lt;/p&gt;
&lt;p&gt;لكن كم عدد ساعات التمرن التي يقوم بها معظم الأشخاص و تستوفي كل هذه المتطلبات الأربعة؟ أظن أن العديد من الأشخاص لا يقومون بأي ساعة تمرن متعمد في اليوم.
عليك اكتشاف متى و أين تكون في أقصى درجات راحتك لكي تقوم بالتمرن المتعمد. و بعدما تختار ما يناسبك، قم بالتمرن المتعمد هناك و في ذلك التوقيت كل يوم. لماذا؟ لأن الروتين أفضل شيء عندما تتعلق المسألة بإنجاز شيء صعب. تبين مجموعة هائلة من الدراسات، بما في ذلك بعض دراساتي الشخصية، أنه عندما تصبح معتاداً على التمرن في الوقت نفسه و في المكان نفسه كل يوم، ستكون بالكاد بحاجة إلى التفكير لكي تبدأ بالعمل، بل ستقوم به بكل بساطة.&lt;/p&gt;
&lt;p&gt;عندما بدأ بلوم بمقابلة رياضيين و فنانين و علماء رياضيات و علماء من الطراز العالمي منذ ثلاثين سنة، عرف أنه سيتعلم شيئاً عن كيفية وصول الأشخاص إلى قمة حقول اختصاصاتهم. فرغم الفروق السطحية في نشأتهم و تدريبهم، مر كل الأشخاص المذهلون في دراسة بلوم في ثلاث فترات مختلفة من التطور. و قد ناقشنا ما يسميه بلوم “السنوات الأولى” في الفصل 6 عن الاهتمام و “السنوات الوسطى” في الفصل 7 عن التمرن. و قد وصلنا الآن إلى المرحلة الثالثة و الأخيرة و الأطول في طراز بلوم – “السنوات اللاحقة” – عندما، على حد تعبيره، يصبح “الهدف و المعنى الأكبر” للعمل واضحاً أخيراً.&lt;/p&gt;
&lt;p&gt;فكرة الهدف في جوهرها هي فكرة أن ما نفعله مهم لأشخاص غير أنفسنا.&lt;/p&gt;
&lt;p&gt;و أنت في عملك، يمكن أن تعتبر نفسك في وظيفة (مجرد شيء عليك فعله)، أو مهنة (شيء سيؤدي إلى مزيد من النجاح الشخصي)، أو رسالة (عمل يربطك بشيء أكبر بكثير من الذات).&lt;/p&gt;
&lt;p&gt;لدي &lt;strong&gt;ثلاث&lt;/strong&gt; توصيات للبدء بصقل إحساس بالهدف:&lt;/p&gt;
&lt;p&gt;– التفكير كيف يستطيع العمل الذي تقوم به حالياً أن يؤثر إيجابياً على المجتمع&lt;/p&gt;
&lt;p&gt;– التفكير كيف يمكنك، بطرق صغيرة لكن ذات معنى، تغيير عملك الحالي لتحسين ارتباطه بقيمك الجوهرية&lt;/p&gt;
&lt;p&gt;– إيجاد إلهام في قدوة هادفة&lt;/p&gt;
&lt;p&gt;يفترض أولئك الأشخاص المؤيدون للنمو أنه من الممكن، مثلاً، أن تصبح &lt;strong&gt;أذكى&lt;/strong&gt; إذا حصلت على الفرص و الدعم المناسبَين و إذا بذلت جهداً كافياً و إذا كنت مقتنعاً أنه يمكنك فعل ذلك. و بالعكس، يظن بعض الأشخاص أنه يمكنك أن تتعلم مهارات، كركوب الدراجة مثلاً، لكن لا يمكنك تدريب قدرتك على تعلم المهارات – أي، موهبتك. المشكلة في امتلاك عقلية الثبات الثانية هذه – و العديد من الأشخاص الذين يعتبرون أنفسهم موهوبين يمتلكونها – هي أنه لا يوجد طريق من دون مطبات، و سوف تصطدم بمطب في نهاية المطاف. عندها، يصبح امتلاك عقلية ثابتة عائقاً كبيراً.
عندما تسأل كارول من أين تأتي عقلياتنا، ستشير إلى التاريخ الشخصي للأشخاص في النجاح و الفشل و كيف تفاعل الأشخاص الذين من حولهم، بالأخص أولئك المتواجدين في موضع سلطة، مع تلك النتائج. خذ مثلاً ما قاله لك الأشخاص عندما كنت طفلاً و قمت بشيء جيد حقاً. هل أشادوا &lt;strong&gt;بموهبتك&lt;/strong&gt;؟ أم أشادوا &lt;strong&gt;بجهودك&lt;/strong&gt;؟ في كلا الحالتين، الأرجح أنك تستخدم نفس اللغة هذه الأيام عند تقييمك الانتصارات و الهزائم.&lt;/p&gt;
&lt;p&gt;يقول ببيل ماكناب الذي يشغل منصب المدير العام لفانغارد، و هي أكبر مزود في العالم لصناديق الاستثمار: “الأشخاص الذين حققوا نجاحاً هنا بقوا على مسار نمو. و يستمرون بمفاجأتك حول مقدار نموهم. لدينا أشخاص هنا إذا نظرت إلى سيرتهم الذاتية عندما جرى توظيفهم ستقول لنفسك “غريب!، كيف استطاع هذا الشخص أن يحقق كل هذا النجاح؟”، و لدينا آخرون جاءوا بتوصيات مدهشة و يجعلونك تتساءل “بماذا لم يحققوا الكثير؟”.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/gritimgedu.jpg"&gt;&lt;/p&gt;
&lt;p&gt;هناك دراسات لا تعد و لا تحصى تبين أن الأولاد المنخرطين أكثر في نشاطات خارج المنهاج الدراسي ينجحون أكثر في كل قياس يمكن تخيله.
المدرسة صعبة، لكنها ليست مثيرة للاهتمام جوهرياً بالنسبة للعديد من الأولاد. الدردشة النصية مع الأصدقاء مثيرة للاهتمام، لكنها ليست صعبة. و ماذا بشأن النشاطات خارج المنهاج الدراسي؟ إنها يمكن أن تكون مثيرة للاهتمام و صعبة في نفس الوقت.
أهمية النشاطات اللامنهجية عندما يستمر الطالب فيها لفترة طويلة هي أنها تدريب على العزيمة.&lt;/p&gt;
&lt;p&gt;كان ويلينغهام و علماء آخرون في هيئة الاختبارات التعليمية (ETS) يعرفون بأن العلامات المدرسية و مجاميع النقاط في الاختبارات غير دقيقة كثيراً في توقع النجاح لاحقاً في الحياة. فغالباً ما ينتهي المطاف بطالبين يحملان علامات مدرسية و مجاميع نقاط متشابهة في الاختبارات بأن ينجحا بشكل مختلف جداً لاحقاً في الحياة. لذا فالسؤال البسيط الذي انطلق ويلينغهام للإجابة عليه كان “ما هي الصفات الشخصية المؤثرة الأخرى؟”. لمعرفة الجواب، قام فريق ويلينغهام بمتابعة عدة آلاف من الطلاب لمدة خمس سنوات، بدءاً من سنتهم الأخيرة في المدرسة. عندما جاءت كل البيانات أخيراً، كان ويلينغهام واضحاً و جازماً بشأن ما تعلمه. من بين أكثر من مئة صفة شخصية تم اختبارها، كان لإحدى الصفات قدرة أكبر بكثير من غيرها على توقع النجاح لاحقاً. هذه الصفة هي &lt;strong&gt;الاستكمال&lt;/strong&gt; أو المتابعة حتى النهاية. فقد شارك الطلاب الذين نالوا أعلى تصنيف استكمال في نشاطين مختلفين خارج المنهاج الدراسي للثانوية لعدة سنوات، و قد تحسنوا بشكل كبير في كل نشاط من ذينك النشاطين. كانت القوة التوقعية للاستكمال مدهشة: فبعد التحكم للعلامات المدرسية و مجموع النقاط في اختبار SAT، تمكن استكمال النشاطات خارج المنهاج الدراسي في الثانوية من توقع أن يتخرج الطالب من الكلية بمرتبة شرف أكاديمية أفضل مما توقعه أي متغير آخر. بشكل مماثل، كان الاستكمال أفضل قياس لتوقع أن يشغل الطالب موضعاً قيادياً في مرحلة الشباب. و أخيراً توقع الاستكمال، بشكل أفضل من كل الصفات الشخصية التي قاسها ويلينغهام، أن يحقق الشباب إنجازات ملحوظة في كل الميادين.&lt;/p&gt;
&lt;p&gt;مبدأ التماثل: تابع برنت و معاونوه في إحدى الدراسات ألف مراهق في نيوزلندا و هم يدخلون مرحلة البلوغ و يبحثون عن وظائف. على مر السنوات، انتهى المطاف بالمراهقين العدائيين بأن يشغلوا وظائف أقل هيبة و يواجهوا مصاعب في تسديد فواتيرهم. أدت تلك الظروف بدورها إلى زيادة مستويات العداء لديهم، مما زاد من تآكل فرص عملهم. بالمقابل، دخل المراهقون المحبوبون أكثر دورة حميدة في التطور النفسي. فقد أمن أولئك “الأولاد اللطفاء” وظائف مرموقة أكثر قدمت لهم أماناً مالياً أفضل – و هذه نتائج حسنت ميلهم نحو الاختلاط الاجتماعي.&lt;/p&gt;
&lt;p&gt;إنني أدرك أن هناك مقايضات لأي خيار، و يمكنني تقدير كيف ينطبق ذلك على العزيمة. فمن غير الصعب ذكر حالات يكون التخلي فيها هو أفضل قرار يقوم به المرء. حسب خبرتي الشخصية، كان قراري بالتخلي عن البيانو عندما أصبح واضحاً أنني لا أملك أي اهتمام أو موهبة به قراراً رائعاً.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;ملاحظة: تم النقل ببعض التصرف. الكلمات بين [] من إضافتي.&lt;/p&gt;
&lt;p&gt;نسخة الكتاب الموجودة في الصورة أعلاه لم تعجبني ترجمتها كثيراً؛ إن استطعت قراءة الكتاب بالانكليزية فذلك أفضل.&lt;/p&gt;</content><category term="كتب"/><category term="تطوير-الذات"/><category term="ملخص-كتاب"/></entry><entry><title>ملخص كتاب قوة التركيز</title><link href="https://ammar-alyousfi.com/ar/2017/power-of-focus-book-notes.html" rel="alternate"/><published>2017-04-09T00:00:00+04:00</published><updated>2026-05-10T18:19:15.241732+04:00</updated><author><name>Ammar Alyousfi</name></author><id>tag:ammar-alyousfi.com,2017-04-09:/ar/2017/power-of-focus-book-notes.html</id><summary type="html">&lt;p&gt;&lt;img alt="ملخص كتاب قوة التركيز" src="/assets/images/2020/power-focus-cover.jpg"&gt;&lt;/p&gt;
&lt;p&gt;العنوان الأصلي للكتاب :The Power of Focus Tenth Anniversary Edition: How to Hit Your Business, Personal and Financial Targets with Absolute Confidence and Certainty&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.goodreads.com/book/show/68986.The_Power_Of_Focus"&gt;صفحة الكتاب على Goodreads&lt;/a&gt;: تقييم الكتاب وقت كتابة المنشور: &lt;strong&gt;4.15&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id="_1"&gt;من ملاحظاتي على الكتاب&lt;/h3&gt;
&lt;p&gt;عاداتك ستحدد مستقبلك. الأمر بهذه الأهمية فعلاً.
إذا كنت تفعل شيئا …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="ملخص كتاب قوة التركيز" src="/assets/images/2020/power-focus-cover.jpg"&gt;&lt;/p&gt;
&lt;p&gt;العنوان الأصلي للكتاب :The Power of Focus Tenth Anniversary Edition: How to Hit Your Business, Personal and Financial Targets with Absolute Confidence and Certainty&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.goodreads.com/book/show/68986.The_Power_Of_Focus"&gt;صفحة الكتاب على Goodreads&lt;/a&gt;: تقييم الكتاب وقت كتابة المنشور: &lt;strong&gt;4.15&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id="_1"&gt;من ملاحظاتي على الكتاب&lt;/h3&gt;
&lt;p&gt;عاداتك ستحدد مستقبلك. الأمر بهذه الأهمية فعلاً.
إذا كنت تفعل شيئاً مراراً و تكراراً لمدة 30 عاماً، فربما لا تستطيع التخلي عنه في بضعة أسابيع قليلة.&lt;/p&gt;
&lt;p&gt;تذكر هذا – سلوكك الخارجي هو الحقيقة. في حين أن تصورك الداخلي لسلوكك غالباً ما يكون مجرد وهم.&lt;/p&gt;
&lt;p&gt;ادرس عادات الأشخاص الناجحين الذين تتخذهم قدوة.&lt;/p&gt;
&lt;p&gt;و هناك طريقة أخرى لدراسة الأشخاص الناجحين: اقرأ السير الذاتية الشخصية لهؤلاء الأشخاص.
ابحث أيضاً عن الأفلام الوثائقية التي تقدم أشخاصاً ناجحين.&lt;/p&gt;
&lt;p&gt;صيغة العادات الناجحة:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;حدد بوضوح عاداتك السيئة أو غير المنتجة&lt;/li&gt;
&lt;li&gt;حدد عاداتك الناجحة الجديدة: العادة الناجحة هي في الغالب نقيض العادة السيئة بالضبط.&lt;/li&gt;
&lt;li&gt;ضع خطة تنفيذ من ثلاثة أجزاء.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;يقول المدرب دان سوليفان: “إذا أمضيت وقتاً طويلاً في التركيز على نقاط ضعفك، فكل ما ستنتهي إليه هو الكثير من نقاط الضعف القوية”&lt;/p&gt;
&lt;p&gt;و لتحدد بوضوح جوانب القوة لديك، اسأل نفسك بعض الأسئلة، ما الذي تجيد القيام به دون بذل مجهود – أي دون الكثير من الدراسة أو الاستعداد؟ و ما الذي تجيد القيام به و يجده الآخرون صعباً؟ هم يتعجبون من قدرتك و لا يستطيعون مضاهاتك في القيام به! ما الفرص المتوفرة في سوق العمل اليوم التي تطابق جوانب قوتك؟ ما الذي يمكنك تحقيقه باستخدام موهبتك الفريدة؟&lt;/p&gt;
&lt;p&gt;إذا شعرت بأن المشاغل تغمرك، فاحصل على بعض المساعدة. تعلم أن تتخلى عن الأشياء غير المهمة في حياتك.&lt;/p&gt;
&lt;p&gt;فالأشخاص المتحكمون لديهم عقلية تخبرهم أن أحداً لا يستطيع القيام بالأمور بنفس كفاءتهم. و من الممكن أن يكون هذا صحيحاً. و لكن ماذا لو كان مساعدك يستطيع القيام بتلك المهام بكقاءة 75٪ في البداية؟ و مع التدريب المناسب و التواصل الجيد كل أسبوع، في النهاية سيقوم مساعدك الذي اخترته بعناية بكل تلك المهام بنفس كفاءتك. و سيتفوق عليك في أداء العديد منها.&lt;/p&gt;
&lt;p&gt;فكر في هذا الأمر، عندما تدفع في اتجاه تحقيق هدف ما، هل تكون أقرب لتحقيقه عندما يكون عقلك، و جسدك، و روحك، و مواردك بالكامل مركزة على النتيجة؟ أم عندما تكون مشتتاً و يتفرق انتباهك في مختلف الاتجاهات؟&lt;/p&gt;
&lt;p&gt;و عند سؤاله [ أي بيتر دانيال ] عن الذي حول حياته من مديونية ثلاثية لنجاح لا مثيل له، أجاب: “أنا أنظم وقتي لأفكر. في الحقيقة، أنا أدخر يوماً كل أسبوع في جدولي لأفكر فقط. جميع أفكاري و فرصي العظيمة و مشروعاتي المربحة بدأت مع الأيام التي انطلقت فيها في التفكير. اعتدت أن أغلق على نفسي في خلوتي مشدداً على أسرتي ألا يتم إزعاجي تحت أي ظرف من الظروف”&lt;/p&gt;
&lt;p&gt;“بدء التمارين الرياضية” هو تعريف ضعيف جداً لهذا الهدف. إنه تعريف عام أكثر من اللازم، و لا يمكن قياسه. لذلك قلنا له: &lt;strong&gt;“كن أكثر تحديداً”&lt;/strong&gt;. فأضاف: “أريد أن أمارس التمارين الرياضية لنصف ساعة في اليوم، أربع مرات في الأسبوع”. أتعلم ماذا قلنا له بعد ذلك؟ نعم: “كن أكثر تحديداً”. بتكرار هذا السؤال عدة مرات، تم إعادة تحديد هدفه الصحي كالتالي: أن يمارس التمارين الرياضية لنصف ساعة في اليوم، أربع مرات في الأسبوع: الاثنين، و الأربعاء، و الجمعة، و السبت، من السابعة صباحاً حتى السابعة و النصف. يحتوي نظامه على عشر دقائق لتمارين الإحماء، و عشرين دقيقة على عجلته الرياضية. يا له من اختلاف! الآن يمكننا بسهولة تتبع تقدمه.&lt;/p&gt;
&lt;p&gt;قرر ما الذي تريد إنجازه و لماذا. لتتحفز، اصنع قائمة بكل الأشياء التي تريد إنجازها في الخمسة أعوام القادمة. استمتع بذلك، و استعد لجميع الاحتمالات. تبنّ حماس الأطفال – لا تضع أية قيود على تفكيرك. كن محدداً، و أضف طابعاً شخصياً على قائمتك بأن تبدأ كل عبارة بقولك “أنا” أو “أنا سوف”… إليك بضعة أسئلة مهمة لتساعدك على التركيز:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ما الذي أريد فعله؟&lt;/li&gt;
&lt;li&gt;ما الذي أرغب في امتلاكه؟&lt;/li&gt;
&lt;li&gt;إلى أين أريد أن أذهب؟&lt;/li&gt;
&lt;li&gt;ما المساهمات التي أود تقديمها؟&lt;/li&gt;
&lt;li&gt;ماذا أريد أن أصبح؟&lt;/li&gt;
&lt;li&gt;ما الذي أرغب في تعلمه؟&lt;/li&gt;
&lt;li&gt;من الذي أرغب في قضاء وقتي معه؟&lt;/li&gt;
&lt;li&gt;كم أريد أن أكسب و أدخر و أستثمر؟&lt;/li&gt;
&lt;li&gt;كم من الوقت أرغب في اقتطاعه للترفيه؟&lt;/li&gt;
&lt;li&gt;ماذا سأفعل لأحصل على الصحة الأمثل؟&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;لتتأكد من أنك ستستمتع بأسلوب حياة صحي متكامل، اختر بعض الأهداف في كل من المجالات التالية: المهنة و العمل، و المجال المالي، و الترفيه، و الصحة و اللياقة، و العلاقات الشخصية، و المجال الشخصي و المساهمة، بالإضافة لأي شيء آخر له أهمية خاصة لديك.
الخطوة القادمة هي ترتيب أولوياتك. اكتب رقماً بجانب كل هدف: عاماً واحداً أو ثلاثة أو خمسة أعوام. سيمنحك ذلك إطاراً زمنياً عاماً تعمل وفقاً له. [ استخدم طريقة سحب البطولات المذكورة في الكتاب لترتيب أولوياتك و ملخصها كالتالي: ابدأ مثلاً بالأهداف التي ستستغرق عاماً واحداً؛ اكتبها تحت بعضها، ثم فاضل بين كل اثنين على حدة، و بعدها فاضل بين كل اثنين من الأهداف التي اجتازات المفاضلة الأولى و هكذا، بطريقة مشابهة لما في الصورة التالية:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="/assets/images/2020/tournamentbracket.png"&gt;&lt;/p&gt;
&lt;p&gt;ثم أعد العملية لأهداف الثلاثة أعوام و الخمسة أعوام… إلخ]
إليك ملحوظة حيوية أخرى: قبل أن ترتب أولوياتك، دوّن أهم سبب ترغب في تحقيق كل هدف لأجله، و أكبر فائدة ستعود عليك من إتمامه.&lt;/p&gt;
&lt;p&gt;لتزيد من تركيزك على نمط الحياة الجديد الذي تريده، اخلق صوراً &lt;strong&gt;ملهمة&lt;/strong&gt; لأهم أهدافك. هذه عملية ممتعة و يمكن للأسرة كلها الاشتراك بها. توفر شبكة الانترنت مصادر رائعة لإيجاد مثل هذه الصور. على مواقع مثل gettyimages.com، ستجد آلافاً من الصور. [ أقترح عليك &lt;a href="https://images.google.com/"&gt;Google Images&lt;/a&gt; ]&lt;/p&gt;
&lt;p&gt;من المهم حقاً أن تتخلى عن الأفكار المقيدة حول الشخص المفترض أن تكون أو لا تكون عليه.&lt;/p&gt;
&lt;p&gt;أفضل عشرة خيارات: بصرف النظر عن مدى صعوبة التحدي الذي يواجهك، اصنع قائمة بأفضل عشرة خيارات متاحة لك. قد لا يكون أول بضعة خيارات هي ما ترغب في تنفيذه؛ لكن دونها على أية حال. كن خلاقاً، و لا تكن ضيق الأفق. اسأل نفسك بعض الأسئلة التي تبدأ بـ “ماذا لو”. كن مستعداً للأمور غير المتوقعة. غالباً ما يكون الحل الأفضل هو إحدى أفكارك الأخيرة.&lt;/p&gt;
&lt;p&gt;يقول لاري: كلما قابلت شخصاً – أياً كان – سألته: “ما هو أكبر مشروع أو مشروعين تعمل فيهما في الوقت الحالي؟”. و يمكنك كذلك أن تسأل: “ما أهم مبادرتين أو تحديين تواجههما الآن؟ و كيف يمكنني مساعدتك؟”. ثم إذا أخبرك شيئاً يمكنك فعله حقاً، فانطلق و افعله… و إذا ما طلبت من هذا الشخص معروفاً بعد ذلك بثلاثة أشهر، فستكون هناك علاقة موجودة فعلياً و بإمكانك البناء عليها.&lt;/p&gt;
&lt;p&gt;و يشتمل تحضيره [ أي: قطب الأعمال وارن بافيت ] المكثف تحليلاً كاملاً للأرقام و خاصة ميزانية الشركة. و إذا ما حازت إعجابه يقضي وقتاً لا يستهان به في اجتماعات مع الأشخاص البارزين في المنظمة، يتعرف منهم كيف يديرون العمل، و يلاحظ فلسفتهم و كيفية تعاملهم مع العاملين و الموردين و العملاء لديهم. و عندما تكتمل هذه المهام، يسأل بافيت نفسه ثلاثة أسئلة حول هؤلاء الأشخاص البارزين: &lt;strong&gt;“هل أحبهم؟ هل أثق بهم؟ هل أحترمهم؟”.&lt;/strong&gt; و إذا كانت الإجابة عن أحد تلك الأسئلة هي “لا”، تنتهي الصفقة دونما التفات لمدى كون الأرقام جيدة، أو للنمو المحتمل.&lt;/p&gt;
&lt;p&gt;العملاء الجوهريون هم جواز مرورك نحو النمو المستقبلي. و لسوء الحظ، غالباً ما يستهين الناس بهذه العلاقات المهمة، فيكون التوجه الذهني حيالها أن يقولوا: “إنه يطلب دائماً ألفي وحدة شهرياً، نحتاج إلى التركيز على عمل جديد”.&lt;/p&gt;
&lt;p&gt;إذ يقول [أي: ستيفن كوفي ] إن على المرء أن يعامل علاقاته الأكثر أهمية كما يعامل حساباً بنكياً. على سبيل المثال، كلما زادت ودائعك في حسابك البنكي للعلاقات الجوهرية، زادت قوة تلك الروابط. و خلال تلك العملية، ستصبح شخصاً ذا قيمة لهؤلاء الأشخاص.&lt;/p&gt;
&lt;p&gt;و مع عملائك المهمين في العمل، ربما ستقدم خدمات خاصة و كل الإضافات التي تجعل منك شخصاً فريداً. و قد يشمل ذلك نزهاً للعب الجولف أو حفلات عشاء أو رحلات خاصة… و ربما توفر لهم باستمرار إحالات جيدة ليتوسعوا في أعمالهم. و أحياناً يكون ذلك في صورة لفت أنظارهم إلى كتاب رائع، إو إرسال بريد إلكتروني لهم يحوي مقالاً حول هوايتهم أو تسليتهم المفضلة.
لا تعط و تنتظر المقابل. جرب فقط المتعة المجردة للعطاء.&lt;/p&gt;
&lt;p&gt;– “ديان، كيف يمكنك تقييم أدائي كزوج خلال الأسبوع الماضي على مقياس من واحد إلى عشرة…”
– “سأعطيك ثمانية”
– &lt;strong&gt;“و ما الذي ينقصني لأحصل على عشرة؟”&lt;/strong&gt;
– “حسناً، كنت سأقدر لك مساعدتك لابننا في واجباته المدرسية يوم الأربعاء، فقد كنت مضغوطة بسبب درس الكومبيوتر في السابعة مساء، و شعرت بالذنب لأنني ذهبت دون الاعتناء به كما ينبغي…”
– “شكراً لك. سأكون أكثر انتباهاً في المرة القادمة”
ثم يتبادلان الأدوار.&lt;/p&gt;
&lt;p&gt;و هناك طريقان يمكنك أن تسلكهما لتبني حياة ناجحة؛ إما أن تسير في هذا الطريق وحيداً و أن تكون فردياً و مسيطراً، و إما أن تختار صحبة من الناس يمنحونك بعض المساعدة. و يتطلب الاختيار الأول الكثير من المحاولة و الخطأ، ستتعلم بالطريق الصعب، و تأخذ نصيبك العادل من الصدمات القوية و الكدمات. و ربما تحصل في النهاية على ما تريد، و ربما لا!
الاختيار الثاني هو ما تستخدم فيه الدعم الاستراتيجي لتجنب بعض منعطفات الحياة الصعبة، كيف؟ بأن تجد الأشخاص المستعدين لإرشادك.&lt;/p&gt;
&lt;p&gt;و إليك طريقة مثبتة من ثلاث خطوات تساعدك على الاستمتاع بميزة الإرشاد:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;حدد الهدف: اختر مجالاً محدداً في حياتك تريد تحسينه.&lt;/li&gt;
&lt;li&gt;اختر مرشحيك من المرشدين.&lt;/li&gt;
&lt;li&gt;ضع خطتك الاستراتيجية: أول ما يجب عليك إدراكه أن ما بينك و بين الشخص الذي ترغب في مقابلته لن يزيد أبداً عن ستة أشخاص، بمن فيهم مرشدك نفسه.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;دعنا نراجع العناصر الأساسية في مكالمتك الأولى مع مرشدك. أولاً، ادخل مباشرة في الموضوع، فالأشخاص المشغولون يقدرون ذلك. لا تتصرف كما لو كنت تريد تكوين صداقات. التزم بنص تحضره جيداً و استخدم نغمة هادئة في الحوار. الأمر سيستغرق دقيقة واحدة، و من المهم أن تتحكم في المحادثة. قل ما شئت، و اسأل السؤال الختامي، ثم اصمت. عند هذه النقطة، تسمح لمرشدك المحتمل أن يتحدث.&lt;/p&gt;
&lt;p&gt;سامح نفسك. أسكت إلى الأبد تلك الأفكار السلبية من الإحساس بالذنب. الماضي تاريخ، و لن تتمكن من تغييره أبداً.&lt;/p&gt;
&lt;p&gt;و أحد أكثر المعتقدات المقيدة وضوحاً هذه الأيام هي فكرة أننا غير قادرين بشكل أو بآخر على تحقيق أهدافنا. و بالرغم من أن أفضل المواد التعليمية صارت متاحة، و بالرغم من عقود من المعرفة المسجلة عن كيفية إنجاز أي مهمة، فإننا نختار قول شيء آخر، فنحن نقول: “لا أقدر على فعل هذا، لا أعرف كيف، و لا يوجد من يدلني، و أنا لست ذكياً بما يكفي” و غير ذلك.
و لكن ماذا لو قررت أن تقول بدلاً من ذلك: “سأتمكن من فعل هذا، أنا قادر، لقد قام به آخرون، و إن كنت لا أملك المعرفة فيوجد شخص في الخارج بإمكانه تعليمي”.&lt;/p&gt;
&lt;p&gt;عندما تصل ثقتك إلى أقل مستوياتها. ربما لأنك خسرت وظيفتك، أو لأن البنك حجز على منزلك أو لأنك أفلست. ثم ماذا؟ لتعزز من ثقتك، ابدأ بالنظر للخلف خلال حياتك و اكتب كل ما فعلته و كان ناجحاً. ابدأ بـ: تعلم المشي و تخرجك في الصف الأول… ثم عد إلى الخلف ثانية و انظر إلى كل الأشياء السيئة التي حدثت لك و أدرك أنك تغلبت على كل واحد منها.&lt;/p&gt;
&lt;p&gt;يجب أن تطرح دائماً سؤالاً ختامياً للحفاظ على العمل. لا تتردد أو تتجنب الدخول مباشرة في صلب الموضوع، أو الأسوأ من هذا و ذاك أن تنتظر حتى يقوم العميل المرتقب بالطلب.
“هل تود المحاولة؟” يعد نوعاً من أنواع الأسئلة التي لا توحي بالضغط أو التهديد.&lt;/p&gt;
&lt;p&gt;اطلب &lt;strong&gt;تزكيات&lt;/strong&gt; كتابية: التزكيات المكتوبة بشكل جيد، و الموجهة نحو النتائج، و الصادرة عن أشخاص محل تقدير، لها وقع قوي. فهي ترسخ جودة عملك، و تجعل منك شخصاً نزيهاً…
اعرض على العميل أن تكتب خطاب التزكية بنفسك. هذا يوفر الوقت لعملائك… و عند إتمامك لهذا، أرسل خطاب التزكية مرة أخرى للعميل عن طريق البريد الالكتروني أو الرسائل النصية للحصول على موافقته، ثم اجعل العميل يطبع هذا الخطاب على ورق الخطابات الخاص به و يوقعه.&lt;/p&gt;
&lt;p&gt;و ثمة خيار جيد آخر [ غير عرض شهادات التزكية الخاصة بك بتعليقها في مكتبك أو غير ذلك ] و هو أن تأخذ أقوى جمل من بين عشر شهادات مختلفة و تضعها في ورقة واحدة إلى جانب أسماء العملاء. من الأفضل أن تدرج صورة صغيرة لكل عميل تعرض الرأس و الكتفين.&lt;/p&gt;
&lt;p&gt;يخسر العديد من الأشخاص آلاف الدولارات في مجال المبيعات كل عام لأنهم لا يملكون شيئاً آخر يعرضونه على العميل بعد عملية البيع الأولى. ابحث عن منتجات أو خدمات أخرى لتدرجها في حقيبة أعمالك. و احرص أيضاً على تطوير نظام لتحديد متى سيحتاج عملاؤك إلى المزيد من المنتج أو الخدمة الخاصة بك… و أسهل الطرق لتتمكن من تحقيق ذلك هو أن تسأل عملاءك عن الموعد الذي يتعين عليك فيه الاتصال بهم ليقوموا بإعادة الطلب.&lt;/p&gt;
&lt;p&gt;المصفوفة السحرية: هي عبارة عن شبكة تحتوي على قائمة عملائك في المحور العمودي الأيسر. و على امتداد المحور الأفقي في الجانب العلوي من الشبكة، اكتب قائمة بجميع المنتجات و الخدمات التي تقدمها. و أمام كل عميل، ضع علامة x في كل المربعات الموجودة في الشبكة و التي تمثل المنتج أو الخدمة التي تلقاها العميل منك. و من المفيد أن تحدد أيضاً موعد آخر عملية شراء قام بها العميل أمام كل منتج. ثم ألق نظرة على المربعات الفارغة في الشبكة، فهي تمثل فرصاً لبيع بعض المنتجات و الخدمات الأخرى التي تقدمها.&lt;/p&gt;
&lt;p&gt;في هذا العصر الذي تحتدم فيه المنافسة، فإن طلبك قد يضل طريقه في الزحام، دون أن يسمعه صانعو القرار الذين تتمنى الوصول إليهم. استخدم حسك الإبداعي لتأتي بطريقة عميقة الأثر لتقديم طلبك.&lt;/p&gt;
&lt;p&gt;إذا سلكت كل الطرق للوصول إلى ما تبتغيه، فمن المحتمل أن يمد لك البعض يد المساعدة عندما تطلب الدعم، أما هؤلاء الذين يطلبون المساعدة دون بذل أي مجهود فقلما يحالفهم النجاح.&lt;/p&gt;
&lt;p&gt;حقيقة مستخلصة من بحث قام به هربرت ترو:  نسبة 94 بالمائة من جميع مندوبي المبيعات يكفون عن المحاولة بعد الاتصال الرابع. لكن نسبة 60 بالمائة من جميع المبيعات تمت بعد الاتصال الرابع.&lt;/p&gt;
&lt;p&gt;كل شيء في الحياة عبارة عن خيار. ربما يكون التنفس هو الاستثناء الوحيد.&lt;/p&gt;
&lt;p&gt;الواجبات تجعلك في موضع ضغط، في حين أن الاختيارات تجعلك في موقف قوة.&lt;/p&gt;
&lt;p&gt;عندما يميل أحدهم للانسحاب قبل تحقيق أهدافه، يسأله جيم [ جيم رون ] أربعة أسئلة:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;لماذا؟
  لماذا تزعج نفسك؟ لماذا تعمل بجد؟ لماذا تفعل الكثير و الكثير؟ لماذا تضغط على نفسك؟ لماذا تستمر؟ لماذا؟ سؤال جيد!&lt;/li&gt;
&lt;li&gt;لماذا لا؟
  لماذا لا تحقق كل ما في إمكانك تحقيقه؟ لماذا لا تقيس قدرتك؟ لماذا لا تكون ناجحاً؟ لماذا لا تستمتع بكل ما تقدمه لك الحياة، لماذا لا؟&lt;/li&gt;
&lt;li&gt;لماذا ليس أنت؟
  لماذا لا تكون أنت الذي يستمتع بنمط حياة رائع؟ آلاف الأشخاص يفعلون ذلك. لماذا لا تكون أنت الذي يرى العالم و يزور أماكن غريبة؟ لماذا لا تكون أنت الذي يتمتع بحرية و استقلال مالي؟ لماذا لا تكون أنت الذي يعيش في منزل جميل؟ لماذا لا تكون أنت الذي يحدث تغيرآً و يحفز الآخرين الذين يحتاجون لمساعدتك؟ لماذا لا تكون أنت الذي يعيش حياة النزاهة بينما يتخبط الآخرون؟ لماذا لا تكون أنت الذي يحقق أحلامه؟ لماذا ليس أنت؟&lt;/li&gt;
&lt;li&gt;لماذا ليس الآن؟
  ماذا تنتظر؟ لماذا تتراجع؟ ابدأ العملية الآن و استمر ف يالمضي قدماً، الأمس لا يمكن تعويضه… ليس هناك وقت أفضل. قريباً ستمر السنون و ذكرياتك إما أن تبهجك و إما أن تغضبك. إنه اختيارك!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;يوماً ما&lt;/strong&gt;، بعد انقضاء عمر بأكمله في التفكير في يوم ما، و الندم على يوم ما، يصل هؤلاء المسوفون إلى نهاية حياتهم. و الجملة التي تطغى على أفكارهم و هم يتأهبون للرحيل هي: “ليتني قمت بالأشياء التي أردت القيام بها حقاً. كانت حياتي ستكون مختلفة للغاية”.&lt;/p&gt;
&lt;p&gt;هناك طريقتان في الأساس لتحفيز ذاتك: أن تبث في نفسك الخوف من عواقب عدم اتخاذك موقفاً حاسماً، أو أن تبث فيها الشعور بالإثارة من جراء التفكير في مكاسب و منافع كونك نشطاً.&lt;/p&gt;
&lt;p&gt;يقول سير جون تمبلتون: “لا تنس أبداً: سر صنع ثروة خاصة بك هو أن تصنعها لغيرك”.&lt;/p&gt;
&lt;p&gt;يقول سام بيكفورد: “من الجميل أن نحلم بأحلام كبيرة، لكن إذا لم تمتلك فرصة صغيرة بما يكفي لتعمل عليها في الوقت الحالي، فسوف تبقى أحلامك مؤجلة”، “&lt;strong&gt;التعليم&lt;/strong&gt; هو أحد الأضلاع التي يمكن لشركة صغيرة استخدامها للتغلب على شركة أكبر و ممولة جيداً. منذ عشر سنوات حينما بدأت عملي كان أمامي منافس أكبر و أفضل في التمويل، فقررت أن ميزتي قد تكون أن أعرف أكثر. قرأت سبعمائة كتاب عن المبيعات و الأعمال و الدعاية و أي شيء آخر قد يمنحني معرفة أكثر منه. اليوم تقدمت شركتي إلى الصدارة بينما الشركة الأخرى تقريباً ما زالت في نفس المكان الذي كانت فيه منذ 10 سنوات”، “لا تفكر في أن اليوم قد انتهى عندما يقاطعك شيء ما، عد إلى العمل و استمر في المضي قدماً نحو أهدافك حتى و إن بدا أنك لا تتحرك من مكانك”&lt;/p&gt;
&lt;p&gt;يقول دون كامبل: “تخل عن فكرة التحكم في كل شيء و ركز على أفضل ما تستطيع فعله”، “ركز على إيجاد تخصص دقيق محدد تحبه بشغف، و امنح زبائن هذا السوق أدوات فريدة و قابلة للاستخدام لتزيد من شغفهم. كلما زاد اتساع السوق الذي اخترته، زاد منافسوك و صعب عليك التميز”، “امرح و كن جاداً: لا يعني المرح أن تكون سخيفاً، و إنما يعني أن تسترخي لتصبح صحبتك ممتعة، حتى عندما تكون جاداً. فإذا استطعت تقديم المعلومات الجادة لمجالك الدقيق بأسلوب مرح و مسل، فسيصطف الناس للعمل معك، أياً كان مجالك. من المبيعات الصناعية إلى تطوير البرمجيات، يبقى المفتاح واحداً؛ كن شخصاً يسترعي انتباه الناس”.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;ملاحظة: تم النقل ببعض التصرف. الكلمات بين [] من إضافتي.&lt;/p&gt;</content><category term="كتب"/><category term="تطوير-الذات"/><category term="ملخص-كتاب"/></entry></feed>