전체 글 16

[Java script] 2. 추상화

// 할당 연산자 (Assignment operators) = 지정했다. 대입했다. let name = '코드잇'; let x = 5; x = x - 2; // 증가(increment), 감소(decrement) 연산자 x = x + 1; x += 1; x++; x = x -1; x -= 1; x--; ex) // 여기에 logParticipant 함수를 작성해 주세요. function logParticipant(userName) { console.log(userName + '(이)가 대화에 참여했습니다.'); } console.log(`${userName}(이)가 대화에 참여했습니다.`; } `` '' "" 구분 `` 로 사용 // 테스트 코드 logParticipant('동수'); logPartici..

카테고리 없음 2022.02.01

[Java script] 1. 자료형

# 변수 let brand = 'Codeit' function 함수이름() { 명령; 명령; }: ex.1) function greetings() { console.log('Hi'); console.log('안녕'); console.log('こんにちは'); console.log('你好'); console.log('Guten Tag'); console.log('Bonjour'); console.log('Buongiorno'); }; //함수 호출 greetings(); ex.2) 애국가 후렴 넣기 // 코드를 작성해 주세요. function printChorus() { console.log('무궁화 삼천리 화려 강산'); console.log('대한 사람 대한으로 길이 보전하세'); } // 애국가 가사 ..

카테고리 없음 2022.02.01

4. 토픽

1. 리스트 # 리스트(list) numbers = [2, 3, 5, 7, 11, 13] 인덱스 0, 1, 2, 3, 4, 5, 6 # 0부터 시작, 뒤에서 부터는 -1부터 시작 names = ["윤수", "혜린", "태호", "영훈"] # 인덱싱(indexing) print(names[1]) print(names[0]) print(number[-1]) 13 print(number[-2]) 11 # 리스트 슬라이싱(list slicing) print(number[0:4] 0 ~ 3까지 2, 3, 5, 7 print(number[2:]) 2부터 마지막까지 print(number[:3] 처음부터 인덱스 2까지 2, 3, 5 new_list = numbers[:3] # 2, 3, 5 print(new_list..

파이썬 Study 2022.01.21

2. 추상화

#def ex.1) def hello() : print("Hello!") print("Welcome to Codeit!" print("함수 호출 전") hello() print("함수 호출 후") 함수 호출 전 Heppo! Welcome to Codeit! 함수 호출 후 ex.2) def square(x): return x * x print("함수 호출 전") print(square(3) + square(4)) print("함수 호출 후" #return - 역할 : 함수 즉시 종료, 값 돌려주기 def square(x): print('함수 시작") return x * x print("함수 끝") print(square(3)) print("Hello World!") 3입력하면 return 값으로 x로 입력..

파이썬 Study 2022.01.16

1. 자료형

#함수 7//2 버림 나눗셈 3.5 에서 3만 나오게 7 % 2 나머지 연산(modulo operator) 3 나머지 1, 1만 나오게 4/2 = 2.0 (float) " " 안에 " or ' 표시시 \(역슬러시 사용) round함수 (반올림) round(3.1415926525) -> 3 round(3.1415926525,3) -> 3.141 int(3.8) -> 3 정수변환 int("2") + int("5") -> 7 float(3) -> 3.0 소수변환 float("1.1") + float("2.5") = str(2) -> 문자열 str(2) + str(5) = 25 age = 7 print("제 나이는" + str(age) + "살입니다.") print(int("Hello world!") -> 오류..

파이썬 Study 2022.01.05