Codeup 1216 - 컨설팅 회사 http://codeup.kr/problem.php?id=1216 Codeup 1216 - 컨설팅 회사 xxxxxxxxxxno_advertise, advertise, advertise_cost = input().split()no_advertise = int(no_advertise)advertise = int(advertise)advertise_cost = int(advertise_cost)if(advertise - advertise_cost == no_advertise): print('does not matter')elif(advertise - advertise_cost > no_advertise): print('advertise')else: print('do not advertise') Codeup 1214 - 이 달은 며칠까지 있을까 http://codeup.kr/problem.php?id=1214 Codeup 1214 - 이 달은 며칠까지 있을까? xxxxxxxxxxyear, month = input().split()year = int(year)month = int(month)february = 0if(((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0)): february = 29else: february = 28if(month Codeup 1212 - 삼각형의 성립 조건 http://codeup.kr/problem.php?id=1212 Codeup 1212 - 삼각형의 성립 조건 xxxxxxxxxxnumbers = list(map(int, input().split()))numbers.sort()if(numbers[0] + numbers[1] > numbers[2]): print('yes')else: print('no') Codeup 1210 - 칼로리 계산하기 http://codeup.kr/problem.php?id=1210 Codeup 1210 - 칼로리 계산하기 xxxxxxxxxxmenu = [0, 400, 340, 170, 100, 70]menu_number1, menu_number2 = input().split()menu_number1 = int(menu_number1)menu_number2 = int(menu_number2)sum_of_calorie = menu[menu_number1] + menu[menu_number2]if(sum_of_calorie > 500): print('angry')else: print('no angry') Codeup 1207 - 윷놀이 http://codeup.kr/problem.php?id=1207 Codeup 1207 - 윷놀이 #include int main(void){ int is_flip[4]; int is_flip_count = 0; int i; for (i = 0; i 장고 걸즈 튜토리얼 따라하기 9 - 템플릿 동적 데이터 템플릿 동적 데이터뷰는 모델과 템플릿을 연결하는 역할을 한다. post_list를 뷰에서 보여주고 이를 템플릿에 전달하기 위해서는, 모델을 가져올 필요가 있다.blog/views.py 파일을 열어서 post_list 뷰를 본다.from django.shortcuts import renderdef post_list(request): return render(request, 'blog/post_list.html', {})models.py 파일에 정의된 모델을 가져오기 위해 from .models import Post를 추가한다.from django.shortcuts import renderfrom .models import Post 쿼리셋(QuerySet)글 목록을 게시일 published_date 기준으.. 장고 걸즈 튜토리얼 따라하기 8 - 장고 ORM과 쿼리셋 쿼리셋이란?쿼리셋(QuerySet)은 전달받은 모델의 객체 목록이다. 쿼리셋은 데이터베이스로부터 데이터를 읽고, 필터를 걸거나 정렬 할 수 있다. 장고 쉘(shell)로컬 콘솔에서 아래 명령을 입력한다.x(myvenv) ~/djangogirls$ python manage.py shell그러면 장고 인터랙티브 콘솔로 들어갈 수 있다. 모든 객체 조회하기모든 글들을 출력하기 위해서 blog.models에서 Post 모델을 import 해온다.>>> from blog.models import Post그리고 아래 명령을 입력해 모든 글들을 출력한다.xxxxxxxxxx>>> Post.objects.all() 객체 생성하기이번에는 새 글을 포스팅 해본다.우선 작성자 정보를 가져오기 위해서 User 모델을 불러온다.. Codeup 1206 - 배수 http://codeup.kr/problem.php?id=1206 Codeup 1206 - 배수 xa, b = input().split()a = int(a)b = int(b)if(a % b == 0): print(str(b) + '*' + str(int(a/b)) + '=' + str(a))elif(b % a == 0): print(str(a) + '*' + str(int(b/a)) + '=' + str(b))else: print('none') 이전 1 ··· 26 27 28 29 30 31 32 ··· 36 다음