<jupyter_start><jupyter_text>LAB 01: Python IntroPython is a great general-purpose programming language on its own, but with the help of a few popular libraries (numpy, scipy, matplotlib) it becomes a powerful environment for scientific computing.**We will use Python (version 3) in LING360 because:***   Python has an easy to learn syntax*   Most NLP programs are written in Python*   There are a lot of readily available packages for use*   Majority of Machine Learning / Deep Learning tools are built with Python Today we will cover:- Variables & Basic Data Types (*Number, String, Boolean*)- Printing and Fancy Printing- Python Syntax (`object.method()` or `function(object)`)- Automation- Conditionals If you have any questions, you can send an email to either `<EMAIL>` or `<EMAIL>`  Lab MaterialPython is basically a fancy calculator. You can print out stuff, you can also just do math or logic.<jupyter_code>"Yade"
# And If you put "hashtag" before it
# It will not do anything since they are comands.
# or 
print("Yade")
# plus
52191+1 
# division
52191/2
# floor division
52191//2
True and False<jupyter_output><empty_output><jupyter_text>You can also go one level more abstract. Instead of directly using a specific string or number, you can use a **variable** name.<jupyter_code>interesting_number = 52191<jupyter_output><empty_output><jupyter_text>Now whenever I use the name `interesting_number`, it will use `52191`.<jupyter_code>interesting_number * 100<jupyter_output><empty_output><jupyter_text>It is also possible for strings:<jupyter_code>interesting_name = "Yade"
print("Merhaba", interesting_name)
"Merhaba" + " " + interesting_name
# Or you can be more fancy:
print(f"Merhaba {interesting_name}")<jupyter_output><NAME><jupyter_text>What you can also do is you can do operations on variables, using certain verbs. (Check list this for more: [W3 Methods](https://www.w3schools.com/python/python_ref_string.asp).)<jupyter_code>interesting_name.upper()<jupyter_output><empty_output><jupyter_text>You can also use this in other functions like `print()`.<jupyter_code>print(interesting_name.upper(), "yapma!")<jupyter_output>YADE yapma!<jupyter_text>Or you can create a new variable:<jupyter_code>interesting_name_caps = interesting_name.upper()

print(f"{interesting_name_caps} yapma!")<jupyter_output>YADE yapma!<jupyter_text>What if you have more than one person to get angry?You can put all of the culprits into one single container, in this case a `list`. And, then you can refer to them according to the positions in the list.<jupyter_code>culprits = ["Yade", "Erce", "Oya"]
print(f"{culprits[0]} yapma!")
print(f"{culprits[1]} yapma!")
print(f"{culprits[2]} yapma!")<jupyter_output>Yade yapma!
Erce yapma!
Oya yapma!<jupyter_text>We can also access `strings` in the same manner since, they are one single container of letters.<jupyter_code>interesting_string = "Yoda"
print(f"{interesting_string[0]}")
print(f"{interesting_string[1]}")
print(f"{interesting_string[2]}")
print(f"{interesting_string[3]}")<jupyter_output>Y
o
d
a<jupyter_text>What if you have just too many items to go one by one?<jupyter_code>for culprit in culprits:
  print(f"{culprit} yapma!")<jupyter_output>Yade yapma!
Erce yapma!
Oya yapma!<jupyter_text>What we do is that we access each item in a container one by one.Another way to access to each item is to go over all positions, which are also called `indices` in a container.<jupyter_code>culprit_positions = [0,1,2]
for position in culprit_positions:
  print(f"{culprits[position]} yapma!")<jupyter_output>Yade yapma!
Erce yapma!
Oya yapma!<jupyter_text>So, we can do same with strings!<jupyter_code>interesting_string_positions = [0,1,2,3]
for position in interesting_string_positions:
  print(f"{interesting_string[position]}")<jupyter_output>Y
o
d
a<jupyter_text>One additional note that the positions can be also found in reverse order<jupyter_code>interesting_string_positions = [-1,-2,-3,-4]
for position in interesting_string_positions:
  print(f"{interesting_string[position]}")<jupyter_output>a
d
o
Y<jupyter_text>Exercises  TASK 1Assign your name to a variable called `my_name` and print it. You should get something like `Yade` not `"Yade"` nor `'Yade'`.<jupyter_code><jupyter_output><empty_output><jupyter_text>TASK 2Assign your school ID to a variable called `my_boun_id` andprint a statement saying that your school ID is 20XXXXXXX using printf.<jupyter_code><jupyter_output><empty_output><jupyter_text>TASK 3Apply a different method to your name and school id and print those. (Methods [link text](https://www.w3schools.com/python/python_ref_string.asp))<jupyter_code><jupyter_output><empty_output><jupyter_text>TASK 4Assign your surname to a variable called `my_surname`.Put your name and surname into a list called `my_full_name`.Using this list print your initials. You should have a statement like the following:```UT```<jupyter_code><jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09890555330360762, 'fraction_numerical': 0.012971220105391163, 'mean_word_length': 6.934083601286174, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '17', 'dir': 'jupyter-structured-clean-dedup', 'id': '307536', 'license': 'MIT', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1619, 'n_words': 525, 'path': 'labmaterial/LING_360_Lab_01 (1).ipynb', 'repo_name': 'cml2022/cml2022.github.io', 'size': '4972'}