<jupyter_start><jupyter_text>Types and built-in functions<jupyter_code># Replace the value of this variable with your name
my_name = '<NAME>'<jupyter_output><empty_output><jupyter_text>```{admonition} Exercise: Run this code in your jupyter notebook andlook at the differences in the results```<jupyter_code>print(type(52))
print(type("52"))
print(type('52'))
print(type(52.0))<jupyter_output><empty_output><jupyter_text>Every value has a type.*   Every value in a program has a specific type.*   Integer (`int`): represents positive or negative whole numbers like 3 or -512.*   Floating point number (`float`): represents real numbers like 3.14159 or -2.5.*   Character string (usually called "string", `str`): text.    *   Written in either single quotes or double quotes (as long as they match).    *   The quote marks aren't printed when the string is displayed. Built-in functions*   Use the built-in function `type` to find out what type a value has.*   Works on variables as well.    *   But remember: the *value* has the type --- the *variable* is just a label. ```{admonition} Exercise: Run this function in your jupyter notebook and read the output carefully.```<jupyter_code>def get_gdp(C,I,G,X,M):
     return  C + I + G + (X - M)

island_gdp = get_gdp(1000000, 500000,800000,100000,2000000)
print(island_gdp)<jupyter_output>400000<jupyter_text>Types control what operations (or methods) can be performed on a given value.*   A value's type determines what the program can do to it.<jupyter_code>print(5 - 3)
print('hello' + ', ' + my_name)<jupyter_output><empty_output><jupyter_text>You can use the "+" and "*" operators on strings.*   "Adding" character strings concatenates them.<jupyter_code>full_name = 'Ahmed' + ' ' + 'Walsh'
print(full_name)<jupyter_output><empty_output><jupyter_text>*   Multiplying a character string by an integer _N_ creates a new string that consists of that character string repeated  _N_ times.    *   Since multiplication is repeated addition.<jupyter_code>separator = '=' * 10
print(separator)<jupyter_output><empty_output><jupyter_text>Strings have a length (but numbers don't).*   The built-in function `len` counts the number of characters in a string.<jupyter_code>print(len(full_name))<jupyter_output><empty_output><jupyter_text>*   But numbers don't have a length (not even zero).<jupyter_code>print(len(52))<jupyter_output><empty_output><jupyter_text>Must convert numbers to strings or vice versa when operating on them.*   Cannot add numbers and strings.<jupyter_code>print(1 + '2')<jupyter_output><empty_output><jupyter_text>*   Not allowed because it's ambiguous: should `1 + '2'` be `3` or `'12'`?*   Some types can be converted to other types by using the type name as a function.<jupyter_code>print(1 + int('2'))
print(str(1) + '2')<jupyter_output><empty_output><jupyter_text>Can mix integers and floats freely in operations.*   Integers and floating-point numbers can be mixed in arithmetic.    *   Python 3 automatically converts integers to floats as needed. (Integer division in Python 2 will return an integer, the *floor* of the division.)<jupyter_code>print('half is', 1 / 2.0)
print('three squared is', 3.0 ** 2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10972568578553615, 'fraction_numerical': 0.026184538653366583, 'mean_word_length': 5.562372188139059, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '337535', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1003, 'n_words': 349, 'path': '01_Day_1_Unix_Shell/excercises/B3_Exercise.ipynb', 'repo_name': 'TU-Delft-DCC/Intro-to-Python-forGIS', 'size': '3215'}