<section>
  <h1>Python basics functions <img src="https://i.ibb.co/Sdq9H3T/te-le-chargement.png"></h1>
  <div>
    <h3>Display a message with <span>print()</span></h3>
    <p>
      The print() function prints the specified message to the screen, or other standard output device.<br>

      The message can be a string, or any other object, the object will be converted into a string before written to the screen.

    <pre>
         <button id="copyButton-1">
           <svg xmlns="http://www.w3.org/2000/svg" id="Capa_1" x="0px" y="0px" viewBox="0 0 488.3 488.3" xml:space="preserve">
            <g>
              <path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124    C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124    c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/>
              <path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227    c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6    V38.6C439.65,17.3,422.35,0,401.05,0z"/>
            </g>
          </svg>
          <span class="copied">Copied !</span>
        </button>
        <code class="language-python" id="code-1">
  text = "I am a text that should be displayed in the console"
  print(text);
        </code>
      </pre>
    </p>
  </div>
<div>
  <h3>Request a number from the user with <span>input()</span></h3>
  <p>
    Python input() function is used to take user input. By default, it returns the user input in form of a string.
  <pre>
         <button id="copyButton-2">
           <svg xmlns="http://www.w3.org/2000/svg" id="Capa_1" x="0px" y="0px" viewBox="0 0 488.3 488.3" xml:space="preserve">
            <g>
              <path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124    C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124    c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/>
              <path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227    c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6    V38.6C439.65,17.3,422.35,0,401.05,0z"/>
            </g>
          </svg>
          <span class="copied">Copied !</span>
        </button>
          <code class="language-python" id="code-2">
  print('Enter your name:')
  x = input()
  print('Hello, ' + x)
          </code>
        </pre>
  </p>
</div>
<div>
  <h3>Count the number of elements with  <span>len()</span></h3>
  <p>
    Thisfunction returns the number of items in an object.<br>
    When the object is a string, the len() function returns the number of characters in the string.
  <pre>
         <button id="copyButton-3">
           <svg xmlns="http://www.w3.org/2000/svg" id="Capa_1" x="0px" y="0px" viewBox="0 0 488.3 488.3" xml:space="preserve">
            <g>
              <path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124    C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124    c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/>
              <path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227    c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6    V38.6C439.65,17.3,422.35,0,401.05,0z"/>
            </g>
          </svg>
            <span class="copied">Copied !</span>
        </button>
          <code class="language-python" id="code-3">
  mylist = ["apple", "banana", "cherry"]
  x = len(mylist)
  print(x);
          </code>
        </pre>
  </p>
</div>
</section>
// Fonts
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap');

// Variables 
$mainColor: #444444;
$secondColor: #0804ff; 

// Style
*{
  box-sizing: border-box;
}

body{
  margin: 0;
  display: flex;
  justify-content: center;
  font-family: 'Source Sans Pro', sans-serif;
  background: #f9f9f9;
}

section{
  width: 850px;
  max-width: 95%;
  padding: 20px 30px;
  border: 1px solid #eaeaea;
  box-shadow: 0 0 9px 2px #e9e9e9;
  border-radius: 8px;
  margin: 25px 0;
  background: white;
  h1{
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0 50px 0;
    img{
      width: 50px;
      margin: 0 20px;
    }
  }
  h3{
    color: $mainColor;
    span{
      background: #ececec;
      border-radius: 5px;
      padding: 3px;
      color: #0804ff;
    }
  }
  pre{
    position: relative;
    .copied{
      display: none;
      position: absolute;
      user-select: none;
      text-transform: uppercase;
      background: #2bb12b;
      color: white;
      border-radius: 6px;
      padding: 1px 5px;
      top: 4px;
      right: 38px;
    }
    button{
      width: 25px;
      height: 25px;
      position: absolute;
      top: 40px;
      right: 12px;
      cursor: pointer;
      background: transparent;
      border: 0;
      &:hover{
        opacity: 0.5;
      }
      &:focus{
        opacity: 1 !important;
        .copied{
          display: block;
        }
      }
      svg{
        width: 23px;
        fill: white;
        position: absolute;
        top: 0; right: 0;
      }
      code{
        padding: 0.5rem 1.5em !important;        
        border-radius: 3px;
      }
    }
  }
}
View Compiled
// We color the blocks of code
hljs.highlightAll();

// We manage the user's copies 
let id = 0;
let text = "";
$('button').click(function(){
  id = $(this).attr('id').substr(11);
  text = $('#code-'+id).text();
  
  navigator.clipboard.writeText(text);
});

$('img').click(function(){
  console.log(navigator.clipboard.readText());
});

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/atom-one-dark.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js