This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSTALLED_APPS = [ | |
| 'story', | |
| 'django.contrib.admin', | |
| 'django.contrib.auth', | |
| 'django.contrib.contenttypes', | |
| 'django.contrib.sessions', | |
| 'django.contrib.messages', | |
| 'django.contrib.staticfiles', | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Environment: | |
| Request Method: GET | |
| Request URL: http://127.0.0.1:8000/story/home/ | |
| Django Version: 1.7.9 | |
| Python Version: 3.4.3 | |
| Installed Applications: | |
| ['story', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Login</title> | |
| </head> | |
| <body> | |
| <form action = "{% url 'login' %}" method = "post">{% csrf_token %} | |
| {{ form.as_p }} | |
| <input type = "submit" value="Login"> | |
| </form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.shortcuts import render , redirect | |
| from .models import Story | |
| from .forms import PostForm | |
| has_voted = False | |
| def postStory(request): | |
| form = PostForm() | |
| if request.method == "POST": | |
| form = PostForm(request.POST) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id,area,perimeter,compactness,length,width,asymmetry,groove,wheat_type | |
| 0,15.26,14.84,0.871,5.763,3.312,2.221,5.22,kama | |
| 1,14.88,14.57,0.8811,5.554,3.333,1.018,4.956,kama | |
| 2,14.29,14.09,0.905,5.291,3.337,2.699,4.825,kama | |
| 3,13.84,13.94,0.8955,5.324,3.379,2.259,4.805,kama | |
| 4,16.14,14.99,0.9034,5.658,3.562,1.355,5.175,kama | |
| 5,14.38,14.21,0.8951,5.386,3.312,2.462,4.956,kama | |
| 6,14.69,14.49,0.8799,5.563,3.259,3.586,5.219,kama | |
| 7,14.11,14.1,0.8911,5.42,3.302,2.7,,canadian | |
| 8,16.63,15.46,0.8747,6.053,3.465,2.04,5.877,kama |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| dataset = pd.read_csv("Datasets/wheat.data") | |
| df = pd.DataFrame(dataset) | |
| columns = ["area","perimeter","compactness","length","width","asymmetry","groove"] | |
| df.drop("id",axis=1,inplace=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.database.sqlite.SQLiteDatabase; | |
| import android.database.sqlite.SQLiteOpenHelper; | |
| public class BlabbrDB extends SQLiteOpenHelper { | |
| private static final String DATABASE_NAME = "contacts.db"; | |
| private static final String TABLE_NAME = "contacts"; | |
| private static final int VERSION = 1; | |
| private static final String COL_1 = "ID"; | |
| private static final String COL_2 = "NAME"; | |
| private static final String COL_3 = "NUMBER"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def possible(target): | |
| num_list = [1, 2, 5, 10, 20, 50, 100, 200] | |
| combinations = [] | |
| print(num_list) | |
| for i in num_list: | |
| for x in num_list: | |
| group = (i, x) | |
| if sum(group) <= target: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib.request | |
| import os | |
| import time | |
| from bs4 import BeautifulSoup | |
| from django.shortcuts import render | |
| from .forms import PostForm | |
| from .models import Movie | |
| def askInput(request): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getEven(): | |
| num_list = [i for i in range(1,11)] | |
| for i in num_list: | |
| if i % 2 == 0: # if even number | |
| yield i | |
| x = getEven() | |
| for i in x: | |
| print(i) # output = 2,4,6,8,10 | |