You are on page 1of 7

Coding notes for finals

Computational thinking - process of formulating a problem and expressing its solution in a


way that a computer – human or machine – can carry out

Challenges of implementing AI:


1. Only limited number of people understand the potential of AI
2. Some AI continue to show errors and struggle to reach human-level performance
3. Concerns for data privacy and security
4. Large need for computing power that not everyone can afford
5. Ethical issues of responsibility and explanation of decision made by AI

Non linear interactions:


DESIGN THINKING - understanding problems, visualising solutions and analysing and
evaluating those ideas to meet criteria for success

SYSTEM THINKING - parts of a system are analysed individually to see how they influence
the functioning of the whole system

COMPUTATIONAL THINKING - process of formulating a problem and expressing its


solution in a way that a computer – human or machine – can carry out

Data processing - involves acquiring data from various sources, storing it in a suitable format
and then performing various operations to extract information from the data

Figma is a powerful design tool that helps you to create anything: websites, applications,
logos etc.
Pandas is a tool used for working with data sets; analysing and manipulating data

Key steps involved in design thinking:


1. Empathise - understand the problem
2. Define - state user’s needs and problems
3. Ideat - form an idea/concept
4. Design start to create portfolio/prototype
5. Test the design for end users

3 ways to problem-solve:
Algorithmic design - defining the problem, identifying the inputs and outputs, and then
creating a step-by-step procedure to solve the problem

Code generation - involves writing code in a programming language to implement the


solution to a problem.

Problem solving - involves identifying a problem, defining its requirements, and then finding
a solution. This may involve using algorithms and data processing techniques, as well as
creativity and critical thinking.

Data frames: is a data structure that organises data into a 2-dimensional table of rows and
columns.
Coding notes for finals

1. Slicing is a technique which is used to create small sets of your large data. Using
loc
2. Sorting is a technique that display data in an ascending or descending order
(data.sort_values), ascending = true/false
3. Grouping data by columns is used when you have duplicated data in a particular
column (data.groupby)

Pandas loc function is used to slice data based on index and columns. It is powerful tool
for data analytics

Pandas iloc - functions similar to loc to slice rows and columns, it uses index for columns
instead of column names

Data analysis - process of collecting, cleaning, sorting and processing raw data to extract
relevant information
- Python is used because it is easy to learn and has simple syntax. It has a big
collection of libraries for data manipulation

Python libraries:
1. Pandas - working with data sets; analysing and manipulating data
2. NumPy - working with maths operations on arrays
3. Seaborn - drawing statistical graphs
4. Matplotlib - plotting 2D graphs and other visuals

R is a free and open source programming language


- It has a vast community
- Very comprehensive
- Supports extensions
- Advanced statistical language

R is integrated into RStudio which runs R Commander

RStudio is an integrated development environment for R, which provides a user-friendly


interface for writing and executing R code.

An example of what can RStudio be used for


1. Code Editor
2. R Console
3. Workspace and History
4. Plots and files

P-value and t test


- The P-value is the probability of obtaining a test statistic as extreme or more extreme
than the one observed, assuming that the null hypothesis is true.
- The T-test is a statistical test used to compare the means of two groups.
Coding notes for finals

What is HTML?
- HTML is hypertext markup language
- A markup language is a set of markup tags
- The tags describe document content
- HTML documents contain HTML tags and plain text
- HTML documents are also called web pages

HTML Tags
- HTML tags are keywords (tag names) surrounded by ANGLE BRACKETS like <Html
tags>
- HTML tags normally come in pairs like <p> and </p>
- The first tag in a pair is the Start Tag, the second tag is the End Tag
- The end tag is written like the start tag, with a Slash before the tag name
- Start and End tags are also called Opening Tags and Closing Tags

Example: <tagname>content</tagname>

HTML can be edited using notepad (pc) or textedit (mac)

- Html headings are defined with the <h1>


- Paragraphs are defined with <p>
- Links are defined with <a>
- Images are defined with <img>

Html elements can have ATTRIBUTES.

Attributes provide ADDITIONAL INFORMATION about an element. Attributes are always


specified in THE START TAG
Eg. width = “105” <- 105 is the attribute

HTML Tables
- Tables are defined with <table>
- Table rows are <tr>
- Table data are <td>
- Table heading are <th>

HTML List
- HTML can have unordered lists & ordered lists
Unordered HTML List - the list items are marked with bullets
- The first item
- The second item
- The third item

Ordered HTML List - the list items are marked with numbers or letters
1. The first item
2. The second item
3. The third item
Coding notes for finals

