<jupyter_start><jupyter_text>Flamingo Learner - First lesson: "Hello World" By end of the first lesson, you will learn to make a simple Python-calculator!<jupyter_code># First of all, let's see how we can write a comment in your script that does not interfere
# with your scripts!

# By adding an octothorp symbol (also known as hashtag #), you can ask your script
#to not read your comments as part of the script

# "Print"ing is one of the main and of course simplest codes in Python

# You can print any text/number using the "print" syntax as:

print("Hello World")

# Note that in Python 2.7, you can simply type  -- print "Hello World" -- 
# But if you are using Python 3.7, the text has to be in a bracket (i.e. print("example"))
# One of the main strengths of Python is in calculation

# The four main calculation symbols: + - * / can be used simply by typing them as follows:

print(4 + 2)
print(4 - 2)
print(4 / 2)
print(4 * 2)<jupyter_output>6
2
2
8<jupyter_text>Now let's broaden this topic! In general, we have two main numeric types: int and float in python 2.7 we also have long integer, with this official definition from Wikipedia:   a long integer can represent a  whole integer whose range is greater than or equal to  that of a standard integer on the same machine.   Note that long integer is not a very common type, as it is even removed in python 3.7 So we mostly ignore this type, to keep our goal of teaching practical Python! In addition, we have complex numeric type as well, that we will talk about it in the next sessions But now! Let's take a look at the important ones: int and float<jupyter_code># Let's see the difference between int and float in practice!

# The official difference between int and float, is in their output format.

# In other words, int just shows the downward rounded number with no decimals
# But float can show all the decimals precisely

# Example

print("The integer values")
print(int(2))
print(int(2.9233)) 

print("")

print("The float values")

print(float(2))
print(float(2.9233))<jupyter_output>The integer values
2
2

The float values
2.0
2.9233<jupyter_text>Did you see what just happened? The integer values showed just the downward rounded values but the float showed all the decimals! There is an unwritten law that says: Always use float type number, unless you have to use integer Now that we learnt about the four main operators, let's take a look at more advanced operators for power and floor division:<jupyter_code># For the power operator, we simply can use two * in a row as follows:

print(2**4)
# For the floor division operator, we simply can use two / in a row as follows:
# Note: For those who are not familiar with floor division operator, the floor division simply shows
# the remainder of a division

print(4//2, "This should be 2 because the remainder of 4/2 is 2")<jupyter_output>(2, 'This should be 2 because the remainder of 4/2 is 2')<jupyter_text>The next component is Function Function is an organized and reusable object that can be a series of pre-defined python operations  You can call a python function by simply calling its name and its corresponding arguments In general, python has several built-in operations, such as the mentioned print function that its name is just "print", and the required arguments are just the text you want to print.  Now take a look at an example<jupyter_code>### The following function is a sum function
### It requires two numbers, and the output
### result is just sum of the input values

def sum(number1,number2):
    
    answer = number1+number2
    print(answer)
    
### After defining the sum function, you can
### simply call the function and put two random
### numbers like 4 and 5 as follows and voilla!

print("Sum of 4 and 5 is ")
sum(4,5)
### Now let's make functions for the other four main
### operators:

# multiplication
def multi(number1, number2):
    
    answer = number1*number2
    print(answer)
    

# division    
def divide(number1,number2):
    
    answer = number1/number2
    print(answer)
    
    
# Subtraction
def sub(number1,number2):
    
    answer = number1-number2
    print(answer)
    
def power(number1, number2):
    
    answer = number1**number2
    print(answer)<jupyter_output><empty_output><jupyter_text>Now we have a simple calculator that works with four functions.  Let's take a look at some examples:<jupyter_code>number1 = float(5)
number2 = float(4)

print("Sum of number 1 and number 2 is:")
sum(number1, number2)
print("")
print("Number 1 minus number 2 is: ")
sub(number1, number2)
print("")
print("Number 1 divided by number 2 is: ")
divide(number1, number2)
print("")
print("Number 1 times number 2 is: ")
multi(number1, number2)
print("")
print("Number 1 to the power of number 2 is: ")
power(number1, number2)
### Note: when we wanted to define a float number, we used float() syntax.
### However, there is an easier way to define a float that can definitely increase
### your speed.

### Instead of float(number) you can simply put a period after the number to automatically 
### make a float number:

### Let's take a look at an example:
### number = float(4) = 4. = 4.0
### so you simply type: number = 4.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07667304015296367, 'fraction_numerical': 0.02084130019120459, 'mean_word_length': 4.210159362549801, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '517154', 'license': 'MIT', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1468, 'n_words': 771, 'path': 'FlamingoLearner-Lesson1-HelloWorld.ipynb', 'repo_name': 'FlamingoLearner/Lesson-1-Hello-World-', 'size': '5230'}