목록Python (2)
우당탕탕 개발일지
코테 - Python 문법
변수 선언 파이썬은 JS와는 달리, var, const, let과 같은 변수선언문이 없다. 따라서 변수에 값을 할당할 때, 변수 이름만 적고 값을 할당해주면 된다. 기본 자료형 JS 자료형 - number, string, boolean, undefined, null, Symbol, Object 파이썬 자료형 - 숫자형(integer, float), 문자열 자료형(String), 리스트 자료형(Array), 튜플 자료형, 딕셔너리 자료형, 집합 자료형(Object), 불 자료형(boolean) 입력 JS는 stdin을 불러오거나 readline 모듈을 불러와서 처리해줘야 하지만, 파이썬에서는 input 함수를 사용한다. input()은 한 줄 단위로 문자열을 입력을 받는다. input().split()를 ..
Python
2023. 6. 4. 21:05
최소공배수
#include int main(){ int num1, num2, temp; printf("두 정수를 입력하시오:"); scanf("%d %d", &num1, &num2); for(int i = num1 * num2; i >= 1; i--) // 두 정수의 가장 큰 공배수 만큼 i 증가 if(i % num1 == 0 && i % num2 == 0) temp = i;// 두 정수의 공배수를 temp에 입력 printf("최소공배수: %d\t", temp);//최종 적으로 가장 작은 공배수가 출력 return 0; }
Python
2023. 3. 23. 22:01