blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
6f5388d24276d343b849424cb8611cabb2cf88d5 | yangguangleiyang/new-repository | /fullstack/week3/day9/深浅拷贝.py | 919 | 3.640625 | 4 | #浅拷贝
a=[2,4,"alex",[5,6,89]]
# b=a.copy()
# print(b) #此时b和a都指向了同一内存地址
#
# a.append("xiaowang") #新开辟了一块内存“xiaowang” 指向a,但是并没有指向b
# print(a)
# print(b)
#
# a[3][1]="lisi" #修改a中列表的值 同时b指向的是列表,所以其中的值改变了,b也会改变
# print(a)
# print(b)
#深拷贝
# 深拷贝完全赋值被复制对象的元素,不是复制内存地址,是开辟新的内存空间将被复制对象的值放在了新的内存空间中,
# 并将新的内存地址指向了新的变量,这样的话,修改原对... |
d9be6f3ed50711ebdc7c5cebcedd9041d62c6936 | youzeliang/rpc-proxy | /learn1/learn6.py | 472 | 3.90625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# # @Time : 2017/7/23 16:08
# for letter in "Runoob":
# if letter=='o':
# continue
# print("字母是",letter)
# var = 10
# while var>0:
# var = var-1
# if var ==6:
# continue
# print("",var)
# print("good")
for n in range(2, 20):
for ... |
47b4af1cbf40d5cfc9e5e15bbb665ee03e97f9ed | vasudevarora1996/Python | /picking_tickets.py | 783 | 4 | 4 | #!/bin/python3
"""
Picking Tickets HackerRank Problem
Consider an array of n tickets prices, tickets. A number, m, is defined as the size of some subsequence, s, of tickets where each element covers an unbroken range of integers. That is to say, if you were to sort the elements in s, the absolute difference between any... |
cef896ee5089dfea1b29ae05045ac14638ba5588 | dgzzn/P1 | /numeros_primos.py | 342 | 3.703125 | 4 | n = int(input('Digite o valor de N: '))
for i in range(1,n+1):
primo = True
for j in range(2, i): #número primo só é divisivel por 1 e ele mesmo
if i % j == 0: #range de 2 a i vai checar todos os números que não sejam 1 e i, já que range vai até i-1
primo = False
if primo:
... |
b3ff45f0f61cc77e6c3b50215570ba0ae2356fb3 | nadiamarra/learning_python | /emoji_triangle.py | 462 | 4.09375 | 4 | ##use both the for loop and a while loop
##printing one out and then two and then three and four... up to 10
##you can take advantage of the fact that you can multiply a string by a number
#to print it out multiple times.
##
##Or an alternative:
##nested loops so I'll show you that as a potential option
##... |
9f18079b3eff3f545de132fb8ef4e842aad1ec7d | unifloc/model_generator | /МФТИ ИПиЭД 2021/Задание №3,4/properties/water.py | 4,123 | 3.5 | 4 | # coding=utf-8
"""
Модуль, описывающий расчёт различных свойств воды
"""
from math import sqrt
def water_viscosity(
pressure_mpa: float,
temperature_k: float,
salinity_mg_liter: float,
gamma_w: float,
) -> float:
"""Расчитывает вязкость воды
:param float pressure_mpa: Давление (МПа)
:para... |
4eb505ac642ba01e0b81db6278d7948330303721 | DaanvanMil/INFDEV02-1_0892773 | /assignment53/assignment53/assignment53.py | 1,036 | 4.25 | 4 | import sys
word = raw_input("Give me a word or a sentence: ") #asks for input sentence or word
n = input("How much do you want to shift? ") #asks for number of shift
for c in word:
c = ord(c) #turn letters into number
if ord('a') <= c <= ord('z'): #if its number is between the values of the lower a and lower ... |
cd1a57838e69564d7c69c210947d1211c5365dc8 | GiraffaJ/Quickbots_2019-2020 | /function_example.py | 3,701 | 4.84375 | 5 | # If you use the same kind of process multiple times, it can be more effective to use a function.
# Think about the kitchen example, you make toast more than once in you're life, so you got a toaster.
# you give the toaster bread, the toaster performs functions within itself and then returns toast.
# You can do the... |
970b44ec65aa36de85ca2b6c0f8805a39c071cd3 | Nyamekesse/random-scripts | /access granted.py | 597 | 3.921875 | 4 | #THIS CODE GRANTS THE USER ACCES TO A COMPUETR IF THE INFO. PROVIDED IS TRUE
while True:
print('What is your name')
name = input()
if name != 'Kesse':
print('it is not you dude')
break
print('Hello, Mr. Kesse. What is your age?')
age = int(input())
if age != 19:
... |
5446096f8e3cc11720a7d8bda44899bd4291ce54 | JAYAROSHINI2112/dart-batch-2 | /control_structures_dart/list.py | 502 | 3.640625 | 4 | import time
start = time.time() # nano seconds
list = []
for i in range(100000):
list += [i]
end = time.time() # nano seconds
print('shorthand operator: ', end-start)
start = time.time() # nano seconds
list = []
for i in range(100000):
list.append(i)
end = time.time() # nano seconds
print('append functio... |
d95120a39c3be41db5fca9d4b7e9cc18cc8a4dce | dhruvpatel2308/python | /assignment3/tkinter.py | 2,642 | 3.734375 | 4 | from tkinter import *
r=Tk()
r.title("Calculator")
e=Entry(r,width=35,borderwidth=5)
e.grid(row=0,column=0,columnspan=3,padx=10,pady=10)
def btnclick(number):
current=e.get()
e.delete(0,END)
e.insert(0,current+str(number))
def btnadd():
a=e.get()
global f1
global ma... |
ab0913b63651f0242d7654a18d9fa0d9229cebfe | randyzingle/tools | /kub/services/archive/cdk/python/sample-app/.env/lib/python3.6/site-packages/cattr/experimental/gen.py | 1,265 | 3.796875 | 4 | """Generate tailored structuring and unstructuring functions."""
from typing import Callable, Sequence, Type
from attr import Attribute, fields
def make_unstruct_fn(cl):
"""Given an attrs class, make an unstructuring function for it."""
return make_unstruct_fn(cl)
def make_dict_unstruct_fn_from_attrs(cl, a... |
fc18556382f0cf29f7cdd0b807ecee76b299fffb | wavetogether/wave_algorithm_challenge | /2020/2020-03/04/eugene.py | 689 | 3.75 | 4 | # Runtime: 8 ms, faster than 99.52% of Python online submissions for Sort Colors.
# Memory Usage: 11.9 MB, less than 5.13% of Python online submissions for Sort Colors.
class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: None Do not return anything, modify ... |
565ebff6b015775fa5e02bf759049268e40a4163 | jose-dev/my-free-python-games | /freegames/pooping_snake.py | 6,475 | 4 | 4 | """Snake, classic arcade game.
Exercises
1. How do you make the snake faster or slower?
2. How can you make the snake go around the edges?
3. How would you move the food?
4. Change the snake to respond to arrow keys.
"""
import os
import random
import datetime
from turtle import *
from random import randrange
from ... |
5f206d4b65e975515050d7172989cecf2ea28416 | roger6blog/LeetCode | /SourceCode/Python/Problem/00234.Palindrome Linked List.py | 2,290 | 3.96875 | 4 | '''
Level: Easy Tag: LinkList
Given the head of a singly linked list, return true if it is a palindrome.
Example 1:
Input: head = [1,2,2,1]
Output: true
Example 2:
Input: head = [1,2]
Output: false
Constraints:
The number of nodes in the list is in the range [1, 105].
0 <= Node.val <= 9
Follow up: Could ... |
2fb8a8243d8dfc16ba3185db81f1d9fbd45878ec | kwadjooe/Learning_Python | /Accessing APIs.py | 675 | 3.6875 | 4 | import requests
city = "london"
# this will provide a sample data of the city used in the variable
urlx = "https://samples.openweathermap.org/data/2.5/weather?q="+city+"&appid=b6907d289e10d714a6e88b30761fae22"
# Send the request to the URL using GET method
req = requests.get(url = urlx)
output = req.json()
# Parse th... |
a3987a13a1b9f6763ad20dc4a4d00561311c1068 | erickmiller/AutomatousSourceCode | /AutonomousSourceCode/data/raw/sort/034c7035-84b9-4ae1-8293-a3d60815bf7c__sorted_string.py | 458 | 4.09375 | 4 | # Conor T. Ryan
# Week 5 Homework
# UW PCE Programming in Python
# Fall 2011 (Jacky)
def sorted_string(stringToSort):
# conv string into list and alphabetize
sortedList = list(stringToSort)
sortedList.sort()
# conv list back into string
result = ''.join(sortedList)
return result
if ... |
d7b1086208d5fd50bc40d99a84b568552661e14f | NyeongB/Coding_Test_Python | /basic/basic_07.py | 853 | 3.5625 | 4 | '''
출제 : 프로그래머스
난이도 : 레벨 1
문제 : 모의고사
날짜 : 21.01.08
유형 :
'''
def solution(answers):
count = [0] * 3
answer = []
su_1 = [1, 2, 3, 4, 5]
su_2 = [2, 1, 2, 3, 2, 4, 2, 5]
su_3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
for i, num in enumerate(answers):
if num == su_1[i % len(su_1)] :
... |
af62beaa0e4b20b06ef5d49c86c2bcb52320b3a2 | iri02000/rau-webappprogramming1 | /seminar6/question-lists.py | 736 | 3.765625 | 4 | l = []
n_commands = input()
n_commands = int(n_commands)
for i in range(0, n_commands):
command = input("Please enter a command:")
command_data = command.split(" ")
if command_data[0] == "insert":
index = int(command_data[1])
value = command_data[2]
l.insert(index, value)
elif c... |
e304c948a8328671616dff94cb34975d42674661 | soujatyabhat/JD_ASSIGNMENT | /WEEK4/program3.py | 462 | 4.125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 20:22:19 2020
@author: Sourick
"""
import random
def dice():
contrl = input("Press 'y' to dice the roll :")
n = random.randint(1,6)
print("Your point is : ",n)
return n
count = 0
n = dice()
while 1:
if count >= 12:
print("You are not allowe... |
f5a05f89ebd425b59fc110c565963fc6b26c5667 | souravs17031999/100dayscodingchallenge | /arrays/segregate_zeroes_ones_efficient.py | 1,297 | 3.640625 | 4 | # Program for zeros and ones segregatation, efficiently.
# Idea is to basically keep two pointers and then, we can keep on moving left pointers (incrementing) until we hit 1, and then keep on moving
# right pointers (decrementing) until we hit 0, and then, we will be able to actually stop at that position and now,
# if... |
3b2e073cd9d22cad15eb63e60e621fa6edcde1dc | skytreesea/do-it-python | /01/multi19.py | 103 | 3.8125 | 4 | for item in range(2,20):
for each in range(2,20):
print(f"{each} X{item}={item*each}")
|
4a7ca798ff9e6be80593d27ccd8ea2e4aa6fb73f | momo4826/leetCode | /ProductofArrayExceptSelf.py | 1,798 | 3.609375 | 4 | #me
class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
prod = 1
count = 0
for num in nums:
if num != 0:
prod = prod * num
else:
count += 1
r... |
76b7d0471330a19c54e54bd07eba645ebf3f219b | thinkingjxj/Python | /mark/week09/11.18/Descriptors.py | 3,252 | 4.40625 | 4 | # 描述器:用到3个魔术方法:__get__()、__set__()、__delete__()
# object.__get__(self, instance, owner)
# object.__set__(self, instance, value)
# object.__delete__(self, instance)
# self:当前实例,调用者
# instance是owner的实例
# owner是属性的所属的类
# class A:
# def __init__(self):
# self.a1 = 'a1'
# print('A.init')
#
# class B:
# ... |
4b84412ab9e7da23c9525a293b12c138788e208d | huananana/pythonStudy | /python基础语法/语言基础/day15-面向对象1/code/05-方法和构造方法.py | 980 | 4.3125 | 4 | """__author__=桃花寓酒寓美人"""
# 1.init方法和构造方法
"""
1) 构造函数 - python中声明类的时候,系统会自动声明一个和类同名的函数
(这个函数就是构造函数);用来创建当前类的对象
当我们调用构造函数创建对象的时候,系统会自动调用类中的__init__方法来初始化对象
2)init方法 - __init__(魔法方法)是一个对象方法。声明的时候函数名必须是__init__,并且保证这个方法是对象方法
声明后不用去调用,系统会自动调用
a.创建对象的时候系统自动调用__init__方法
b.创建对象的时候,构造函数... |
d76b89e4c91b718c11cab90f6d0dc8ee0bc59299 | wzbbbb/LeetCode-OJ | /Search in Rotated Sorted Array.py | 794 | 3.578125 | 4 | class Solution:
# @param A, a list of integers
# @param target, an integer to be searched
# @return an integer
def search(self, A, target):
n=len(A)
if n==0: return -1
else:
if target >= A[0]:
for i in range(n):
if target > A[i] and i+1< n:
if A... |
979a7694d391df6924a2945259b49e7a8e182b94 | ROHKW/programmers | /level 1/소수찾기 lv1.py | 991 | 3.734375 | 4 | def solution(n):
sieve = [True] * (n+1)
# n의 최대 약수가 sqrt(n) 이하이므로 i=sqrt(n)까지 검사
m = int(n ** 0.5)
for i in range(2, m + 1):
if sieve[i] == True: # i가 소수인 경우
for j in range(2*i, n+1, i): # i이후 i의 배수들을 False 판정
sieve[j] = False
# 소수 목록 산출
return len... |
f8bce53bdff1ed36d04cc8980fb0f1266aa79334 | DannyLee12/dcp | /_2020/10_October/230.py | 1,214 | 3.890625 | 4 | """
You are given N identical eggs and access to a building with k floors. Your
task is to find the lowest floor that will cause an egg to break, if dropped
from that floor. Once an egg breaks, it cannot be dropped again. If an egg
breaks when dropped from the xth floor, you can assume it will also break when
dropped f... |
aa285631716ab878c28a9f2a03f2967bbeca2c68 | frankieliu/problems | /leetcode/python/101/sol.py | 437 | 4.0625 | 4 |
6line AC python
https://leetcode.com/problems/symmetric-tree/discuss/33068
* Lang: python3
* Author: so_kid
* Votes: 46
def isSymmetric(self, root):
def isSym(L,R):
if not L and not R: return True
if L and R and L.val == R.val:
return... |
c5bcfaad25319751cd799eb4ef117712d75b8631 | SummerBigData/SurenRepo | /Coursera.EX4/numAlignment.py | 6,126 | 3.5625 | 4 | # Written by: Suren Gourapura
# Written on: June 12, 2018
# Purpose: To solve exercise 4 on Multi-class Classification and Neural Networks in Coursera
# Goal: Align numbers to make it easier for the neural network to read them
# Import the modules
import numpy as np
import scipy.io
import time
import struct as st
... |
15488617a7eafc6e4086a7f8f91e9cba49a34786 | NREL/alfalfa | /tests/integration/models/refrig_case_osw/python/case_cooling_to_zone.py | 1,737 | 3.90625 | 4 |
def case_cooling_to_zone(T_case_air, T_zone):
"""
This function is to calculate the case thermal load release to zones.
input: T_case_air, case internal air temperature
input: T_zone, zone/ambient air temperature
output: Q,
"""
"""
notes:
(1) case air temperature is the average temp... |
6d19a5a165f92ee2ad1efe4d864b7493b83ee819 | privateHmmmm/leetcode | /361-bomb-enemy/bomb-enemy.py | 1,902 | 3.84375 | 4 | # -*- coding:utf-8 -*-
# Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb. The bomb kills all the enemies in the same row and column from the planted point until it hits the wall since the wall is too strong to be dest... |
983fad9cb6426887417c1fa2770a9d0d04fe49c1 | adampely/laundryStatus | /accelVibeInTimeInveral.py | 1,227 | 3.609375 | 4 | from mpu6050 import mpu6050
from math import sqrt
from time import sleep
from numpy import array
from getAccelerometerValues import getAccelerometerValues
import numpy as np
def accelVibeInTimeInterval(timeInterval = 5, accelThreshold = 1)
'''
This function will run through the accelerometer values over the ti... |
9f0462bc2218b2163fbbe39ec9481a9354c2d257 | 15271856796/python_study | /day03 初始字典与集合/01 字典的嵌套.py | 194 | 3.578125 | 4 | # -*- coding:utf-8 -*-
dict={"1":1,"2":"sdf","3":{"1":2,"2":[1,2,3]}} #所有数据类型都是可以嵌套的,比如字符串,列表,元组,字典等等
print dict["3"]["2"][1] |
f6233353ea1f72fbd38caa6bf7e9312e2c4cd8e8 | sharkseba/taller-progra | /EjerciciosGuía1/ejercicio24.py | 832 | 3.796875 | 4 | #Escribir un algoritmo que solicite la cantidad de votos nulos, blancos y válidos de un proceso eleccionario y entregue los porcentajes obtenidos según los tipos de voto.
#Entradas
vNulo = int(input('Ingrese voto nulo: '))
vBlanco = int(input('Ingrese voto blanco: '))
vValido = int(input('Ingrese voto válido: '))
#Pr... |
8503ebe7b3d6965a1619e5f2b179d1f968cc95ad | pvd0anh/Learn-python | /Examble_day_1_OOP/Bai_tap_2_TruuTuong_class_Dog.py | 902 | 4.0625 | 4 | class Animal: # trừu tượng mang tính chất chỉ là khung
def say(self): # vào lớp con mới cài đặt
pass
def print_infor(self):
print("I say", self.say())
class DOG(Animal):
def __init__(self, name):
self.name = name
def say(self):
return "Gau Gau !"
class CAT:
de... |
508b9b740a192cecb4c84fe83ab9609ab96d343f | shenjinrong0901/python_work | /学习阶段历程/homework4.3.py | 498 | 4.125 | 4 | # ~ for number in range(1,21):
# ~ print(number)
# ~ print("\n")
# ~ numbers=list(range(1,100))
# ~ print(numbers)
squares=[]
for value in range(1,20,2):
square=value
squares.append(square)
print(squares)
print("\n")
squares=[]
for value in range(3,31,3):
square=value
squares.append(square)
print(squares)
print... |
4bf9071ad399663e842304b8c510657946b247f8 | ohadomrad/Examples | /UseKeras/MakeGradientDescent.py | 2,480 | 4.15625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 18 20:58:59 2019
gradient descent of the functions:
- f(x) = (x+5)^2
- f(x) = (-x+5)^2 * (x+3)^2
@author: dina
"""
def f1():
"""
optimization algorithm to find the minimum of the function starting from
the point x=3
f(x) = (x+5)^2
gradi... |
ff55c20f2db1e765d8144ff229dd3d92b7c937f8 | mdecourse/ECE470-Project | /Assignment_4.11/path_planner.py | 9,349 | 3.5 | 4 | # File which has the path-planning functions, making heavy use of collision_detection.py
import vrep
import math
import numpy as np
from numpy.linalg import inv, norm
from scipy.linalg import expm, logm
import collision_detection
import forward_kinematics
# Create a class to help us implement trees
class T... |
d20a9868ead6c14c04aef3b5fba3794e10f0df31 | freefly0706/leetcode_python | /algorithms/F1to50/AddTwoNumbers.py | 864 | 3.75 | 4 | # -*- coding: UTF-8 -*-
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
... |
43d6274129d73bea1579004a45c2764f92d3d71f | dbconfession78/interview_prep | /leetcode/108_convert_sorted_array_to_binary_search_tree.py | 1,734 | 4.125 | 4 | """
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
Example:
Given the sorted array: [-10,-3,0,5,9],
One po... |
185ed4451c960ecf318ad40556582cbd2f6b31c9 | MaoningGuan/LeetCode | /软件开发岗刷题(华为笔试准备)/队列和栈/CircularQueue_2.py | 3,573 | 3.65625 | 4 | # -*- coding: utf-8 -*-
"""
622. 设计循环队列
设计你的循环队列实现。 循环队列是一种线性数据结构,其操作表现基于 FIFO(先进先出)原则
并且队尾被连接在队首之后以形成一个循环。它也被称为“环形缓冲器”。
循环队列的一个好处是我们可以利用这个队列之前用过的空间。在一个普通队列里,一旦一个队列满了,我们就不能插入下一个元素,
即使在队列前面仍有空间。但是使用循环队列,我们能使用这些空间去存储新的值。
你的实现应该支持如下操作:
MyCircularQueue(k): 构造器,设置队列长度为 k 。
Front: 从队首获取元素。如果队列为空,返回 -1 。
Rear: 获取队尾元素。如果队列为... |
b7e033a6047923f02ef9371109b6d6c3dd3aada8 | teaisawesome/Szkriptnyelvek_Python | /hazifeladatok/het4/dectobin.py | 465 | 3.96875 | 4 | #!/usr/bin/env python3
def dec_to_bin(number):
reminders = []
while number != 0:
reminders.append(str(number % 2))
number = number // 2
return "".join(reminders[::-1])
def main():
dec_num = input("Kérek egy decimális számot: ")
print("A megadott szám bináris alakja: ", dec_... |
aa74d006eeddd8fb89091990cc82060569d8bc54 | rgonnering/cs50-project1 | /notes/application.py | 2,145 | 3.6875 | 4 | # Flask application from application.py in notes folder
# Present the user with a form to fetch some data and then
# Display all messages that were entered.
# import Flask from flask
# also import render_template, request, and session modules
# session lets us keep variable that are specific to a user
from flask imp... |
237d864f2e672143820e697be4245b20325fdc35 | marczakkordian/python_code_me_training | /02_flow_homework/02_conditional_statements/07.py | 825 | 4.09375 | 4 | # Rozwiń kod bmi.py z pierwszych zajęć dodając teraz instrukcję warunkową,
# która wyświetli w zależności od wyniku: niedowaga / waga normalna / nadwaga / otyłość.
# getting data from user
weight = float(input('Please enter your weight (kg)'))
height = float(input('Please enter your height (m)'))
# BMI formula
bmi = ... |
90cfcf8e9ba9b233f9cfe7d86043b3fe1995d34c | huningfei/python | /day9/进程/进程.py | 3,126 | 4.09375 | 4 | # 什么是进程 : 运行中的程序,计算机中最小的资源分配单位
# 程序开始执行就会产生一个主进程
# python中可以主进程中用代码启动一个进程 —— 子进程
# 同时主进程也被称为父进程
# 父子进程之间的代码执行是异步的,各自执行自己的
# 父子进程之间的数据不可以共享
# 主进程会等待子进程结束之后再结束
#开启一个子进程
import os
import time
from multiprocessing import Process
# def func(num):
# print(num,os.getpid())
# time.sleep(0.5)
# print(num,os.getpid(... |
d98db50970847704633094acf98dd38b5d70e9b4 | FelipePassos09/Curso-em-Video-Python-mod2 | /Exercícios/Ex#68.py | 1,349 | 3.96875 | 4 | '''
Faça um programa que jogue par ou impar com o computador. O jogo só será interrompido quando o jogador perder, mostrando o total de vitórias do jogador.
'''
from random import randint,choice
computer = randint(0, 10)
com_pi = choice(['P','I'])
player = int(input('Escolha um número ente 0 e 10:\n'))
esc =... |
1d783d52350a4dcfc37e5561123ffcaa1d6fe69d | aayushi-droid/Python-Thunder | /Solutions/listOfMultiplies.py | 284 | 4.125 | 4 | def list_of_multiples (num, length):
return [i*num for i in range(1,length+1)]
#Problem statement: Create a function that takes two numbers as arguments (num, length) and returns a list of multiples of num up to length.
#Problem Link: https://edabit.com/challenge/BuwHwPvt92yw574zB
|
a4841979fc792e4e93aef93b1957053d452545b9 | courtneyng/Intro-To-Python | /numbersmath/numbersmath.py | 1,072 | 4.5 | 4 | # Program ID: numbersmath
# Author: Courtney Ng
# This shows the beginning, asking about the chickens and using the basic print command
print ("I will now count my chickens.")
# This shows the amount of chickens you have printing which kind of chicken and the amount
print ('hens', 25 + 30 / 6)
print ('roosters'... |
ecbcd7fd50ba7c474cdda7917b7796c449865c9d | visualizeMath/Python-Scripts | /RemoveDuplicates.py | 1,679 | 4.03125 | 4 | import os
import hashlib
def find_duplicates(path):
# Create a dictionary to store the file hashes and paths
hashes = {}
total_size = 0
count = 0
# Loop over all the files in the directory and its subdirectories
for root, dirs, files in os.walk(path):
for filename in files:
... |
3a0eb697177d1588041ab5cc34c5f7f2f475a54d | zdyxry/LeetCode | /tree/0429_n_ary_tree_level_order_traversal/0429_n_ary_tree_level_order_traversal.py | 936 | 3.703125 | 4 | class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
class Solution(object):
def levelOrder(self, root):
"""
:type root: Node
:rtype: List[List[int]]
"""
if not root:return []
res = []
stack = [ro... |
bacec071265cf3cc4a0f47ab098c9ddd42f79770 | mcclayac/python101 | /tutorial/StudentTest.py | 515 | 4.0625 | 4 | firstName = input ("Firts Name")
lastName = input ("Last name:")
test1 = input("Test 1 :")
test2 = input("Test 2 :")
test3 = input("Test 3 :")
test1 = int(test1)
test2 = int(test2)
test3 = int(test3)
average = (test1 + test2 + test3) / 3
print(average)
report = "{last}, {first}\n\
Test 1: {test1}\n\
Test 2: {test2... |
117707224dc34f684f5dfb977c73523e41a61070 | swatibanka/python | /phyton 11am/demo17.py | 95 | 3.796875 | 4 | #WAS to read name from user
name = input("write your name ")
print("welcome Mr/Mrs ", name)
|
a33aa924fd70210c2e3c91363077264c76315482 | warrd18-meet/meet201617YL1cs-mod6 | /dictionary_practice.py | 1,137 | 4.5 | 4 | #Module 6, Part 5: Practice with dictionaries here
my_phonebook={"Statue of Liberty":2125555555, "Ghostbusters":2125551234}
###
#Assign the value of the Statue of Liberty's phone number to the variable, num
###
num = my_phonebook["Statue of Liberty"]
###
#Print the variable, num
###
print(num)
###
#Change the valu... |
f5735bc69039628f92667d341bddfd90e8c35b28 | AlexSkrivseth/python_scripts | /python_scripts/class_test.py | 651 | 4 | 4 | '''class Apple():
def __init__(self, c, w, t, f):
self.color = c
self.weight = w
self.type = t
self.freshness = f
apple = Apple("red", "16 oz", "Machintosh", "3 days old")
print(apple.color, apple.weight, apple.type, apple.freshness)
'''
import math
class Circle():
def __init__(self, d):
self.... |
be78eabd51354797a322bb896e16c6f10dc2eba2 | sebastianslupinski/ToDo | /model.py | 1,497 | 3.546875 | 4 | class TodoItem():
id = 0
def __init__(self, name, description, is_done=False):
self.name = name
self.description = description
self.is_done = is_done
self.id = TodoItem.id
TodoItem.id += 1
def change_name(self, new_name):
self.name = new_name
def cha... |
f3b22a785f37602fa7584b99e9480b081053be98 | evamc7/learn_python_the_hard_way | /ex10.py | 545 | 3.625 | 4 | # \t es com fer un tap (--> la flechita de espacio)
tabby_cat = "\tI'm tabbed in."
# \n backslash new line ( el que hi ha despres de la \n es posa a l linea de sota)
persian_cat = "I'm split\non a line."
# es posen dos \\ perque surti 1 \ per posar casracters especials dins duna cadena
backslash_cat = "I'm \\ a \\ cat... |
d1e35dfbe7e6fa252ea7e7182fcc2545b043348b | reharmony/cloudpython | /python16/상속/거북이각도입력이동.py | 406 | 3.671875 | 4 | import turtle
t = turtle.Pen()
while True:
방향 = input('왼쪽: left, 오른쪽: right >> ')
각도 = int(input('각도 입력>> '))
if 방향 == 'left':
t.left(각도) # 왼쪽으로 90도 방향 전환
t.forward(200) # 진행방향으로 쭉 진행
elif 방향 == 'right':
t.right(각도)
t.forward(200) # 진행방향으로 쭉 진행
|
f4b7043e9655e83e6fe2e9bf876247d9a59cc26b | oddotter/Python_Learning_history | /strings.py | 149 | 3.84375 | 4 | string = "This is my first string"
print(string)
print(type(string))
string2 = "abcdefghijklmnopqrstuvwxyz"
print(string2[:3]) #gets first 3 chars
|
cb279d7f7ccf6dc292c1fed84e90cfcc6d698827 | aiqiliu/imageResizer | /imageResizer.py | 4,893 | 3.65625 | 4 | #!/usr/bin/env python
# image resizer using PIL JPEG
# parameters: image_name [required], width [required|optional], height [required|optional], compression [optional]
# ouput: if required image doesnt exist or the required dimension aligns with the current one -> return false
# else: compression 0-100
import PIL
impor... |
72a91f5b9835e8af69123a984f6b6e8f75acb642 | adnanrahin/LeetCode-Company-Wise-Coding-Problems | /Amazon/flood_fill/__init__.py | 801 | 3.578125 | 4 | class Solution(object):
direction = [[1, 0], [-1, 0], [0, 1], [0, -1]]
def floodFill(self, image, sr, sc, newColor):
self.back_track(image, sr, sc, newColor, image[sr][sc])
return image
def is_valid(self, image, row, col):
return 0 <= row < len(image) and 0 <= col < len(image[0])... |
2771fb09671df3d86c93118fd8a26e377833900a | umunusb1/PythonMaterial | /python3/07_Functions/practical/tic_tic_toe.py | 4,219 | 3.859375 | 4 | #!/usr/bin/python3
"""
Purpose: Tic Tac Toe game
Author: Dhritiman Roy
"""
print("TIC TAC TOE GAME")
board = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
board_print = " " + board[6] + " | " + board[7] + " | " + board[8] + "\n" + "-----------" + "\n" + " " + board[
3] + " | " + board[4] + " | " + board[5] + "\n... |
ec2773715bf90475d4db116822137fb7dd6e23ed | stephen-weber/Project_Euler | /Python/Problem0056_powerfuldigitsum.py | 226 | 3.65625 | 4 | total=0
number=0
for a in range(0,100):
for b in range(0,100):
c= str(a**b)
f=[int(r) for r in c]
d=sum(f)
if d>total:
total=d
number=c
print total
|
0fed81c641516aa84104934d8226080ebd9dc547 | Pyrocaster/BasicPython | /Price Fetcher/PriceFetcher_Utilities.py | 1,935 | 4.28125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed May 17 03:59:46 2017
@author: srini
"""
import datetime as dt
import calendar as cal
#Returns command line input for year
def PromptUserForYear():
while True:
inputYear = input("Enter a Year: ")
#Check if input is in the correct range
... |
97175084c450f375db2e04c253cae056afdc3f96 | jonXue92/PythonGit | /Algorithm/chapter2/copy.py | 408 | 3.703125 | 4 | # -*- coding: utf-8 -*-
def copy(nums):
arr = [0]*len(nums) # 相当于Java中的new int[nums.length]
for i in range(len(nums)):
arr[i] = nums[i]
return arr
# 用list comprehension实现同样功能
def copy(nums):
arr = [x for x in nums]
return arr
# 以下相当于Java中的main函数
if __name__ == "__main__":
nums = [0... |
f2c49bd185781d13df9f335bfaee1649821f2156 | quanglm1998/ufldl-stanford | /ex1/logistic_regression.py | 2,795 | 3.609375 | 4 | import numpy as np
import matplotlib.pyplot as plt
import reader
import plot_data
class LogisticRegression(object):
"""Classify image 0 -> 9"""
def __init__(self, X, y, alpha=0.3, num_iter=1000, num_labels=10):
self.X = X
self.X = 1. * self.X / 256 # Normalize X
self.X = np.insert(s... |
5d75e6b35da7bb45816a4488f7c4d8c60ff4c6ba | Czapelsky/Big_Data | /Exercise10 - usuwanie duplikatow.py | 245 | 3.6875 | 4 | data = [1, 3, 5, 6, 3, 5, 6, 1, 3, 8, 9 , 1, 5]
result = []#PUSTA TABLICA
for i in data:# dla kazdego elementu z tablicy
if i not in result:# jesli tego elementu nie ma w tablicy
result.append(i)# dodaj element
print(result)
|
7b7557c3d9443807a59ad6c3f0915f89723d3d9c | CarlosHL/ProjectEuler | /python/P043/prob43.py | 952 | 3.59375 | 4 | # check if all the digits are unique
def check_unique(l):
if len(l) == len(set(l)):
return True
else:
return False
# get the initial list of the divisors of 17
def initial():
l1 = []
for i in range(1, 1000):
if i % 17 == 0:
temp = str(i)
if len(temp) < 3:
temp = "0" + temp
... |
62f8be6befa32cc52336276f9f44ce44188d9754 | yhancsx/algorithm-weekly | /cracking_the_coding_interview/2.5.py | 1,599 | 3.53125 | 4 | from LinkedList import LinkedList, LinkedListNode
def sum_lists(ll_a, ll_b):
ll = LinkedList()
a = ll_a.head
b = ll_b.head
o = 0
while a and b:
v = (a.value + b.value + o) % 10
ll.add(v)
o = (a.value + b.value + o) // 10
a = a.next
b = b.next
while a:... |
9028eede9822e83218af6bc8fb238f93deb58e19 | SakuraGo/leetcodepython3 | /P3/Solu5070.py | 2,871 | 3.65625 | 4 | # 5070. 与目标颜色间的最短距离 显示英文描述
#
# 给你一个数组 colors,里面有 1、2、 3 三种颜色。
#
# 我们需要在 colors 上进行一些查询操作 queries,其中每个待查项都由两个整数 i 和 c 组成。
#
# 现在请你帮忙设计一个算法,查找从索引 i 到具有目标颜色 c 的元素之间的最短距离。
#
# 如果不存在解决方案,请返回 -1。
from typing import List
## 超时!
class Solution:
def shortestDistanceColor(self, colors: List[int], queries: List[List[int]]... |
25a4013aa8b9d88275e9732ea9322b432fc5422f | tonnekarlos/aula-pec-2021 | /T2-Ex02-runcodes.py | 347 | 4.21875 | 4 | # Processamento de dados
def verifica(caractere):
# ord retorna um número inteiro representa o código Unicode desse caractere.
digito = ord(caractere)
# 65 a 90 corresponde (A a Z) e 97 a 122 corresponde a (a ate z)
return 65 <= digito <= 90 or 97 <= digito <= 122
# Entrada e saida de dados
print(veri... |
fd345f1d0fa7df2f2e8c6f9aac602140d561d0b1 | Noxy3301/AtCoder | /ABC/abc131_a.py | 83 | 3.6875 | 4 | a,b,c,d = input()
if a==b or b==c or c==d:
print("Bad")
else:
print("Good") |
fd5b78fb10621596a5fac93922c8e4c49f6ea76a | AIFFEL-SSAC-CodingMaster3/eunji | /Stack_Queue/leetcode_225_Implement_Stack_using_Queues.py | 1,280 | 4.09375 | 4 | """
leetcode 225. Implement Stack using Queues
문제링크 https://leetcode.com/problems/implement-stack-using-queues/
큐를 이용해 다음 연산을 지원하는 스택을 구현하라
- push : 요소 x를 스택에 삽입
- pop : 스택의 첫 번째 요소를 삭제
- top : 스택의 첫 번째 요소를 조회
- empty : 스택이 비어있는지 여부를 리턴
"""
"""
코드 1. collections.deque()를 통해 구현
Runtime: 32 ms
Memory Usage: 14.3 MB
"""
... |
e2a2a33a3b343057a8507aa8958042732cda516d | jiten123mishra/DATASCIENCEPRACTICE | /MACHINE_LEARNING_PRACTICE/07.RECOMMENDATION SYSTEMS/02.CONTENTBASED_FILTERING/CONTENT_BASED.py | 4,761 | 3.53125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 10 08:23:50 2019
@author: INE12363221
"""
import pandas as pd
import numpy as np
import nltk
nltk.download('punkt')
nltk.download('stopwords')
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 100... |
a6382bf9a4c67b1fcda6ca6fbd7432e44bd8ccfc | mdhuffer299/PythonCrashCourse | /UserInput/rollercoaster.py | 323 | 4.1875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 10 17:30:30 2018
@author: mhuffer
"""
height = input("How tall are you, in inches? ")
height = int(height)
if height >= 36:
print("Congratulations! You are tall enough to ride this rollercoaster!")
else:
print("Sorry, you are not tall enough to ride this ride...... |
7d8628aa2917c04ee8116f456ebf7872726c2350 | h-ssiqueira/Cryptography | /Cryptography-Python/XOR_Cipher.py | 338 | 3.875 | 4 | msg = input("Insert your message: ")
key = int(input("insert the key: ")) # key = 32 change case of letters
l = len(msg)
i = 0
while i < l:
if msg[i] > '@' and msg[i] < '[' or msg[i] > '`' and msg[i] < '{':
x = key ^ ord(msg[i])
print(chr(x), end = '')
else:
print(msg[i], end = '')
i... |
9cc1d9b7e7365063644a12ab7c0232bf54891881 | tx991020/MyLeetcode | /树/105从前序与中序遍历序列构造二叉树.py | 1,167 | 3.921875 | 4 | '''
根据一棵树的前序遍历与中序遍历构造二叉树。
注意:
你可以假设树中没有重复的元素。
例如,给出
前序遍历 preorder = [3,9,20,15,7]
中序遍历 inorder = [9,3,15,20,7]
返回如下的二叉树:
3
/ \
9 20
/ \
15 7
'''
'''
一句话,看到树🌲就要想到递归
preorder 是 根 -> 左 -> 右
inorder 是 左 -> 根 -> 右
首先pre的第一个就是整个树的root, 假设 preorder[0] = inorder[k],那么inorder的前k-1个就是树的左子树,后面部分就是树的右子... |
6a81f33ee3edb17f368e7c9cf490c88602982dfd | JeongHanJun/BOJ | /Python 3 PS Code/BOJ/5565.py | 99 | 3.609375 | 4 | # 5565 영수증
price = int(input())
for _ in range(9):
price -= int(input())
print(price) |
1af63b2443248990be7d810dbcaa3d6a0c5c4242 | GabrielByte/first_program | /First_Program.py | 633 | 4.15625 | 4 | '''
This program works like a register
'''
# Variable
name = input ("Enter your name: ").title()
age = int(input ("Enter your age: "))
# It will check if you are youger than 18
# or older than 18
# and it also prints if you entered a wrong data
if age < 18:
print ("You are too yourg to keep going!")
elif age... |
1740287dc392cfc7d5b56a115d92e5a51d3031ee | ChengCuotuo/learnpython | /test_9_13/test_6.py | 354 | 3.734375 | 4 | #!user/bin/python
#-*-coding:utf-8-*-
'''
编写人:王春雷
时间:2019.9.13
功能:map中的split(),数值交换
'''
x=input('Input two number:')
a,b=map(int, x.split())#第一个参数,表示将划分出来的内容按照指定的数据类型进行转换
if a > b :
a, b = b, a#序列解包,交换两个变量的值
print(a, b)
|
631e2f439976f3599020949dd5d5cece4520efd0 | FWidm/poe-profile | /src/util/regex.py | 215 | 3.515625 | 4 | import re
def strip_translation_prefix(string):
regex = r"^.*>([A-Za-z ]*)"
subst = r"\1"
result = re.sub(regex, subst, string, 0)
if result:
return result
else:
return string
|
308b93b838de86ae97fd3a2a576520b383cab61e | RPG-NJU/DA-PathFitting | /DrawPicture.py | 612 | 3.65625 | 4 | import matplotlib.pyplot as plt
# plt.scatter([1, 2, 3], [2, 3, 4], alpha=0.6) # 绘制散点图,透明度为0.6(这样颜色浅一点,比较好看)
# plt.show()
def GetScatterPlot(x: list, y: list, annotate_point_num = 0):
"""通过整个方法返回散点图"""
plt.axis('equal') # 保证XY轴的单位长度是一致的
plt.scatter(x, y, alpha=0.6, s=0.4)
plt.title("Raw Data")
... |
5b1dc888d1d7b48c6144395cd1c9de706ba7b9b5 | 8BitJustin/practice_python | /10_list_overlap_comprehensions.py | 1,487 | 4.1875 | 4 | """
This week’s exercise is going to be revisiting an old exercise (see Exercise 5), except require the
solution in a different way.
Take two lists, say for example these two:
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
and write a program that returns a list that contai... |
57101fe6c6dbe0de7295a7a35e87a1c4d41c460a | mtwgzhang2014/Python_Samples | /decoratorExp.py | 1,885 | 3.578125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 在面向对象的设计模式中,decorator被称为装饰模式。OOP的装饰模式需要通过继承和组合来实现,
# 而Python除了能支持OOP的decorator外,直接从语法层次支持decorator。Python的decorator可以
# 用函数实现,也可以用类实现
# decorator增强函数的功能
# 下例中编写一个decorator,能在函数调用的前后打印出‘begin call’和‘end call’的日志
# 并考虑同时支持@log和@log('execute')
import functoo... |
7f065e7a4aaeed60dac81747df09827c8fee5907 | DamonReyes/Python_Classes- | /Python_Class/PRACTICE_PY/SixthChallenge/practice3.py | 518 | 3.875 | 4 | def run():
num1 = int(input('escribe un numero: '))
num2 = int(input('escribe otro numero: '))
suma = num1 + num2
print(f'******{suma}******')
preg = input('quieres anadir otro numero?: ')
while preg == 'si':
num3 = int(input('escribe otro numero: '))
suma = suma ... |
c033d5d6100dac45e72531a3f84f9dccd92b1333 | boddugopikrishna/LearningOne | /venv/All functions/pairwise_product.py | 195 | 4.03125 | 4 | numbers = [7,5,14,2,8,8,10,1,2,3]
max_number = []
for val in numbers:
ind = numbers.index(val)
for number in numbers[ind+1:]:
max_number.append(val* number)
print(max(max_number)) |
e3a33cf0557cf37d396e903a1e8652dbbb9d04f0 | calanquee/Grokking-Algorithms-Code | /mergesort.py | 731 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 归并
def merge(left, right):
result = []
i = 0
j = 0
while((i<len(left))and(j<len(right))):
if(left[i]<=right[j]):
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result ... |
338accbef7176cb9cefd304bf0264db26ab596ea | SergeAA/algoritms | /lesson02/task3.py | 201 | 3.90625 | 4 | num = ''
while not num.isnumeric():
num = input('Введите натуральное число: ').strip()
rev = ''
for i in num:
rev = i + rev
print(f'обратное число {rev}')
|
67ebee55fad2b2b47f40e70339d39217b8180762 | Python3pkg/Highton | /highton/classes/tools.py | 737 | 3.671875 | 4 | import re
import datetime
def to_datetime(datetime_string):
match = re.match(
'^(.*)-(.*)-(.*)( |T)(.*):(.*):(.*)(\+|Z).*$', datetime_string)
if match:
return datetime.datetime(
year=int(match.group(1)),
month=int(match.group(2)),
day=int(match.group(3)),
... |
17e15f1214d934a514576b505635f37e200103d1 | ayeyem/HRT19D-detection | /Python/learnmatplotlib.py | 436 | 3.71875 | 4 | import matplotlib.pyplot as plt
def mpl_squares(numbers):
squares=[value**2 for value in numbers]
plt.plot(squares)
plt.show()
def mpl_squares_modify(numbers):
squares=[value**2 for value in numbers]
plt.title("Squares",size=24)
plt.xlabel("Values",size=14)
plt.ylabel("Squares of Values",s... |
12b50658f9209d03d75ab1705479f4706e309fc9 | hyunkyeng/TIL | /algorithm/day5/연습3_brute.py | 837 | 3.5625 | 4 | # find 구현
# 1. 고지식한 패턴 검색 알고리즘
p = "is" #찾을 패턴
t = "This is a book" #전체 텍스트
M = len(p) #찾을 패턴의 길이
N = len(t) #전체 텍스트의 길이
def BruteForce(p, t):
i = 0 #t의 인덱스
j = 0 #p의 인덱스
while i < N and j < M:
if t[i] != p[j]:
i = i - j
j = -1
i = i + 1
j = j + 1... |
9f538c730f1e6adcd525691140251858697c4edf | xizhang77/LeetCode | /Math/319-bulb-switcher.py | 1,423 | 3.984375 | 4 | # -*- coding: utf-8 -*-
'''
There are n bulbs that are initially off. You first turn on all the bulbs.
Then, you turn off every second bulb. On the third round, you toggle every third bulb
(turning on if it's off or turning off if it's on). For the i-th round, you toggle every i bulb.
For the n-th round, you only t... |
76717c0a1bc591ef9a0a0f3bf618b8fd5539e4d2 | AkankshaVarshney01/PyTuts | /Hacker_QuestionNo7.py | 287 | 3.53125 | 4 | You are given a set A and other sets n.
Your job is to find whether set A is a strict superset of each of the N sets.
Print True, if A is a strict superset of each of the sets N. Otherwise, print False.
A strict superset has at least one element that does not exist in its subset. |
4ec30bb37a66a80bca1706b3b371535f79b030a0 | TakuroKato/AOJ | /volume0_0010.py | 1,273 | 3.890625 | 4 | # -*- coding:utf-8 -*-
#Write a program which prints the central coordinate (px,py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1,y1), (x2,y2) and (x3,y3) on the plane surface.
import sys
import math
def solve(x1,y1,x2,y2,x3,y3):
z1 = -1 * (x1**2 + y1**2)
z2... |
2038f9262a11f533646ecaaf5f6bd71875dc2229 | islamuzkg/LPTHW | /ex21_FunctionsCanReturnSomething/ex21_1.py | 216 | 3.8125 | 4 | def divide(a, b):
print "DIVIDING %d / %d" % (a, b)
return a / b
sumary = 3
sumary += divide(45, 5)
print "and our summary is %d" % sumary
dada = divide(56, 8)
#print "Guess what is", dada, "gona be"
|
4008d72dcb9560b6de1722a0fb42c8ff77c9f414 | yurygnutov/hexlet | /solutions/sort_by_binary.py | 1,402 | 3.6875 | 4 | __author__ = 'yury'
# Sort an array of integers by the number of 1's in its binary representation (in ascending order).
# If two integers have the same number of 1's in their binary representation,
# their relative order should be the same as in the original array.
# Example:
# [1,2,4,3] == solution([1,2,3,4])
# [0,... |
74cbf255a94076420dc0084b24f57f8dd1bd67c5 | tanaypatil/code-blooded-ninjas | /graphs1/coding_ninjas.py | 4,804 | 3.78125 | 4 | """
Coding Ninjas
Send Feedback
Given a NxM matrix containing Uppercase English Alphabets only. Your task is to tell if there is a path in the given matrix which makes the sentence “CODINGNINJA” .
There is a path from any cell to all its neighbouring cells. A neighbour may share an edge or a corner.
"""
def coding(i, x... |
28a6c5805ea248f6ec87b43fc05cc12f521b9e61 | BuzzingTaz/IC-Project-S21 | /P1/huffman.py | 1,698 | 3.8125 | 4 | from TreeNode import TreeNode
# Recursive function to find Huffman code given a tree
def generate(Node, enc_string = ''):
if type(Node)==str:
return{Node: enc_string}
(left, right) = Node.children()
enc_dict = {}
enc_dict.update(generate(left, enc_string + '0'))
enc_dict.update(genera... |
86c539700c3b76ce8135916f33bbe89ecd931f81 | slavyana-monkova/Cinema-Reservation-System | /commands2.py | 2,097 | 3.84375 | 4 | import sqlite3
from matrix import Matrix
db = sqlite3.connect("database.db")
cursor = db.cursor()
class Commands:
def __init__(self):
self.__show_movies = """
SELECT name,rating
FROM movies
ORDER BY rating
"""
self.__only_id = """
SELECT id, date, time,type
... |
f717bd98a968db5bb2b32138bd2342adf0dd1f79 | Nr90/daily_coding_problem | /p07/solution.py | 1,095 | 3.96875 | 4 | """
This problem was asked by Facebook.
Given the mapping a = 1, b = 2, ... z = 26, and an encoded message,
count the number of ways it can be decoded.
For example, the message '111' would give 3,
since it could be decoded as 'aaa', 'ka', and 'ak'.
You can assume that the messages are decodable.
For example, '001' i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.