[CT4101]: Add Topic 2 Examples
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
independent variable, dependent variable
|
||||
30, 70
|
||||
40, 90
|
||||
40, 100
|
||||
50, 120
|
||||
50, 130
|
||||
50, 150
|
||||
60, 160
|
||||
70, 190
|
||||
70, 200
|
||||
80, 200
|
||||
80, 220
|
||||
80, 230
|
|
@ -0,0 +1 @@
|
||||
print("Hello world!")
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,9 @@
|
||||
public class staticvsdynamic1 {
|
||||
public static void main(String[] args) {
|
||||
int x = 4; // compiles ok
|
||||
x = 5; // compiles ok
|
||||
x = 3.14159; // compiler error
|
||||
x = "Hello world!"; // compiler error
|
||||
y = "abc123"; // compiler error
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
x = 4 # no errors
|
||||
x = 5 # no errors
|
||||
x = 3.14159 # no errors
|
||||
x = "Hello world!" # no errors
|
||||
y = "abc123" # no errors
|
@ -0,0 +1,5 @@
|
||||
import numpy as np
|
||||
a = np.array((1, 2))
|
||||
b = np.array((3, 4))
|
||||
dist = np.linalg.norm(a-b)
|
||||
print("The distance is:", dist)
|
@ -0,0 +1,6 @@
|
||||
x = 4
|
||||
print(type(x)) # prints "<class 'int'>" to the console
|
||||
x = "Hello world!"
|
||||
print(type(x)) # prints "<class 'str'>" to the console
|
||||
x = 3.14159
|
||||
print(type(x)) # prints "<class 'float'>" to the console
|
Reference in New Issue
Block a user