Skip to content

Instantly share code, notes, and snippets.

View selimhamidou's full-sized avatar

Sélim Hamidou selimhamidou

View GitHub Profile
# Sum of unique elements
# from collections import Counter
# def getCount(myArray):
# count=0
# unique_elements_array=[]
# myCounter=Counter(myArray)
# for i in myCounter:
# if myCounter[i]==1:
# unique_elements_array.append(i)
# count+=1
<form method='POST' action="{% url 'homeview' %}">
{% csrf_token %}
<input type="submit" value="OK">
</form>
#https://www.hackerrank.com/challenges/new-year-chaos/problem
def minimumBribes(q):
count=0
q=[p-1 for p in q]
for i in reversed(q):
ind=q.index(i)
if ind>i:
temp=ind-i
print(temp)
if temp>2:
def function(request):
def sub_function(request):
return render(request, 'link.html', {})
return render(request, 'link2.html', {})
<form method = "POST" action="resultat.html"> {% csrf_token %}
{{ form }}
<input type = "submit" value = "Submit">
</form>