Skip to content

Instantly share code, notes, and snippets.

View 42musaev's full-sized avatar

Askhab Musaev 42musaev

View GitHub Profile
@42musaev
42musaev / .py
Last active June 27, 2023 09:44
check long word
_ = input()
words = input().split()
max_length = 0
longest_word = ""
for word in words:
if len(word) > max_length:
max_length = len(word)
longest_word = word
temperature_of_days = [[-1, -10, -8, 0, 2, 0, 5], [3, 2, 5, 4, 8], [1, 2, 5, 4, 8]]
def check_chaotic_temperature(temperature_of_days):
chaotic_days = 0
n = len(temperature_of_days)
if n == 1:
return 1
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import api_view
from rest_framework import generics
from rest_framework.response import Response
from accounts.constants import UserStatus
from payments.serializers import UserCardAddSerializer, UserCardSerializer
from payments.utils import checkout_payment_token
from payments.models import UserCard
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import api_view
from rest_framework import generics
from rest_framework.response import Response
from accounts.constants import UserStatus
from payments.serializers import UserCardAddSerializer, UserCardSerializer
from payments.utils import checkout_payment_token
from payments.models import UserCard
import os
from django.contrib.auth import get_user_model
from core.celery import app
from django.core.mail import EmailMessage
from django.template.loader import render_to_string
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from django.contrib.auth.tokens import default_token_generator
from django.contrib.auth import get_user_model
from django.utils.http import urlsafe_base64_decode
from rest_framework import generics, permissions
from rest_framework.decorators import api_view, permission_classes
from rest_framework.exceptions import PermissionDenied
from rest_framework import status
from rest_framework.generics import UpdateAPIView
from rest_framework.parsers import MultiPartParser, JSONParser
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
@42musaev
42musaev / example3.py
Last active September 25, 2020 08:31
import requests
from bs4 import BeautifulSoup
URL = 'https://www.python.org/'
HEADERS = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,' \
'image/avif,image/webp,image/apng,*/*;q=0.8,application/' \
'signed-exchange;v=b3;q=0.9', \
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' \
'(KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'
@42musaev
42musaev / example2.py
Last active September 25, 2020 08:24
Написал основные тесты.
import unittest
# The function returns the number module.
# You need to make a comparison.
# Also add check for types.
def is_even(number):
''' Returns True if **number** is even or False if it is odd. '''
return number % 2 == 0
from django.db import models
from django.http import HttpResponse
class Product(models.Model):
categories = models.ManyToManyField(Category,
related_name='products',
blank=True, verbose_name=u"категории")
related_products = models.ManyToManyField('Product',
blank=True,