전체 글 226

04. Class 01

# 1 ~ 2 자동차 클래스 작성 - 제조사 색상 가격 모델명 """ class Car: def __init__(self, company='기아', model='K7', color='블랙', price='사천'): self.__company = company self.__model = model self.__color = color self.__price = price def car_info(self): print('회사 : ', self.__company, end=' ') print('모델 : ', self.__model, end=' ') print('색상 : ', self.__color, end=' ') print('가격 : ', self.__price, end=' ') def car_name(sel..

03. function

3개의 숫자를 입력 받아 크기가 큰 순서대로 출력 def inputlarge(a, b, c): if a > b: if a > c: if b > c: print(f'{a} {b} {c}') else: print(f'{a} {c} {b}') else: print(f'{c} {a} {b}') else: # b>a if b > c: if a > c: print(f'{b} {a} {c}') else: print(f'{b} {c} {a}') else: print(f'{c} {b} {a}') n1 = int(input("1 : ")) n2 = int(input("2 : ")) n3 = int(input("3 : ")) inputlarge(n1, n2, n3) 숫자 두개를 입력 받아 사칙연산 def plus(a, b)..

02. if ~ else, for

홀짝 num = int(input("숫자를 입력하세요")) if num % 2 == 0: print(f"{num}은 짝수입니다.") else: print(f"{num}은 홀수입니다.") 간단한 계산기 firNum = int(input("첫번째 숫자를 입력 :")) secNum = int(input("두번째 숫자를 입력 :")) operator = input("연산자를 입력 :") if operator == '+': print(f"{firNum} {operator} {secNum} = {firNum+secNum}") elif operator == '-': print(f"{firNum} {operator} {secNum} = {firNum-secNum}") elif operator == '*': print(..

WinForm : 슬라이딩 메뉴

Timer 사용 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ExamSlidingMenu { public partial class Form1 : Form { //슬라이딩 메뉴의 최대, 최소 폭 크기 const int MAX_SLIDING_WIDTH = 200; const int MIN_SLIDING_WIDTH = 50; //슬라이딩 메뉴가 보이는/접히는 ..

C#/C# WinForm 2023.01.16

08. 딕셔너리 Dictionary

키와 값이 쌍으로 존재하는 형태 형태 - {키 : 값} 첫 번째 키 값이 문자열이면 두 번째 키 값도 문자이어야 한다. dic = {'애플': 'apple', '파이썬': 'python', '마이크로소프트': 'micro', '구글': 'google'} for key, value in dic.items(): print(f'키 : {key}, 값 : {value}') 키 검색하기 # 키 검색 1 key = '구글' if key in dic.keys(): print(f'key {key} 가 딕셔너리에 있습니다.') else: print(f'key {key} 가 딕셔너리에 없습니다.') # 키 검색 2 find_key = '애플' res = dic.get(find_key) print('키를 검색해서 value..

Python/Python Basic 2023.01.16