blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 3.06M | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 3.06M |
|---|---|---|---|---|---|---|
739deb3781688b27093a7e5236e93f31ea9d3abf | AnthonyDem/LeverX_tasks | /task1/LoadData.py | 297 | 3.53125 | 4 | import json
from abc import ABC, abstractmethod
class LoadDATA(ABC):
@abstractmethod
def load(self, filename):
pass
class LoadJSON(LoadDATA):
def load(self, filename):
with open(filename, 'r') as f:
json_data = json.load(f)
return json_data
|
3dbd30a5dab549c4130c9b46d17118f268028f0c | nickszap/mpas-tools | /python/memUtils.py | 772 | 3.796875 | 4 | #If we're working with big data, we may not be able to load all we want into memory.
#So, we need to be able to find how much space we have available
import os
import numpy as np
szFloat = 8 #size of a float in bytes (assume 64 bit)
def findRAM():
#return the RAM in bytes
txt = os.popen("free -m -b").readlines()... |
08e48ae76c18320e948ec941e0be4b598720feeb | nkarasovd/Python-projects | /Data Structures and Algorithms Specialization/Algorithms on Strings/week2/4_suffix_array/suffix_array.py | 632 | 4.1875 | 4 | # python3
import sys
def build_suffix_array(text):
"""
Build suffix array of the string text and
return a list result of the same length as the text
such that the value result[i] is the index (0-based)
in text where the i-th lexicographically smallest
suffix of text starts.
"""
... |
5011e91ffec203710c6c2dc1bc9e584bb13f21a8 | nkarasovd/Python-projects | /Data Structures and Algorithms Specialization/Algorithmic Toolbox/week2_algorithmic_warmup/5_fibonacci_number_again/fibonacci_huge.py | 613 | 3.859375 | 4 | # Uses python3
import sys
def get_fibonacci_huge_naive(n, m):
if n <= 1:
return n
previous = 0
current = 1
for _ in range(n - 1):
previous, current = current, previous + current
return current % m
def get_fibonacci_huge(n, m):
el_mod_m, i = [0, 1], 2
while not (el_mod_... |
fbbdd51ebf6d427735647f2906bc3ef7bf02eab7 | nkarasovd/Python-projects | /Data Structures and Algorithms Specialization/Data Structures/week2_priority_queues_and_disjoint_sets/2_job_queue/job_queue.py | 1,188 | 3.78125 | 4 | # python3
from collections import namedtuple
from queue import PriorityQueue
AssignedJob = namedtuple("AssignedJob", ["started_at", "worker"])
def assign_jobs_naive(n_workers, jobs):
# TODO: replace this code with a faster algorithm.
result = []
next_free_time = [0] * n_workers
for job in jobs:
... |
8ceb37c3de59ed9336a6e01e910269342fcee0cd | nkarasovd/Python-projects | /Data Structures and Algorithms Specialization/Algorithmic Toolbox/week4_divide_and_conquer/5_organizing_a_lottery/points_and_segments.py | 2,498 | 3.65625 | 4 | # Uses python3
import sys
import random
def less_than_or_equal(num1, num2, let1, let2):
return less_than(num1, num2, let1, let2) or \
equal(num1, num2, let1, let2)
def less_than(num1, num2, let1, let2):
return num1 < num2 or \
(num1 == num2 and let1 < let2)
def equal(num1, num2, let1... |
5ca0f7f38f1189c633f417608870822049c318cb | somsubhra999/nlpc2_ngrams | /ngram_toolkit.py | 3,033 | 3.578125 | 4 | import nltk
from nltk.corpus import stopwords
from nltk.util import ngrams
from nltk.probability import FreqDist
from string import punctuation
class Ngram:
def __init__(self, text):
"""
Initialize
:param text: The string based on which the Ngram instance is created
"""
self... |
9a4dd9d5ad2ee654593e653c0b48bfb237a8fdb8 | EvilPuddingLemon/LearingFluentPython | /S5/s5_3.py | 862 | 3.84375 | 4 | # 使用 lambda 表达式反转拼写,然后依此给单词列表排序
fruits = ['strawberry', 'fig', 'apple', 'cherry', 'raspberry', 'banana']
print(sorted(fruits, key=lambda word: word[::-1]))
# 判断对象能否调用
print(abs, str, 13)
print([callable(obj) for obj in (abs, str, 13)])
# 调用 BingoCage 实例,从打乱的列表中取出一个元素
import random
class BingoCage:
def __init__(... |
32d37ea6fb3788732a021ec60820420bb0d88a16 | EvilPuddingLemon/LearingFluentPython | /S2/s2_4.py | 897 | 3.734375 | 4 | l = [10, 20, 30, 40, 50, 60]
print(l[:2]) # 在下标2的地方分割
print(l[2:])
s = 'bicycle'
print(s[::3])
print(s[::-1])
print(s[::-2])
invoice = """
0.....6................................40........52...55........
1909 Pimoroni PiBrella $17.50 3 $52.50
1489 6mm Tactile Switch x20 $... |
5f15d80f5c1fc3231babdf72ac33808b64382f9d | EvilPuddingLemon/LearingFluentPython | /S14/s14_2.py | 461 | 3.96875 | 4 | s = 'ABC'
for char in s:
print(char)
it = iter(s)
while True:
try:
print(next(it))
except StopIteration:
del it # 释放对it的引用,废弃迭代器对象
break
from PythonTest.S14.s14_1 import Sentence
s3 = Sentence('Pig and Pepper')
it = iter(s3)
print(it)
print(next(it))
print(next(it))
print(next(it... |
eecf88de6663ff92751e5d351d896226172db8dc | EvilPuddingLemon/LearingFluentPython | /S8/s8_7.py | 459 | 4.03125 | 4 | import copy
t1 = (1, 2, 3)
t2 = tuple(t1)
print(t2 is t1) # t1 和 t2 绑定到同一个对象。
t3 = t1[:]
print(t3 is t1)
t4 = (1, 2, 3)
t5 = copy.deepcopy(t1)
print(t4 is t1)
# 在控制台上建立两个一样的元祖则会输出false,而执行这个则会输出True,可能是优化了不会新建副本
print(t5 is t1)
# 而使用深复制的无论是控制台和执行都没有新建副本,都是输出True
s1 = 'ABC'
s2 = 'ABC'
print(s1 is s2) |
69be93a66ceb167f035c82ff7464debde8b5623b | mvoin21/even | /hm13.py | 422 | 3.75 | 4 | number_list = input()
number_list = b.split(',')
d = []
for item in c:
if int(item) % 2 == 0:
d.append(item)
print(d)
#simple
c = [int(item) for item in d if int(item) % 2 == 0]
for item in d:
print(d)
#simple2
number_list = input()
number_list = number_list.split(',')
def number_is_even(number):
... |
78c35b9cff585e68786287f0260a61021f42614d | FilippoRanza/simpla | /utils/extract_regex.py | 982 | 3.671875 | 4 | #! /usr/bin/python
import re
match_regex = re.compile(r"match\s+\{")
else_regex = re.compile(r"\}\s+else\s+\{")
name_regex = re.compile(r"""(r"([^"]+)")""")
word = re.compile(r"[a-z]+")
stat = False
output = ""
with open('src/simpla.lalrpop') as file:
for line in file.readlines():
if match_regex.match... |
f9f3e4c6fa9efe25bbe23a3ccdfbf92080670da6 | BriskyGates/Study-Plan | /大神的资料库/4. 排序算法 - Sorting/2. 选择排序 - Selection Sort/2_select_sort_desc.py | 971 | 3.90625 | 4 | def selection_sort(L):
'''选择排序,降序'''
n = len(L)
if n <= 1:
return
for i in range(n-1): # 共需要n-1次选择操作
max_index = i # 首先假设 "未排序列表"(上图中非绿色框) 的最大元素是它的第1个元素,第1次选择操作则假设L[0]是最大的,第2次操作则假设L[1]是最大的
for j in range(i+1, n): # 找出 "未排序列表" 中真正的最大元素的下标
if L[j] > L[max_index]:
... |
9b4d606eef01315c9eb090f0ac4ca713411b7883 | BriskyGates/Study-Plan | /basic training/handle pdf page/handle_continue_page.py | 929 | 3.59375 | 4 | # 专门用来处理分页
from utils.single_link import SingleLinkedList
data = [ 4, 5, 6]
data=[2, 4, 5, 8]
# b = [[2, 2], [4, 5], [8, 8]]
# data = [1, 4, 5, 6, 8]
# c = [[1, 1], [4, 6], [8, 8]]
final_result = []
index = 0
while index < len(data):
sing = None
if index == len(data) - 1:
final_result.append(SingleLi... |
cef0062535c22608607714f231b4bb185bf5fa9f | BriskyGates/Study-Plan | /菜鸡的日常训练/数据结构/并查集.py | 2,381 | 3.515625 | 4 | class UniorFind:
def __init__(self):
"""记录每个节点的父节点"""
self.father = [] # 大列表中套着小字典,键为子节点,值为父节点
# 添加新节点到并查集,他的父节点为空
def add(self, x):
if x not in self.father:
self.father[x] = None
def merge(self, x, y):
"""
如果发现两个节点是连通的,那么就要合并它们<祖先是相同的>,究竟把谁当做父节点是不在... |
a9221172e4fa7c4eaed8d584e599f69bb6229b7b | BriskyGates/Study-Plan | /大神的资料库/2. 数据结构 - Data Structures/4. 树 - Tree/2. 二叉树 - Binary Tree/1_binary_tree.py | 6,696 | 3.796875 | 4 | class Node:
def __init__(self, data):
self.data = data # 节点的数据域
self.lchild = None # 节点的左孩子
self.rchild = None # 节点的右孩子
def __repr__(self):
return 'Node({!r})'.format(self.data)
class BinaryTree:
def __init__(self, root=None):
self.root = root
def add(self,... |
5cde3fa9958b34cfc915cf3d735e77b263102abf | mesikkera/DailyCoding | /Codility Lesson/BinaryGap.py | 2,246 | 3.90625 | 4 | """
BinaryGap
Find longest sequence of zeros in binary representation of an integer.
A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded
by ones at both ends in the binary representation of N.
For example, number 9 has binary representation 1001... |
711a67aac7b71d08042b2270c1ed22617f045591 | hvpeteet/Movement-Through-The-Void | /Movement Through The Void/Code/A New Start/CorrectGravity11-15-12.py | 4,115 | 3.640625 | 4 | from __future__ import division
from visual import*
from math import*
from visual.graph import *
## MKS units
##Solar Mass in Kilograms
SolarMass = 1.9891 * (10 ** 30)
EarthMass = 5.97219 * (10 ** 24)
SunEarthDist = 149597870700
G = 6.673 * (10 ** -11)
##List of all bodies entered, automatically appended
SystemOfB... |
efc9ede3541d2df46533414e7f00d9343f22bab0 | hvpeteet/Movement-Through-The-Void | /Movement Through The Void/Code/A New Start/BodiesClassSafeSave11.10.12.py | 1,618 | 3.90625 | 4 | from visual import*
from math import*
SystemOfBodies = []
class Body(object):
def __init__(self, velocity = vector(0,0,0), mass = 0, position = vector(0,0,0), identity = "unknown"):
self.velocity = velocity
self.mass = mass
self.position = position
self.identity = identity
... |
3df884385b800ccf0a32ce18e5fdbaee7b4c9bf9 | hvpeteet/Movement-Through-The-Void | /Movement Through The Void/Code/A New Start/BodiesClassSafe11.12.12 | 3,326 | 3.875 | 4 | from visual import*
from math import*
SystemOfBodies = []
class Body(object):
def __init__(self, velocity = vector(0,0,0), mass = 0, position = vector(0,0,0), identity = "unknown"):
self.velocity = velocity
self.mass = mass
self.position = position
self.identity = identity
... |
67a127a5d4b5a8d87349bcfce91aacc3586bb845 | littleocub/python_practice | /bj_tmp_matplotlib/beijing_2016.py | 1,722 | 3.609375 | 4 | # beijing_2016
import csv
import matplotlib.dates
from datetime import datetime
from matplotlib import pyplot as plt
def date_to_list(data_index):
""" save date to a list """
results = []
for row in data:
results.append(datetime.strptime(row[data_index], '%Y-%m-%d'))
return results
def data_t... |
4d916dc9ff4fc56ec946f70a30d64cefc1a8dfda | tpatel84/LeetCode-Python | /valid_parentheses.py | 1,386 | 3.75 | 4 | class Solution:
def isValid(self, s: str) -> bool:
# main idea:
# A Last-In-First-Out (LIFO) data structure
# such as 'stack' is the perfect fit
if len(s)==0:
return True
valid_char = ['(', ')', '{', '}', '[', ']']
... |
4700a7171b24baaff2510ed26a9848168434eff4 | tpatel84/LeetCode-Python | /validate_binary_search_tree.py | 990 | 4.09375 | 4 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# define a method to test if it is a BST
def BST_valid(root, min_value, max_value):
# not a TreeNode
if... |
55da659894602b33b52575e848d2c360f9b58a90 | tpatel84/LeetCode-Python | /merge_two_sorted_lists.py | 1,422 | 4.03125 | 4 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
# the edge case(s):
if l1 == None:... |
47b588ea32578dc637c67284d8be7cb15b466a83 | tpatel84/LeetCode-Python | /evaluate_reverse_polish_notation.py | 1,556 | 3.65625 | 4 | class Solution:
def evalRPN(self, tokens: List[str]) -> int:
# main idea:
# The Reverse Polish Notation (RPN) is also known as
# the 'postfix' notation, because each operator appears after its operands.
# Stack fits perfectly as it is a Last-In-First-Out (LIFO) data st... |
306d2fbf187ed9dadc85d4b0c4cb28e2165225df | robertsj/ME701_examples | /gui/feval_1.py | 1,314 | 3.953125 | 4 | import sys
import numpy as np
from PyQt5.QtWidgets import QApplication, QLabel, QLineEdit, QVBoxLayout
class Form(QLabel) :
def __init__(self, parent=None) :
super(Form, self).__init__(parent)
# Define three text boxes, one each for f(x), the value x, and
# the output. I've done the fir... |
7131a0c430d7abb53d9486e1f81398e5c9f4b475 | ljcopsey/dicegame | /dicegame_algo.py | 4,973 | 3.625 | 4 | import itertools
from dice_game import DiceGame
game = DiceGame()
import numpy as np
from abc import ABC, abstractmethod
class DiceGameAgent(ABC):
def __init__(self, game):
self.game = game
@abstractmethod
def play(self, state):
pass
class AlwaysHoldAgent(DiceGameAgent):
def pla... |
458f9df863f6be3238eb0429c06861f02407c942 | madamczak/ZamenaKurs | /dzien4requests/zadaniarequests_daniel.py | 4,240 | 3.59375 | 4 | #napisz funkcję która jako argument przyjmie stringa url, sprawdzi czy string rozpoczyna się od http:// lub https://
#następnie wykona request typu get, sprawdzi czy kod odpowiedzi zaczyna się na 2(OK) lub 3(Przekierowanie)
#i dalej już tylko utworzy obiekt BeautifulSoup, jako argumenty do budowy obiektu podasz tekst s... |
17fcaffaf0ef060efc8efdd572e9c98802867ee9 | dsabljak/Infmre | /prim_dijkstra.py | 3,959 | 3.859375 | 4 | class FileReader:
def __init__(self, path):
self.file = open(path, 'r')
self.nodes = set()
self.edges = []
self.edge_cost = dict()
self.parse()
"""
Data is written in .txt file like:
begin_node, end_node, cost, direction;
This method parses all ... |
3724701e57901b5e393f06e95345e8ea9cd777fc | rfrusina/CS115-FreshmanYR | /hw8.py | 1,343 | 3.625 | 4 | '''
Created on Mar 27, 2017
@author: Robert Frusina
I pledge my honor I have abided by the Stevens Honor System
'''
def binaryToNum(s):
'''returns string back to n'''
if s == '':
return 0
elif int(s[0]) == 1:
return binaryToNum(s[1:]) + 2 ** len(s[:-1])
return binaryToNum(s[1:]) + 0... |
4653e0632b19a0cae5be690df926119884413692 | rfrusina/CS115-FreshmanYR | /life.py | 2,794 | 3.640625 | 4 | #
# life.py - Game of Life lab
#
# Name:Robert Frusina
# Pledge:I pledge my honor that I have abided by the Stevens Honor System
#
import random
import sys
def createOneRow(width):
"""Returns one row of zeros of width "width"...
You should use this in your
createBoard(width, height) function."""
... |
42d46f187e8086acd5c56b1f8151f9697189757d | MarkEra02/Python-Task1 | /Test.py | 167 | 3.921875 | 4 | from itertools import permutations
print('Enter letters: ')
arr = input().split()
print('Result: ')
for letter in permutations(arr, ):
print(letter)
|
ad61a3ff4da961d60f8caa62d2ea9a9f14bf6a57 | hawaicai/pp4e | /Preview/cgitest.py | 763 | 3.625 | 4 | # 主html模板
fieldnames = ('name', 'age', 'job', 'pay')
replyhtml = """
<html>
<title>People Input Form</title>
<body>
<form method=POST action="cgi-bin/peoplecgi.py">
<table>
<tr><th>Key <td><input type=text name=key value="%(key)s">
$ROWS$
</table>
<P>
<input type=submit value="Fetch", name=actio... |
ba8c76e2bb0930b9f97565504c2780d51da08b34 | alexyvassili/devman-async | /lesson-2/physics/collisions.py | 2,290 | 3.984375 | 4 | """
Collisions module. Manage objects collisions.
"""
from typing import Dict, Coroutine, Optional
from objects.animations import Fire, SpaceShip
from objects.space_garbage import Garbage
def _is_point_inside(corner_row: int, corner_column: int,
size_rows: int, size_columns: int,
... |
6f8a2d22c6fb18271baa0d6444ec18a73998ccb8 | Moloch540394/machine-learning-hw | /learning-curve/featureNormalization.py | 420 | 3.515625 | 4 | """Normalize the training set data for multiple."""
__author__="Jesse Lord"
__date__="January 8, 2015"
import numpy as np
def featureNormalization(X):
X_norm = X
shape = X.shape
mu = np.empty(shape[1])
sigma = np.empty(shape[1])
for ii in range(shape[1]):
mu[ii]=np.mean(X[:,ii])
s... |
de7f2d2afcb130e6d5484bdbad0795fbf54bdf2f | Moloch540394/machine-learning-hw | /linear-regression/driver.py | 1,398 | 4.3125 | 4 | """Computes the linear regression on a homework provided data set."""
__author__="Jesse Lord"
__date__="January 8, 2015"
import numpy as np
import matplotlib.pyplot as plot
from computeCost import computeCost
from gradientDescent import gradientDescent
from featureNormalization import featureNormalization
import read... |
2d331bc3cd3b5d2410a7ec4b39b1ecf0da2aac7b | Moloch540394/machine-learning-hw | /learning-curve/plotData.py | 2,498 | 3.8125 | 4 | """Plots the scatter plot of the logistic regression training set."""
__author__="Jesse Lord"
__date__="January 8, 2015"
import matplotlib.pyplot as p
import numpy as np
from polyFeatures import polyFeatures
def plotPoints(x,y):
p.scatter(x,y,marker='x')
p.show()
def plotTheta(X,y,theta):
p.scatter(X,y,... |
4d8bf0b3222966abd08a62857b964c0b20ba0e61 | Moloch540394/machine-learning-hw | /linear-regression/gradientDescent.py | 696 | 3.890625 | 4 | """Computes the gradient descent for linear regression with multiple features."""
__author__="Jesse Lord"
__date__="January 8, 2015"
import numpy as np
from computeCost import computeCost
import matplotlib.pyplot as p
# turn on to compute cost function for each iteration as a debug
plotJ = 0
def gradientDescent(X,y... |
550820b826cc481f592b46a4c374fe38b0eb1b8b | benkhattab/MachineLearning | /009BoxPlot.py | 620 | 3.546875 | 4 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv('datasets/customer-churn-model/Customer Churn Model.txt')
plt.boxplot(data['Day Calls'])
plt.ylabel('Numero de llamadas diarias')
plt.title('Boxplot de las llamadas diarias')
print(data['Day Calls'].describe())
# Rango intercua... |
f391bade850d17f22c8cc6305b8e181390682ec9 | benkhattab/MachineLearning | /025LinearRegressionTest.py | 3,197 | 3.59375 | 4 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# y = a + b*x (linear regression model)
# x : 100 normal distributed values N(1.5, 2.5) Media => 1.5 desviacion tipica => 2.5
# ye = 5 + 1.9*x + e
# e will be normally distributed N(0, 0.8) Media => 0 desviacion tipica => 0.8
# np... |
1248d4aa0f0fcdb613782972fba43d20df509d96 | elvispy/PiensaPython | /1operaciones.py | 2,279 | 4.125 | 4 | ''' Existen varios tipos de operaciones en Python.
El primero, y mas comun es el de la adicion.
'''
x, y, z = 3, 9, '4'
a = 'String'
b = [1, 2, 'lol']
'''
La siguiente linea de codigo imprimira el resultado de sumar x con yield
'''
print(x+y)
'''
Debemos recordar que es imposible en la gran mayoria de los casos... |
dc4da6b8c326529f76f9233c4b10311b8c9ecd76 | RanjankumarModi/RanjankumarModi-Turtle_Race | /turtle-race.py | 1,506 | 3.5 | 4 |
# coding: utf-8
# In[1]:
from turtle import *
from random import *
speed(50)
penup()
bgcolor("#94B3C6")
#penup()
goto(-150,100)
for i in range(15):
write(i)
right(90)
forward(10)
pendown()
forward(10)
penup()
forward(40)
pendown()
forward(10)
penup()
forward(40)
pendo... |
4bb654640c6edc193f0e7abe1c20f4d359d1fb33 | jaeha13/TIL | /210709_python06/연습문제1.py | 154 | 3.8125 | 4 | height = int(input("height : "))
count_star = 0
for i in range(1, height + 1):
count_star += i
print("*" * i)
print("star 개수 : ", count_star)
|
a7fd52dcc52ebccf101687c588163ea852a638c1 | jaeha13/TIL | /210630_python02/conditionLab2.py | 1,060 | 3.640625 | 4 | """
실습 2
1. color_name 이라는 변수에 사용자로부터 칼라 이름을 하나 입력받는다.
2. 입력받은 칼라명이 red 이면 '#ff0000'이라는 문자열을 출력한다.
입력받은 칼라명이 red 가 아니면 '#000000'이라는 문자열을 출력한다.
1) input 함수를 통해 문자열을 압력받아 color_name 에 저장
2) if 조건문을 통해 color_name == red 인 경우 print 함수를 통해 '#ff0000' 출력
color_name != red 인 경우(else 인 경우) print 함수를 통해 '#00... |
e6c17dc992859aa066bbb31bbdcb092cba2123fd | jaeha13/TIL | /210713_python08/listLab8.py | 350 | 3.640625 | 4 | lst = [
['B', 'C', 'A', 'A'],
['C', 'C', 'B', 'B'],
['D', 'A', 'A', 'D']
]
data = {0: 'A', 1: 'B', 2: 'C', 3: 'D'}
count_lst = []
for _, d in data.items():
count = 0
for row in lst:
count += row.count(d)
count_lst.append(count)
for i, d in data.items():
print(d, "는 ", count_lst[i]... |
254800377b27bcf30d98825ac1ee6c15569ab183 | jaeha13/TIL | /210719_python11/classLab1.py | 640 | 3.953125 | 4 | class Member:
def __init__(self):
self.name = None
self.account = None
self.passwd = None
self.birthyear = None
mem1 = Member()
mem2 = Member()
mem3 = Member()
mem1.name = "피치"
mem1.account = 1313
mem1.passwd = "3131"
mem1.birthyear = 1990
mem2.name = "릴리"
mem2.account = 1414
mem... |
959bc56d6bf472999b93cd10dcdf16c07405187d | jaeha13/TIL | /210714_python09/funcLab12.py | 3,197 | 3.5625 | 4 | # version 3
# '구분자'.join(리스트) 함수를 이용 + map() 함수 이용해 Error 해결!!
def myprint(*args, **kwargs):
if len(args) == 0 and len(kwargs) == 0:
print("Hello Python")
else:
kwargs_dict = {"deco": "**", "sep": ","} # default 값 생성
kwargs_dict.update({k: v for k, v in kwargs.items()}) # kwargs 로부터... |
b923c92371e62b576bb23e2c72d615fd1952fd0b | abhishek-kumaryadav/CSL443_LabAssignment1 | /prg1.py | 666 | 3.8125 | 4 | import sys
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def find_divisors(arr):
if len(arr) == 0:
return
else:
gccd = arr[0]
for i in range(1, len(arr) - 1):
gccd = gcd(gccd, arr[i])
divisors = set()
i = 1
while i * i <= ... |
f83faaceaf3db8ffcd1fc02bfae30051a852ce53 | lreedm1/practice | /main.py | 1,077 | 3.59375 | 4 | # credit to source - https://dev.to/insidiousthedev/make-a-simple-text-editor-using-python-31bd
from tkinter import *
from tkinter.filedialog import *
from tkinter.messagebox import *
from tkinter.messagebox import *
from tkinter.font import Font
from tkinter.scrolledtext import *
import file_menu
import edit_menu
'''... |
e1562e9c8b9026001f3a1adcc645f78737ebb9aa | saintEvol/rigger_singleton | /rigger_singleton/singleton.py | 2,028 | 3.578125 | 4 | """
通过覆盖类的__new__和__init__方法提供单例支持
"""
# class Singleton:
# """
# 单例装饰器
# """
# __slots__ = (
# "__instance",
# "__is_instance_initialized",
# "__old_new_func",
# "__old_init_func",
# # "__cls__"
# )
#
# def __init__(self):
# self.__instance = No... |
68a28b6a23cb2aa70a6616060c9aced9b0ab0178 | kajusK/Advent-of-Code-2017 | /01.py | 312 | 3.515625 | 4 | #!/usr/bin/python3
import fileinput
import re
for line in fileinput.input():
sum = 0
line = re.sub(r'\s', '', line)
for i in range(0, len(line)-1):
if (line[i] == line[i+1]):
sum += int(line[i])
if line[0] == line[len(line)-1]:
sum += int(line[0])
print(sum)
|
cb9fdfe34faa657f6ca4964ec6c633c76a70749f | KamranMostafavi/PythonGraphs | /09_graph_decomposition_starter_files_2/toposort/toposort.py | 1,538 | 3.890625 | 4 | #Uses python3
'''
author: Kamran Mostafavi
given n courses and m directed edges between them representing pre-requisites
create a linearly ordered list of courses (topological order)
it is given that the graph of the courses is a DAG.
input:
n m
edge 1
.
.
ed... |
e61894b1151754ca26648f6d352a5f95f349d167 | MaxKKuznetsov/FaceID_app | /Utility/timer.py | 2,552 | 3.59375 | 4 | import time
from datetime import datetime
from Utility.MainWinObserver import MainWinObserver
from Utility.MainWinMeta import MainWinMeta
def elapsed(func):
def wrapper():
start = datetime.now()
func()
end = datetime.now()
elapsed = (end - start).total_seconds() * 1000000
p... |
f9e304feb4824241876ba1aa59667540bcdf30b2 | somersaultjump/blackjack | /cards.py | 2,062 | 3.921875 | 4 | """Cards module defines classes specifically for the card game Blackjack."""
import random
suits = (
'Hearts', 'Diamonds', 'Spades', 'Clubs'
)
ranks = (
'Two','Three','Four','Five','Six','Seven',
'Eight','Nine','Ten','Jack','Queen','King',
'Ace'
)
values = {
'Two':2,'Three':3,'Four':4,'F... |
197ba92c966f62034b35c657c601e82e557b1fd3 | devChuk/Graphics_Engine | /parts/line/draw.py | 1,882 | 4.09375 | 4 | from display import *
from matrix import *
#Go through matrix 2 entries at a time and call
#draw_line on each pair of ponts
def draw_lines( matrix, screen, color ):
[draw_line(screen, a[0], a[1], b[0], b[1], color) for (a,b) in zip(matrix, matrix[1:]) if matrix.index(a) % 2==0]
#Add the edge (x0, y0, z0) - (x1, y1,... |
87a2e702cf4651d33cd6668723a85b6618cdb636 | mahesh-mn-9040/Median-of-Two-Sorted-Arrays-Leetcode-Solution-in-Python | /med.py | 377 | 3.734375 | 4 |
nums1=list(map(int,input().split()))
nums2=list(map(int,input().split()))
mer=nums1+nums2
mer.sort()
x=len(mer)
if x==1:
return mer[0]
elif x%2==0: #if the merged list's length is even
return ((mer[x//2]+mer[x//2 -1])/2)
else:#i... |
a50cd98331ee471f9d9e1bcbc5bd53762387841f | LukasKodym/py-tests | /aritmetical_operations.py | 126 | 3.671875 | 4 | # %%
##
a = 3
a *= 2
print(a)
# %%
##
a = 7
b = a // 2
print(b)
b = a % 2
print(b)
# %%
##
a /= 2.3
print(a)
print(type(a))
|
e208c5221a02c7cb44cc739806cb1f7808c4c118 | LukasKodym/py-tests | /fibonacci.py | 376 | 3.984375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 22:18:29 2020
@author: lukas
"""
def fib(num: int):
a, b = 0, 1
for i in range(num):
a, b = b, a + b
return a
n = int(input('Który wyraz ciągu Fibonacciego policzyć?'
'\nPodaj numer wyrazu: '))
val = fib(n)
... |
d0817a90d2741583ac4688a605ee87acf26580fe | LukasKodym/py-tests | /set.py | 143 | 3.53125 | 4 | a = set([1, 2, 3, 4])
b = set([1, 3, 7, 9])
print(a.intersection(b))
print(a.union(b))
print(a.difference(b))
print(a.symmetric_difference(b))
|
483aa02841460aa6cb0e0442754f65376cd0daa3 | LukasKodym/py-tests | /spyder/14_instrukcje_warunkowe.py | 3,022 | 4.15625 | 4 | # -*- coding: utf-8 -*-
# %%
##
version = 3.7
print(version)
# %%
##
version > 3
version <= 3
# %%
##
number = 1200
number > 1000
number == 1200
number == 1000
number != 1200
number != 1000
# %%
##
# if [warunek]:
# [instrukcja]
# %%
##
if 8 > 10:
print('Tak')
# %%
##
a = 8
if a > 10:
print('a > 10'... |
b18b578b481a52ccc277879f66a372990f9212f6 | parsoli83/covid-19 | /predict_future_situation.py | 2,637 | 3.53125 | 4 | import matplotlib.pyplot as plt
from random import *
def score_finder(l_symp):
"""
this is how i measure the health_index:
fever: abs(your fever-37)*100 eg >>> 39.5==250
tiredness: a number between 0 and 10 *10
cough: a number between 0 and 10 *10
difficulty in breathing: a number between 0 and ... |
036fce6a5697aa7753e482d08a55424b748818c3 | ZoolooS/python_crash_course | /09/09.10/restaurant.py | 704 | 3.71875 | 4 | '''
'''
# ====== imports block ================================== #
# ====== class declaration =========================== #
class Restaurant():
'''
'''
def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
self.... |
bb1e8f7a9c91ae286693eea6a6b4e8f9609d3a37 | ZoolooS/python_crash_course | /09/09.13/dice_roll.py | 532 | 3.75 | 4 | '''
'''
# ====== imports block ================================== #
from die import Die
# ====== class declaration ============================== #
# ====== main code ====================================== #
# my_die = Die()
# [print(f'Roll the die -> {my_die.roll_die()}') for i in range(10)]
# my_die = Die(10)
# [... |
f0960c0968d27b632b39b748602188917c82ade8 | ZoolooS/python_crash_course | /10/10.06/exceptions.py | 533 | 3.96875 | 4 | '''
'''
# ====== imports block ================================== #
# ====== function declaration =========================== #
def sum_with_check():
try:
n, m = int(input('Enter first number: ')), int(input('Enter second number: '))
except ValueError:
print('Well, you definetly insert not nu... |
ee5dd01970036ea690570ade3080bf52f80a00f7 | ZoolooS/python_crash_course | /09/09.05/users.py | 1,687 | 3.703125 | 4 | '''
'''
class User():
'''
'''
def __init__(self, first_name, last_name, login, password, phone, about):
self.first_name = first_name
self.last_name = last_name
self.login = login
self.password = password
self.phone = phone
self.about = about
self.lo... |
e109b7148a49536bdc0d6f2d6fae3751d1a0c3cc | tmoraru/python-tasks | /less3.py | 498 | 4 | 4 | mytask = "Assign a list to variables temperatures. The list should contain three items, a float, an integer, and a string."
print(mytask)
temperatures = [7.5, 9, "today"]
print(temperatures)
mytask1 = "Assign a list to variables rainfall. The list should contain four items, a float, an integer, a string, and ... |
1a3bd1022273e086eeeb742ebace201d1aceceae | tmoraru/python-tasks | /less9.py | 434 | 4.1875 | 4 |
#Print out the slice ['b', 'c', 'd'] of the letters list.
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print(letters[1:4])
#Print out the slice ['a', 'b', 'c'] of the letters list
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print(letters[0:3])
#Print out the slice ['e', 'f', 'g'] of the letters lis... |
b114e24ad11323aa0236e71fc955f2569315ff31 | liginv/LP3THW | /exercise41-50/ex42.py | 1,370 | 4.09375 | 4 | # Animals is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
# Dog has-a object called Animal
class Dog(Animal):
def __init__(self, name):
# Dog has-a name
self.name = name
# Cat has-a object called Animal
class Cat(Animal):
def __init__(self, name):... |
d4076402594b83189895f19cdc4730f9bd5e9072 | liginv/LP3THW | /exercise11-20/ex15.py | 547 | 4.15625 | 4 | # Importing the function/module argv from sys library in python
from sys import argv
# Assigning the varable script & filename to argv function
script, filename = argv
# Saving the open function result to a variable txt.
# Open function is the file .txt file.
txt = open(filename)
# Printing the file name.
print(f"Here'... |
031e3daaf6c03e8ffda9c02138e29e1fe6f606a5 | liweicai990/learnpython | /Code/Basic/Basic09_a.py | 1,381 | 4.0625 | 4 | '''
功能:100以内的素数和
重点:自定义函数的使用、逻辑常量True和False、列表生成式
作者:薛景
最后修改于:2019/05/27
'''
# 函数就是把一段代码包含起来,然后起个名字,方便后面的程序反复使用的编程机制
def isPrime(n): # isPrime是函数名,后面的n是函数的形式参数
for i in range(2,n):
if n%i == 0:
return False
else:
return True
# 函数的使用必须遵循先定义后使用的原则,所以函数的定义必须写在主程序前面
# 方案一,使用循环语句,逐个... |
b5d8646c90f3b6c325df4ed31614600b02107c08 | liweicai990/learnpython | /Code/Turtle/Turtle02.py | 1,567 | 3.78125 | 4 | '''
功能:绘制同心圆
重点:随机数的概念、颜色的表示方法、range函数的用法、循环结构程序设计
作者:薛景
最后修改于:2019/05/27
'''
import turtle
from random import random
# 从random函数库中导入random函数,该函数可以一个生成[0,1)区间上的随机数
t = turtle.Turtle()
t.shape("turtle")
'''
为了防止后画的圆遮挡先画的圆,所以同心圆必须从大往小画,因此循环变量i的值,必须从
大往小递减。观察本程序中的range函数,可以发现第一个参数表示起始值,第二个参数表示
终止值(不被包含在产生的序列中),第三个表示递增量(... |
8aaab09f3b60c92e1b2ffa700e991086cdaf24d2 | liweicai990/learnpython | /Code/Leetcode/top-interview-questions-easy/String33.py | 1,141 | 4.21875 | 4 | '''
功能:整数反转
来源:https://leetcode-cn.com/explore/featured/card/top-interview-questions-easy/5/strings/33/
重点:整数逆序算法
作者:薛景
最后修改于:2019/07/19
'''
# 本题需要分成正数和负数两种情况讨论,所以我们用sign存下该数的符号,然后对其求绝
# 对值,再统一进行正整数的逆序算法,以化简问题难度
# 该方案战胜 88.27 % 的 python3 提交记录
class Solution:
def reverse(self, x: int) -> int:
sign = 1 if x>... |
a9825462671b83cbc3526074d5f226e64f822421 | liweicai990/learnpython | /Code/Turtle/Turtle03_a.py | 1,236 | 3.625 | 4 | '''
功能:绘制好多五角星
重点:自定义函数的用法、参数的作用
作者:薛景
最后修改于:2019/05/30
'''
import turtle, math, random
t = turtle.Turtle()
t.shape("turtle")
def drawStar(x, y, r, color, heading):
t.up() # 因为海龟移动过程中会留下痕迹,所以移动之前先提笔up,移动完毕再落笔down
t.goto(x, y)
t.down()
t.color(color)
t.setheading(heading)
edge=r*math.sin(ma... |
e930214ab684ad820e9a19ecfc72b78609489ed8 | matt-barron/csci127-assignments | /exam_01/compression.py | 666 | 3.984375 | 4 | def compress_word(w):
"""
W is a parameter representing a word that is a string. This
function should remove the letters " A, E, I, O, U" from a word.
"""
newword = " "
vowels= ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]
for i in range(len(w)):
if w[i] not in vowels :
... |
845bea1a5bf32e076fa0136937bdf7d210dd377b | matt-barron/csci127-assignments | /hw_04/list.py | 1,588 | 4.0625 | 4 | import random
def build_random_list(size,max_value):
"""
Parameters:
size : the number of elements in the lsit
max_value : the max random value to put in the list
"""
l = [] # start with an empty list
# make a loop that counts up to size
i = 0
while i < size:
l.append(r... |
7106600daa9540e96be998446e8e199ffd56ec28 | rhino9686/DataStructures | /mergesort.py | 2,524 | 4.25 | 4 |
def mergesort(arr):
start = 0
end = len(arr) - 1
mergesort_inner(arr, start, end)
return arr
def mergesort_inner(arr, start, end):
## base case
if (start >= end):
return
middle = (start + end)//2
# all recursively on two halves
mergesort_inner(arr, middle + 1, end)
... |
8b54f8006c98b5e88b7dd655e8338bb4fe3ba02c | CyberSamurai/Test-Project-List | /count_words.py | 574 | 4.4375 | 4 | """
-=Mega Project List=-
5. Count Words in a String - Counts the number of individual words in a string.
For added complexity read these strings in from a text file and generate a
summary.
"""
import os.path
def count_words(string):
words = string.split()
return len(words)
def main(file):
filename = os... |
f5f862e7bc7179f1e9831fe65d20d4513106e764 | AhmedMohamedEid/Python_For_Everybody | /Data_Stracture/ex_10.02/ex_10.02.py | 1,079 | 4.125 | 4 | # 10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon.
# From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008... |
157e068c703abe7111b4056c2f66f1954295b465 | michael-creator/passlocker | /user_test.py | 916 | 3.515625 | 4 | import unittest
from user import User
class TestUser(unittest.TestCase):
"""
Test class that defines test cases for the user class behaviours.
Args:
unittest.TestCase:TestCase that help in creating test cases
"""
def setUp(self):
"""
set up method to run before each test... |
14fd0afadadb85ccffb9e5cb447fa155874479ea | thienkyo/pycoding | /quick_tut/basic_oop.py | 657 | 4.46875 | 4 | class Animal(object):
"""
This is the animal class, an abstract one.
"""
def __init__(self, name):
self.name = name
def talk(self):
print(self.name)
a = Animal('What is sound of Animal?')
a.talk() # What is sound of Animal?
class Cat(Animal):
def talk(self):
print(... |
9998ed498be655134489021bdbf26f1545003344 | mrgomides/VemPython | /desafios/exe032.py | 668 | 3.703125 | 4 | # Projeto: VemPython/exe032
# Autor: rafael
# Data: 15/03/18 - 15:13
# Objetivo: TODO Faça um programa que leia um ano qualquer e mostre se é BISSEXTO
from datetime import date
print("ANO BISSEXTO?")
ano = int(input('Informe o ano. Ou coloque 0: '))
if ano == 0:
ano = date.today().year
if ano % 4 == 0 and ano ... |
bd0d03232a43888152bf81a7c7c2f61f8caae1a8 | mrgomides/VemPython | /desafios/exe005.py | 282 | 3.875 | 4 | # Projeto: VemPython/exe005
# Autor: rafael
# Data: 13/03/18 - 16:49
# Objetivo: TODO Faça um programa que leia um numero Inteiro e mostre na tela o seu sucessor e seu antecessor
n1 = int(input('Informe um numero: '))
print('O Sucessor: {} \nO Antecessor: {}'.format(n1+1, n1-1))
|
35e57d91f500b329a988628b25fa779c7bd0e7d8 | mrgomides/VemPython | /desafios/exe025.py | 291 | 3.78125 | 4 | # Projeto: VemPython/exe025
# Autor: rafael
# Data: 14/03/18 - 16:54
# Objetivo: TODO Crie um programa que leia o nome de uma pessoa e diga se ela tem "SILVA" no nome
nome = str(input('Informe um Nome: '))
print('É verdadeiro que tem Silva no seu nome? {}'.format('silva' in nome.lower())) |
ac1be3a81e9f6303f98fc6ef8082334bc330566c | mrgomides/VemPython | /desafios/exe038.py | 579 | 3.78125 | 4 | # Projeto: VemPython/exe038
# Autor: rafael
# Data: 16/03/18 - 10:43
# Objetivo: TODO Escreva um programa que leia dois numeros inteiros e compare-os. Mostrando na tela
# uma mensagem:
# - O primeiro valor é maior
# - O segundo valor é maior
# - Não existe valor maior os dois são iguais
vl1 = int(input('Informe um núm... |
cf452bedeaf4ec273dbde9c9e42495f46784d70a | mrgomides/VemPython | /desafios/exe053.py | 375 | 3.78125 | 4 | # Projeto: VemPython/exe053
# Autor: rafael
# Data: 16/03/18 - 17:29
# Objetivo: TODO Crie um programa que leia uma frase qualquer e diga se ela é um palindramo, desconsiderando os espaços
frase = str(input('Informe a frase: '))
fraseTest = frase.strip().replace(" ", "").upper()
if fraseTest == fraseTest[::-1]:
... |
55ba2059f6e142bac530ba83e5664b0a18e742f7 | mrgomides/VemPython | /desafios/exe020.py | 515 | 3.765625 | 4 | # Projeto: VemPython/exe020
# Autor: rafael
# Data: 14/03/18 - 11:37
# Objetivo: TODO O mesmo professor do desafio anterior quer a ordem de apresentação de trabalhos dos
# quatro alunos. Faça um programa que leia o nome dos quatro alunos e mostre a ordem sorteada
from random import shuffle
alunos = []
for cont in ran... |
c1a1b557554355308cc2df2ac26c2d9375e6fb05 | mrgomides/VemPython | /desafios/exe031.py | 586 | 3.953125 | 4 | # Projeto: VemPython/exe031
# Autor: rafael
# Data: 15/03/18 - 15:02
# Objetivo: TODO Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem.
# Cobrando R$ 0,50 por Km para viagens de até 200Km e R$ 0,45 para viagens mais longas
print('BUSÃO DA LOUCURA\n')
km = float(input('I... |
ea81459cf57703d3a7e17a2532fbe7a7a52e719d | wilsonwagn/FlappyBirdMinaj | /Flappy Bird Minaj (Python)/ots/itens.py | 628 | 3.640625 | 4 | import pygame
"""
Variavéis padrões:
x x y = Altura x Largura.
w x h = Altura x Largura
"""
class itens:
def __init__(self, win, x, y, w, h, img, r):
self.x = x
self.y = y
self.w = w
self.h = h
self.r = r #Rotação
self.visivel = True
self.img = img #Imagem
... |
da3e793f2542785087ef540e776f97035b408f62 | seru1us/hackernoon-projects | /Mean, Var, and Std.py | 5,047 | 4.5 | 4 | import numpy
#my_array = numpy.array([ [1, 2], [3, 4] ])
# print("MEANS!")
# print(numpy.mean(my_array, axis = 0)) #Output : [ 2. 3.]
# print(numpy.mean(my_array, axis = 1)) #Output : [ 1.5 3.5]
# # print(numpy.mean(my_array, axis = 2)) # When I add this to the sample code, I get a tuple index out... |
c6155ca957544e00f08f66f4dc3e8e4b2744c20f | ArronYR/Machine-Learning-Code | /learning_demo_02.py | 536 | 3.625 | 4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from numpy.linalg import inv
from numpy import dot
from numpy import mat
# y = 2x
X = mat([1, 2, 3]).reshape(3, 1)
Y = 2 * X
# 最小二乘法
# theta = (X'X)^-1X'Y
theta = dot(dot(inv(dot(X.T, X)), X.T), Y)
# 梯度下降法
# theta = theta - alpha*(theta*X-Y)*X
theta = 1.
... |
df3c5db72ccb697322f83a56606456580b549ed5 | anoopyadav/DataScienceFromScratch | /LinearAlgebra/statistics.py | 2,813 | 4.03125 | 4 | from collections import Counter
from random import randint
from matplotlib import pyplot as plt
from LinearAlgebra.vectors import sum_of_squares, dot
from math import sqrt
num_friends = [randint(1, 101) for x in range(200)]
friend_counts = Counter(num_friends)
""" Plot the friend-count vs number of people
"""
x_axis ... |
e7106abd83be9b0bde7758fb4b6494f331abfb9d | aiologybay/TransferLearning | /transferLearning.py | 1,081 | 3.65625 | 4 | import torch
import torchvision
import matplotlib.pyplot as plt
import numpy as np
import torch.nn as nn
x=torch.randn(10,1)
y=2*x+3
class Net(nn.Module):
def __init__(self):
super(Net,self).__init__()
self.linear1=nn.Linear(1,3)
self.linear2=nn.Linear(3,1)
def forward(self,x):
... |
45196a57b8eac8fa13d01ea7a7697cf1b03fba4a | bonbonnie/ToOffer | /8字符串转整数.py | 708 | 3.84375 | 4 | '''
将一个字符串转换成一个整数,要求不能使用字符串转换整数的库函数。 数值为0或者字符串不是一个合法的数值则返回0
'''
class Solutions(object):
def StrToInt(self, s):
if s == '':
return 0
res = 0
pos = 1
for i in s:
if i == '+' or i == '-':
if s.index(i) == 0:
pos = -1 if i == '... |
00f9d933e019f7f6038823082e21308b4844e664 | bonbonnie/ToOffer | /9平衡二叉树.py | 881 | 3.71875 | 4 | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def Treeheight(self, pRoot):
if pRoot == None:
return 0
if pRoot.left == None and pRoot.right == None:
return 1
lh = se... |
a75f5b32953b00d9366aa170454cb932cf4e7d8b | bonbonnie/ToOffer | /7变态跳台阶.py | 297 | 3.875 | 4 | class Solutions(object):
def oddJumpFloor(self, n):
if n == 1 or n == 2:
return n
res = psum = 3
for i in range(n - 2):
res = psum + 1
psum += res
return res
if __name__ == "__main__":
print(Solutions().oddJumpFloor(5)) |
641771afc19c1e9b9932fac893c74ca4d3541276 | emil904/CodeAcademyPython | /sumOfDigits.py | 91 | 3.546875 | 4 | def digit_sum(n, s=0):
l = str(n)
for x in l:
s += int(x)
return s
|
d2a163f00abb3166aee84001cc5784aa55fee5e6 | arunkumaarr/myfirstproject | /guessgame.py | 408 | 3.96875 | 4 | from random import randint
num = randint(1, 10)
print("Hey i am thinking of a number bet 1 to 10 can you guess :P")
print('your are left with three chances !!!!')
i=3
while i > 0:
i -=1
user_guess1 = int(input('Enter your number Guess1'))
if user_guess1== num:
print('you guessed it right')
... |
c5138974f25a246029fa5f7af300cfc2c3ee3fe3 | arunkumaarr/myfirstproject | /animalcracker.py | 234 | 3.515625 | 4 | def animal_crackers(text):
word=text.split( )
print(word)
for i in word:
if (i[0][0] == i[1][0]):
return True
else:
return False
string = 'levalheaded llama'
animal_crackers(string) |
2aafcef675b26ab1591c22272d868ac4e9743fbd | arunkumaarr/myfirstproject | /codewar3.py | 161 | 3.890625 | 4 | def longest(s1, s2):
s1 += s2
x=set(s1)
s1=list(x)
s1.sort()
#s1.remove()
return s1
k=longest("aretheyhere", "yestheyarehere")
print(k) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.