HTML Forms
- Used to select different kinds of user input
- Used to pass data to a server
- Most import element is the <input>
- The <input> element is used to select user information
- An <input> element can be of type text field, checkbox, password, radio button,
submit button, and more.

Password defines a password field


<input type =”password”>

Radio buttons let a user select only one of a limited number of choices.
<input type="radio“>

Checkboxes let a user select zero or more options of a limited number of choices.
<input type="checkbox“>

Submit is used to send the form to a server


<input type="submit“>

Reset allows the user to clear all the input from form
<input type="reset“>

The <textarea> tag defines a multi-line text input control

Css
- stands for cascading style sheets
- Styles define how to display html elements

Css selectors are used to "find" (or select) html elements based on their id, classes, types,
attributes, values of attributes and much more
● element selector - selects elements based on the element name.
● id selector - selects elements based on the id attribute of an html tag
● class selector - finds elements with a specific class

There are three ways of inserting a style sheet:


- External style sheet
- Internal style sheet
- Inline style

*** What is the difference between HTML and CSS?


HTML is a markup language used to create web pages and web applications. CSS is
a style sheet language responsible for the presentation of documents written in a
markup language.

All html elements can be considered as boxes. In css, the term "box model" is used when
talking about design and layout.
Coding notes for finals

Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent

JAVA Script
How do you create a function in JavaScript?
- A JavaScript function is defined with the function keyword, followed by a name,
followed by parentheses ().

What is JAVA Script?


- JavaScript is a scripting language that enables you to create dynamically updating
content, control multimedia, animate images, and pretty much everything else.

What is JAVA Script used for?


- Data types & expressions
- Control statements
- Functions & libraries
- Strings & arrays
- Date, document, navigator, user-defined classes

Mock exam answers:

1. Define data analysis in Python?


Data analysis is the process of collecting, cleaning, sorting and processing raw data
to extract relevant information. Data analysis in python uses a big collection of
libraries for data manipulation.

2. What is Panda and how do you read a CSV file in Pandas?


Pandas is one of the Python libraries. It is used when working with data sets and
analysing and manipulating data.
You can read a CSV file in Pandas by loading the file into a dataframe:
import pandas as pd
df = pd.read_csv('data.csv')
print(df.to_string())

3. Define a data frame and explain how to select a subset of data in a Pandas
dataframe
Coding notes for finals

Data frame is a data structure that organises data into a 2-dimensional table of rows
and columns.
You can select a subset of data by using the loc() function. It works on the basis on
labels ie. we need to provide the row or column to choose
Pandas.dataframe.loc()
block.loc([0,1,3])

4. How to calculate the mean in python?


Using the mean () function. You need to import statistics and use mean () with your
sample as an argument. This will return with the mean of the sample.

5. What is the syntax to slice a portion of data from a Pandas data Frame in
Python, and how does it work?
Using the loc () function.
Dataframe.loc[starting_row:ending_row;starting_column:ending_
column]
You have the first row and last row separated by the colon. The comma separates
the rows and columns. Then you have the first column and last column.

6. Define data cleaning in Python


Data cleaning means fixing bad data in your data set. Bad data could be: Empty
cells, data in wrong format etc. Using dropna() removes the rows and columns that
have all values as Null (NaN).

7. Define what a scatter plot is and provide an example of using Python code
Scatter plot is a diagram where the data value is represented by a dot.
Matplotlib is used for plotting 2D graphs and other visuals. It can draw scatter plots
using 2 arrays (x axis, y axis).

8. Define data analysis in R


R analytics (or R programming language) is a free, open-source software used for all
kinds of data science, statistics, and visualisation projects. It can be used for
analytics to identify patterns and build practical models.

9. Explain what data transformation in R is


This function arranges the observations in order. You can use different functions such
as arrange (), select (), filter () etc.

10. What is the difference between HTML and CSS?


HTML is a markup language used to create web pages and web applications. CSS is
a style sheet language responsible for the presentation of documents written in a
markup language.

11. How do you create a hyperlink in HTML?


To make a hyperlink in an HTML page, use the <a> and </a> tags, which are the tags
used to define the links.
Coding notes for finals

The <a> tag indicates where the hyperlink starts and the </a> tag indicates where it
ends. Whatever text gets added inside these tags, will work as a hyperlink.

12. How do you create a function in JavaScript?


You start by using the keyword "function", followed by the function name and a set of
parentheses. Inside the parentheses, you can specify any input parameters that the
function will take in, also known as arguments.

13. Below is a Python code. What is the resulting output?


import pandas as pd
data = pd.read_csv("filename.csv")
print(data)
You will get csv reading a file

14. Consider the following Python code. What will be the output?
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
plt.scatter(x, y)
plt.show()
You will get a scatter chart

You might also like