전체 글
-
[WIL] AI 웹개발 알고리즘, 7월 두 번째 주를 돌아보며..thoughts💭 2024. 7. 14. 19:32
Weekly I Learned 이번주는 정들었던 우린님, 상현님과 헤어져서 섭섭했고, 새로 시작되는 알고리즘 수업을 들으며 머리가 무거워졌다..음.. 뭔 말이야.. 내가 바본가?.. 예제가 어려운건가..?이런 생각들이 꼬리의 꼬리를 물었다.Stack 개념을 배우고 괄호 문제를 예제로 받았을 때나 Queue 개념을 배우고 N카드 문제를 예제로 받았을 때.. 그래도 N카드 문제는 데크(deque)를 공부하니 풀 수 있을 것 같은데 스택 괄호문제는 아직도 해결을 못했다.. 답을 보고도 잘 모르겠다..내일 튜터님을 찾아가야 할 것 같다.. 무서운 건... 답을 보고도 잘 이해가 안가는데.. 튜터님이 설명해주셔도 이해가 안갈까봐... 진도가 안나가서 큰일이다.. 겁이 덜컥 나는 한 주였다. 행복한 일이 하나 있다..
-
파이썬 알고리즘 초급 문제Python 2024. 7. 12. 23:21
codekata 9번 문제부터 프로그래머스 Q. 짝수의 합(정수 n이 주어질 때, n이하의 짝수를 모두 더한 값을 return 하도록 solution 함수를 작성하시오)def solution(n): n = int(n) even_sum = 0 for i in range(1, n+1): # range함수는 마지막 값 포함X if i % 2 == 0: even_sum += i return even_sum Q. 배열의 평균값 ( 정수 배열 numbers가 매개변수로 주어짐. numbers의 원소의 평균값을 return하도록 solution 함수 완성하기)def solution(numbers): average_num = sum(numbers)/len(n..
-
[파이썬, 자료구조 알고리즘] StackPython 2024. 7. 12. 01:16
Stack 빨래통에 빨래감을 담은 후 꺼내려고 할 때, 가장 마지막에 담은 빨래감을 가장 먼저 꺼내게 되듯이,데이터를 한 곳에서만 넣고 뺄 수 있고, 마지막에 넣은 데이터를 가장 먼저 꺼낼 수 있는 Last In First Out 자료 구조. 처음부터 구현을 할 수 있어야 한다고 해서 직접 해보기로. Stack에 들어가는 기본 단위를 Node이라고 한다. 이해하기 쉽게 Node를 빨래감이라고 하면,빨래감 노드은 두가지로 구성된다. 내가 갖고 있는 빨래감과 다음에 넣을 빨래감을 가리키는 역할.class 빨래감: def __init__(self, item, next) # 갖고있는 빨래감, 다음 빨래감을 가리키는 포인터 self.item = item self.next = next 그 다음은 스택(빨..
-
파이썬, 알고리즘... 뭔말이야..Python 2024. 7. 11. 02:55
문제: 알파벳 소문자로만 이루어진 단어 S가 주어진다. 각각의 알파벳에 대해서, 단어에 포함되어 있는 경우에는 처음 등장하는 위치를, 포함되어 있지 않은 경우에는 -1을 출력하는 프로그램을 작성하시오. 하.. 문제부터 이해를 안갔다.... 뭔말이야..ㅠㅠ겁이 났다. 아직 갈길이 먼데.. 일단 스스로 문제를 풀어보라는 강사님의 말씀에 한참을 바라보다가 지피티를 찾았다... 문제가 뭘 말하는지부터 좀 알려달라고... 그제서야 문제가 뭘 말하는지 이해가 됐다.그치만.. 훈련이 안되어 있기 때문일까.. 처음이어서 일까... 또 한참을 생각만 했다. 스스로는 풀지 못했고.. 이해만 했다...import stringdef get_idx(word): # point 1. ord result = [-1]*..
-
파이썬, flask, SQLAlchemy, SQLite, jsonify로 가위 바위 보 게임 코드 웹 페이지에 올리기Python 2024. 7. 10. 04:10
파이썬 코드, flask, SQLAlchemy를 활용하여 웹 페이지 구현 얼마 전 만든 파이썬 가위바위보 게임 코드를 flask, SQLAlchemy, html, css 등을 활용하여 웹페이지에 올려보았다.파이참의 파일 구조는 이렇다. .venvinstance├ game_history.dbstatic 파일 ├ style.csstemplates 파일├ index.htmlapp.py 난 웹페이지에 가위, 바위, 보를 이미지를 삽입해줬기 때문에 static file 안에 paper.png, rock.png, scissors.png 파일이 있다. app.py 전체 코드 from flask import Flask, render_template, request, jsonify, sessionfrom flask_..
-
flask 파이참 템플릿, code snippets이 안불러와질때Python 2024. 7. 9. 13:52
flask 로 웹페이지에 가위바위보 게임을 구현하는 코드를 만들고 있는데 f로 시작하는 flask code snippets이 자동으로 불러와지지 않았다. vscode에서는 되는데.. 예를 들어, ffor (flask for) 근데 파이참에서는 안됨.. 경원튜터님이 보내주신 방법으로 해보니 해결되었다. [방법]1. click here ←클릭하고 settings.jar 다운받기 2. 파이참 > file > Manage IDE Settings > Import Settings... 클릭 다운받은 파일 settings.jar 선택 3. 파이참 재시작 (자동으로 됨) 4. File > Invalidate Chaches... 5. Just Restart 클릭 사실 난 Invalidate and Restart를..
-
WIL 한주를 돌아보며 (깃허브, 팀프로젝트, 코드리뷰)thoughts💭 2024. 7. 6. 21:49
이번 한 주도 어떻게 흘러갔는지.. 시간이 진짜 빠른 것 같다. 이번주의 문제는 깃허브 리포지토리 생성 후 파이참과 연동하면서 시작됐다. 근데 이때부터 우리조가 친해진 것 같다. 서로 이거 안 된다고 도와달라고..ㅎㅎ 또 우리조에는 전공자이면서 현업에서 일을 했던 분이 계신데, 너무 잘 알려주시고 많은 도움을 주셨다. 뭔가 어렸을 때 형이나 언니가 있으면 괜히 든든한 것처럼, 그런 느낌으로 든든하다. 무엇보다 팀프로젝트를 하면서 더 친해진 것 같다. 특히 코드리뷰하는데 너무 웃겼다. 코드 안보인다고 화면 확대해달라고 하는데 갑자기 나이 얘기가 나오기도 하고, 코드 실행하는데 예기치 않은 에러가 나서 그거 같이 수정하고.. 암튼 설명하고 보니까 안 웃긴데.. 무튼 재밌었다. 그리고 내 코드를 설명하고 다른..
-
파이썬, class로 sns platform 코드2 input으로 객체 생성Python 2024. 7. 6. 00:20
이전 파이썬, class를 사용하여 만들었던 간단한 sns platform 코드에 회원 정보를 인풋으로 입력받아서 가져오는 코드를 추가했다. class Member, class Post 생성 부분은 거의 동일하다.import hashlibclass Member: def __init__(self, name, username, password): self.name = name self.username = username self.password = self._hash_password(password) # 좀 더 간결한 코드로 수정했다 def _hash_password(self, password): return hashlib.sha256(passwo..