기본 콘텐츠로 건너뛰기

나만의 프로그래밍 언어

Class
Class Person(String name="이름", String phone="010-0000-0000", String email="이름@naver.com") {

    return "Person(" + name + ", " + phone + ", " + email + ")";
}

변수
int value(0); // value라는 int타입 변수를 선언하고 0으로 초기화
value(10); // value라는 int타입 변수에 10이라는 값을 넣는다
value(); // value변수의 값을 꺼낸다

int value(x(0),y(0))->x+y;
value();

함수
int test(int x, int y) {
    return x + y;
}

test(x(10), y(20)) // 30

괄호 안에서도 로직을 짤 수 있다

쉼표로 문장을 구분

Optional

List
[]
Map
<>
Set
{}

set.contains {
    // 실행문
}

형변환
int('12') # 12
str(10) # '10'

반환 타입
function a (int a, int b) -> int {
}

함수 선언 형식
hello() {
    print("Hello, World!");
}

map
map = map()
map.key = "value" # {"key":"value"}
map.name = "smith" # {"key":"value","name":"smith"}

function(인수_1: 타입_1, 인수_2:타입_2): 반환값 {
    // 내용
}

var // 변하는 값
const // 변하지 않는 값

이 블로그의 인기 게시물

Python Sklearn make_regression

from sklearn.datasets import make_regression import matplotlib.pyplot as plt X, y = make_regression(n_samples=250, n_features=1, noise=50, random_state=2) plt.scatter(X,y, s=2) plt.show() from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split # 한글 깨짐 없이 나오게 설정 from matplotlib import rcParams # 인코딩 폰트 설정 rcParams['font.family'] = 'New Gulim' rcParams['font.size'] = 10 x_train, x_test, y_train, y_test = train_test_split(X,y, test_size=.20, random_state=0) x_train.shape, x_test.shape, y_train.shape, y_test.shape # 모델 생성 model = LinearRegression() # 학습하기 model.fit(x_train, y_train) # 가중치, 편향치 구하기 model.coef_, model.intercept_ # (array([90.11061494]), 2.4224269924448585) # 결정 계수 model.score(x_train, y_train) # 0.789267454050733 # 추정 pred = model.predict(x_test) # 산점도 plt.scatter(x_test,y_test) plt.plot(x_test, pred, 'r-') plt.show() # 추정 model.predict([[3.0]]) # 학습할 때 주는 데이터의 형식을 따른다 # x의 최소값, 최대값을 계수와 절편을 사용하여 ...

Javascript on 함수

엔터키 감지하기 <input type="password" onkeypress="func(event)" /> function func(event) {      if(event.keyCode == 13) { // keyCode 13은 엔터이다           alert("엔터를 입력했습니다.");     }     if (event.tartget.value == 13) {          alert("엔터를 입력했습니다.");     } }

Grid 정렬

  .container { display : grid ; gap : 22px ; width : 1000px ; grid-template-columns : repeat ( auto-fit , 150px ); margin : auto ; justify-content : center ; } .container {      display : grid ; gap : 22px ; grid-template-columns : repeat ( auto-fit , minmax ( 250px , 1fr )); }