Lecture 1
Intro
Some slides were borrowed from Josh Hug and Adam Jundt
Reminders
Plan for today
About me
Class overview
Class Overview
Why Java for Data Science?
I am scared of Java
In particular...
Why study algorithms and Data Structures?
Grade components:
Reading quizzes: 10%
Zybooks policies
Participation in class: 2% LUMVJP
Discussions: 4%
The purpose of discussions is to prepare you for taking exams on paper.
Process:
Notes:
Programming Assignments (PAs): 36%
Assignments. Late submissions
* Unless something exceptional had happened. Documentation will be required in some cases.
Exams: 50% in total
Collaboration
Asking questions is highly encouraged
Collaboration
Asking questions is highly encouraged
The limits of collaboration
ChatGPT: is it allowed?
Short Answer: No but Yes :)
NO: You can’t use it to solve the PAS. Remember the purpose of this class: practice as much as possible.
YES: One of the great advantage I see is the ability to generate questions that suit your needs.
Bottom Line: Do not use PAS questions since you have nothing left to practice on for real!
Not quite alone
Questions?
reminder
Basic rules -1: Demo
public static void main(String[] args)
Print all numbers from 1 to 5
#print numbers from 1 to 5
x = 1
while x <= 5:
print(x)
x = x + 1
Basic rules - 2
Discussion Question - 1
How many errors can you find in the code on the right?
A: 1
B: 2
C: 3
D: 4
E: 5 or more
Functions
# defining functions�def smaller(x, y):� """ Returns smaller of the two """�� if (x < y):� return x� return y�� print(smaller(3, 4))
Defining Functions. Basic Rules
Discussion Question
How many errors can you find?
A: 1
B: 2
C: 3
D: 4
E: 5 or more
Documenting your code with Javadoc
For loop in java
For loop in java
What is the output? *
A: 1, 3, 5, 7, 9
B: 1, 3, 5, 7, 9, 11
C: 1, 4, 7, 10
D: 1, 4, 7
E: None of the above
* Assume that the output does not have commas and each number is on a new line.
Main difference
Reflections on Static Typing
The Good:
�The Bad:
Talk to each other about pros and cons
Reflections on Static Typing
The Good:
�The Bad:
Short practice
Write a function expand that takes an integer and returns an integer array with numbers 1, 2.. up to (including) the parameter:
Example:
Input: 5
Output: [1, 2, 3, 4, 5]