본문 바로가기

전체 글1080

[파이썬] 문제 : turtle 이름쓰기3 import turtle import math t = turtle.Turtle() t.hideturtle() t.width(3) def get_length(base, height): # 빗변 길이. hypotenuse return math.sqrt(base**2 + height**2) def get_angle(base, height): # 각도 계산 angle = math.atan(height / base) return angle * 180 / math.pi def draw_ㅇ(x, y, width, height): t.penup() # t.goto(x+(int(width/2)), y-(int(height/2))) t.goto(x, y-(int(height/2))) t.pendown() t.circle(.. 2024. 1. 11.
[파이썬] 문제 : turtle 이름쓰기2 import turtle import math t = turtle.Turtle() t.hideturtle() t.width(3) def get_length(base, height): # 빗변 길이. hypotenuse return math.sqrt(base**2 + height**2) def get_angle(base, height): # 각도 계산 angle = math.atan(height / base) return angle * 180 / math.pi def draw_ㅇ(x, y, width, height): t.penup() # t.goto(x+(int(width/2)), y-(int(height/2))) t.goto(x, y-(int(height/2))) t.pendown() t.circle(.. 2024. 1. 11.
[주식] DPS(주당 배당금 : Dividend Per Share) 회사가 주주에게 지급하는 배당금을 총 발행 주식 수로 나눈 값 DPS = 배당금 / 주식수 주식 투자로부터 얻을 수 있는 현금 수익 (투자자에게 중요, 배당 직급 능력, 재정적 안정성) 2023. 12. 21.
[주식] BPS(주당순자산가치 :Book-value per share) 주당 순자산가치는 기업의 순자산을 발행 주식수로 나눈 것 순자산 = 기업총자산 - 부채 BPS = 순자산 / 주식수 BPR = BPS / 현재주가 (BPS가 1만원일때 현재 주가가 5000원이면 BPR은 0.5) 평가 - 주가가 BPS보다 낮은면 저평가 - 주가가 BPS보다 높으면 고평가 * BPS만으로 주식 가치 판단은 어려움. 2023. 12. 21.
[파이썬] 문제 : 2개의 주사위 결과 합 함수만들기 두 개의 주사위를 던져서 나오는 두 눈의 수의 합을 구하는 프로그램을 작성하시오 조건 두 눈의 수는 각각 랜덤으로 구하고 실행예시 와 같이a,b 주사위 숫자를 각각 출력한다 두 눈의 합을 구하는 함수를 작성하고 호출하여 출력한다. (a의 주사위 숫자는 2 b의 숫자는 5 두 눈의 합과 곱은 7. 10이다)출력 import random def add(a, b): return a+b n1 = random.randint(1,6) n2 = random.randint(1,6) n_sum = add(n1, n2) print('주사위1=',n1,' /주사위2=',n2,' /합: ',n_sum) 2023. 12. 20.
[파이썬] 문제 : 1~100까지 합 중 3000 넘는 숫자와 4000 넘는 합 출력 1에서 100까지 합을 구하는 중에 합이 4000을 넘을 때의 합과 3000을 넘게 한 숫자를 출력하는 프로그램을 작성하세요 start = 1 end = 100 c1 = 3000 c2 = 4000 c1_n = -1 # 3000을 넘게 한 숫자 c2_sum = 0 # 4000을 넘을 때의 합 n_sum = 0 for n in range(start, end+1): # range는 end-1까지 나오기때문에 end=100 이어서 end+1 로 해야 100까지 나옴 n_sum += n if n_sum > c1 and c1_n == -1: c1_n = n if n_sum > c2 and c2_sum == 0: c2_sum = n_sum # print('n=',n,' /sum=',n_sum,' /c1_n=',c1_.. 2023. 12. 20.
[파이썬] 문제 : 과목 평균 구하기 (보라돌이,뚜비,나나) name = ['보라돌이', '뚜비', '나나'] avg = [0,0,0] for i in range(0, 3): a = int(input(name[i] + '의 정보 점수:')) b = int(input(name[i] + '의 음악 점수:')) avg[i] = (a+b) / 2 print(name[i] + '의 평균은',avg[i],'점 입니다!!!') 총점 구하기 과목 하나 늘려보기 과목당 평균 구해보기 name = ['보라돌이', '뚜비', '나나'] subject = ['정보','음악','과학'] total = 0 avg = [0] * len(name) subject_total = [0] * len(subject) for i in range(0, len(name)): s_sum = 0 for j .. 2023. 12. 18.
[파이썬] 문제 : 분자식을 분해해서 원소질량 합계 구하기 dic = {'H':1, 'O':16, 'Na':23, 'Cl':35.5, 'C':12.0} # 원소기호와 원소질량 ''' 물 : H2O 영화나트륨:NaCl 에탄올 : C2H6O 이사화탄소 : CO2 ''' molecule = 'NaCl' # CO2 , # 원소 분리 idx = 0 element_dic = {} # 분리된 원소 저장. 예: {'H':2, 'O':1} while True: # 무한 반복 tmp = molecule[idx] # 분자식 중에서 1개 문자 가져옴 # print(tmp, idx) if idx < len(molecule)-1: # 분자식의 마지막 문자가 아니면 if molecule[idx+1].isnumeric(): # 현재 문자의 뒷 문자가 숫자형태면 element_dic[tmp].. 2023. 12. 17.
[파이썬] 문제 : 프로세스, 쓰레드 리스트 import psutil # 실행 중인 모든 프로세스 목록을 가져오기 for proc in psutil.process_iter(['pid', 'name']): print(proc.info) import psutil # 프로세스 ID를 여기에 설정하세요 (예: 1234) process_id = 13988 try: # 해당 ID의 프로세스 객체 가져오기 process = psutil.Process(process_id) # 프로세스 내의 모든 쓰레드 정보 가져오기 threads = process.threads() for thread in threads: print(f"Thread ID: {thread.id}, CPU Time: {thread.user_time + thread.system_time}") exce.. 2023. 12. 16.
[파이썬] 문제 : mp3 정보 찾기 import eyed3 import os def get_mp3_tags(file_path): audio_file = eyed3.load(file_path) # MP3 파일 정보 로드 if audio_file is None: return "Invalid file or unsupported format" # 파일 정보 추출 title = audio_file.tag.title artist = audio_file.tag.artist album = audio_file.tag.album genre = audio_file.tag.genre year = audio_file.tag.getBestDate() length = audio_file.info.time_secs file_size = os.path.getsize(f.. 2023. 12. 14.
728x90
반응형