본문 바로가기

프로젝트들/Python_Udemy7

[Python]37 - Check if Palindrome //입력문자가 '회문'인지 체크 또 쉬운 거 하나... 입력된 문자가 Palindrome (회문)인 지 확인하는 코드를 작성하자. 회문이란? 앞에서 읽으나 뒤에서 읽으나 같은 문자열을 말한다. 슈퍼주니어의 '로꾸거' 를 들으면, 많은 회문의 예를 볼 수 있다! (이렇게 세대 유추 가능... :-D) www.youtube.com/watch?v=K2CNJiAq_cY 파이썬 구현 ''' Check if Palindrome If the string entered by the user is a palindrome 12/28/20 ''' strInput = input("Which word do you want to check for palindrome? ;) ") if strInput == strInput[::-1]: print("Yes it i.. 2020. 12. 28.
[Python]15 - Tax Calculator 미국 도시 세금 계산기 파이썬 구현 ''' Tax Calculator Ask the user to enter a cost and a USA city, then it returns the tax plus the total cost with tax! 12/24/20 ''' import requests import bs4 import math def getSource(): res = requests.get("https://taxfoundation.org/sales-tax-rates-major-cities-2019/") return bs4.BeautifulSoup(res.text, "lxml") def getTaxRates(soup): # On the website, there is ONE table which lists tax ra.. 2020. 12. 24.
[Python]20 - Coin Flip Simulator 동전 던지기 유저가 원하는 수 만큼 동전을 던져 앞면과 뒷면이 몇 번 나오는 지 반환하는 프로그램을 만들어보자. 파이썬 구현 빨리 구현할 수 있는 문항을 찾아 했더니 정말 빨리 구현은 됐더란다... 다음엔 더 많이 배울 수 있는 것을 해봐야겠다. ''' Coin Flip Flipping a single coin however many times the user decides. The code should record the outcomes and count the number of tails and heads. 12/22/20 ''' from random import randint def coinFlip(numOfFlips): coinSides = {0: "head", 1:"tail"} flips = [] numHe.. 2020. 12. 22.
[Python]1 - Find Pi to the Nth Digit, 원주율 N번째 자릿수까지 계산하기 원주율이란? π = Pi = circumference / diameter = 3.14 구하는 방법 이집트나 바빌로니아에서 최초의 원주율을 바퀴를 직접 굴려 구했다고 한다. 우리가 잘 아는 기원은, 기원 전 250년 경 아르키메데스가 원에 내접 / 외접하는 96각형과 닮은 삼각형의 공식을 이용, 이의 둘레가 원의 둘레와 비슷할 것이라는 가정 하에 약 "3.14163"정도로 구한 것이다. 그 뒤엔 공식을 통해 원주율을 구하는 아주 다양한 방법이 나왔다. 밑의 두 개 링크 참조. 누가 뭐래도 나는 나무위키가 좋다 - namu.wiki/w/%EC%9B%90%EC%A3%BC%EC%9C%A8/%EC%97%AD%EC%82%AC 수학 관련 블로그 - www.mathscareers.org.uk/calculating-pi.. 2020. 12. 14.