blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
d01943bf563215e10faa3b07841f42146c482c0e | Colas89/itea_homework | /hw_1_1.py | 1,198 | 4.3125 | 4 | first_name = (input('Введите ваше имя: '))
last_name = (input('Введите вашу фамилию: '))
print('Привет!!:', first_name, last_name, sep=' ')
print('----------------------')
itea_day = int(19)
itea_month = int(11)
itea_year = int(2018)
my_day = int(input('Введите день своего рождения: '))
my_month = int(input('В... |
5d72c0a08fe5fac3e14348ba5cdaddd5ad39feb0 | Abdullah-AlSawalmeh/data-structures-and-algorithms | /Data-Structures/hashtable/challenges/tree_intersection.py | 1,426 | 4.03125 | 4 | #from data_structures_and_algorithms_python.data_structures.tree.tree import BinaryTree
# A problem with import
"""Node"""
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
"""BT"""
class BinaryTree:
def __init__(self):
self.root = Non... |
0ee47fc0d7c33701a7ace1f01238d89f0bdacff5 | Abdullah-AlSawalmeh/data-structures-and-algorithms | /Data-Structures/trees/challenges/tree_breadth_first.py | 1,016 | 3.96875 | 4 | from queue import Queue
from trees.trees import *
def breadth_first(tree):
my_tree = []
current = tree.root
my_queue = Queue()
my_queue.put(current)
while True:
dequeued = my_queue.get()
my_tree.append(dequeued.value)
if dequeued.left != None:
my_queue.put(dequeu... |
9d75558e6f138eb7b154abd1730b537028437fa6 | Abdullah-AlSawalmeh/data-structures-and-algorithms | /Data-Structures/trees/challenges/tree_fizz_buzz.py | 1,799 | 3.65625 | 4 | class k_ary_tree:
def __init__(self, data):
self.data = str(data)
self.children = []
self.parent = None
def get_level(self):
level = 0
p = self.parent
while p:
level += 1
p = p.parent
return level
def add_child(self, child):
... |
a11969e618ccc8820979273def449c7be03b243c | bhjkljklnm/Python-Gaming-Projects | /ROCK-PAPER-SCISSORS/rock_paper_scissors.py | 1,907 | 4.15625 | 4 | ### 1 -- method for this game by me using if condition
# player_name1 = input("Please enter your name, player1?.. ").capitalize()
# player_name2 = input("Please enter your name, player2?.. ").capitalize()
# print(f'Welcome to our \'rock_paper_scissors\' game. Good luck {player_name1} and {player_name2}!!')
# while... |
ff149d5c548b8c811a555fa9f90eb1f9d9c84749 | GeekChao/Coding | /Educative/coding/two_pointers/ex1.py | 633 | 3.890625 | 4 | """
Given an array of sorted numbers and a target sum, find a pair in the array whose sum is equal to the given target.
Difficulty: Easy
"""
def pair_with_targetsum(arr, target_sum):
pairStart, pairEnd = 0, len(arr) - 1
while pairStart < pairEnd:
current_sum = arr[pairStart] + arr[pairEnd]
i... |
34459e4093d56ca2ce47cbffff795ffceb913524 | GeekChao/Coding | /Educative/coding/two_pointers/ex4.py | 862 | 3.9375 | 4 | """
Given an array of unsorted numbers and a target number, find a triplet in the array whose sum is as close to the target number as possible,
return the sum of the triplet. If there are more than one such triplet, return the sum of the triplet with the smallest sum.
Difficulty: Medium
"""
import math
def triplet_... |
cc5cd1343c7451670b6edd46133c3062b7995546 | GeekChao/Coding | /Educative/coding/intervals/ex2.py | 470 | 3.5625 | 4 | """
Problem: Given an array of intervals representing ‘N’ appointments, find out if a person can attend all the appointments.
Difficulty: Medium
"""
def can_attend_all_appointments(appointments):
if len(appointments) < 2:
return True
appointments.sort(key=lambda appointment: appointment[0])
for... |
83402a0becc6fb2c4daff7f5b5f66e66fc4bf0a3 | s19015nakada/-ProgrammingTraining2 | /chapter01/08.py | 410 | 3.984375 | 4 | def cipher(target):
result = ''
for c in target:
if c.islower():
result += chr(219 - ord(c))
else:
result += c
return result
target = input('文字列を入力してください--> ')
result = cipher(target)
print('暗号化:' + result)
result2 = cipher(result)
print('復号化:' + result2)
if res... |
a61ddb514320820ba5a77f4e32e3a162379d4d1f | DimonYarkin/repolesson4 | /task7.py | 583 | 3.859375 | 4 | from itertools import count
from math import factorial
def fibo_gen():
for el in count(1):
yield factorial(el)
while True:
n = 0
StopVal = False
try:
n = int(input("Введите количесво чисел для вывода: "))
StopVal = True
except ValueError:
print("Ошибка введено не... |
c8aa52cc905d715d2c8095830cf4b86c0d09fd62 | Wilson194/Angry-tux | /angrytux/model/game_objects/obstacle_states/ObstacleState.py | 568 | 3.8125 | 4 | from abc import ABC, abstractmethod
class ObstacleState(ABC):
"""
Interface for obstacle states
"""
def __init__(self, obstacle):
self._obstacle = obstacle
@abstractmethod
def hit(self) -> None:
"""
What obstacle should do after being hit by missile
"""
... |
bbea59b17ecdbe36c75cbf9ca639010d871bfac5 | Wilson194/Angry-tux | /angrytux/model/abstract_facotry/AbstractFactory.py | 973 | 3.75 | 4 | from abc import ABC, abstractmethod
from angrytux.model.game_objects.Missile import Missile
from angrytux.model.game_objects.Position import Position
class AbstractFactory(ABC):
"""
Abstract class for factories
"""
@abstractmethod
def create_smart_enemy(self, position: Position):
"""
... |
53818450f934b6f023a25be3698c53b338a1172c | reinai/ProteinSubcellularLocalization | /Vasilije/data_preprocessing.py | 10,559 | 3.765625 | 4 | import numpy as np
import matplotlib.pyplot as plt
import skimage.filters
import scipy.ndimage
import skimage.feature
import skimage.transform
plt.gray()
DS_PATH = "../dataset/train/"
def plot_image_all_color_filters(image_filename):
"""
Plotting all four color filter images based on teh filename and plottin... |
8638035e5da14cc6cec1b2f40bee98813a5c7ab2 | thankthemaker/hackerschool | /microbit/micropython/lesson05_math_prime/main.py | 450 | 3.6875 | 4 |
from microbit import *
def prim(candidate):
if candidate < 2:
return False
if candidate == 2:
return True
if candidate % 2 == 0:
return False
x = 3
while True:
if x < candidate:
if candidate % x == 0:
return False
x = x... |
b4a6e362757e199a88469175ff5a31e626e2f795 | Omkar-Nalawade/python | /exercise5.py | 2,322 | 3.90625 | 4 | class aircraft:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
print(self.x)
print(self.y)
def move_left(self):
print("moved left")
self.x = self.x-1
def move_right(self):
print("moved right")
self.x = self.x+1
def move_up(self):
... |
2de5ecf8e09244e63a806ba7f17622a5490b5581 | SowatRafi/My-Python-Journey | /1. Basics/4. Python Data structures/Comprehensions.py | 926 | 4.3125 | 4 | """
Comprehensions in Python
Comprehensions in Python provide us with a short and concise way to construct new sequence(list, set and dictionary)
using sequences which has already been defined.
* List Comprehensions,
* Set Comprehension &
* Dictionary Comprehensions.
"""
# Defining a list
my_list = [97, 90, 85, 75... |
e01a30fa2f529b31065c7d87e0874f3d7fdaf695 | SowatRafi/My-Python-Journey | /1. Basics/6. Python Functions/zip.py | 483 | 4.15625 | 4 | # List containing name of students
student_names = ['Sheikh', 'Mohammad', 'Sowat', 'Hossain', "Rafi"]
# List containing marks of students
student_marks = [97, 90, 85, 75, 70]
# Zipping names & marks of students
zipped_list = zip(student_names, student_marks)
zipped_list = list(zipped_list)
print(zipped_list)
# Unzi... |
d475a195b7433a2aa925aa93077458fa05b19162 | SowatRafi/My-Python-Journey | /1. Basics/6. Python Functions/Global Local.py | 145 | 3.65625 | 4 | x = 10
def my():
global x # Converting the inside x to global
print(x)
x = 7
print("My favourite number is ", x)
my()
print(x) |
e1604e1febcf9b30f78c8cfaf0cc10936920e307 | SowatRafi/My-Python-Journey | /1. Basics/11. Working with CSV & PDF/pdf_encrypt.py | 1,185 | 3.75 | 4 | #!/usr/bin/env python3
from PyPDF2 import PdfFileReader, PdfFileWriter
def add_encryption(input_pdf, output_pdf, password):
pdf_reader = PdfFileReader(input_pdf)
pdf_writer = PdfFileWriter()
for page in range(pdf_reader.getNumPages()):
pdf_writer.addPage(pdf_reader.getPage(page))
pdf_writer.... |
634d40509916aea9b8062511aabcc1ac3acc8cb1 | SowatRafi/My-Python-Journey | /2. OOP/2. Abstraction/Abstraction.py | 712 | 4.28125 | 4 | """
Python does not have its own provided abstract classes.
However, Python comes with a module which provides the infrastructure that allows you to define abstract classes.
The name of the module in ABC => Abstract Based Classes
"""
from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmetho... |
7b6254107a4ef01af6546774d7b6c2707aa59843 | SowatRafi/My-Python-Journey | /1. Basics/4. Python Data structures/Set.py | 286 | 3.65625 | 4 | def printingMethod(whatever):
x = 0
for i in whatever:
x += 1
print(x, i)
love = {'Bikes', 'Mobiles', 'Laptops', 'Desktops'}
PC_Brans = set(('HP', 'Lenovo', 'Dell', 'Asus'))
printingMethod(love)
printingMethod(PC_Brans)
print(type(love))
print(type(PC_Brans)) |
22221db31fef7d2cdda655212aa278ede9139156 | g-j-chen/gina | /Google Coding Competitions/Kick Start/2019PMural.py | 904 | 3.578125 | 4 | import sys
numCases = int(input())
for i in range(numCases):
numWalls = int(input())
wallBeautyNum = input()
beautyNumList = []
for c in wallBeautyNum:
beautyNumList.append(int(c));
paintLen = (len(beautyNumList) + 1) // 2
print("painted wall length: " + str(paintLen))
maxBeautyScor... |
1805e822b010f78d79415457602fd05efa902c33 | diganthdr/python_august_bootcamp | /input_example.py | 194 | 3.953125 | 4 | #input funtion, takes input from keyboard, reads it as string.
a = input()
b = input()
print(type(a),type(b))
print(a,b)
print(a + b) #concatenaiton:w
print(int(a) + int(b)) #concatenaiton:w
|
f657ff6576b3dd6c670ba4bc16777817a74abaea | diganthdr/python_august_bootcamp | /project/inputdata/test.py | 830 | 3.6875 | 4 | import unittest
class TestInputData(unittest.TestCase):
def test_simple_add_integers(self):
money = calculator.simple_add(34000, 23000)
self.assertEqual(money, 57000)
def test_simple_add_int_negative(self):
money = calculator.simple_add(-3488, 23000)
print("My account value: "... |
714bf4b0418bf7d704b9bf35c2e5e987de106e6b | ricobl/dotfiles | /bin/myip | 847 | 3.5625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import commands
def get_ip():
"""
Get local IP address or localhost if none found.
Needs to grab a list of network interfaces via `/sbin/ifconfig`
because `socket.gethostbyname[_ex]` makes a DNS query on MacOS
which may have trouble resolvin... |
42a848ae6026d5b6a4c13449c13ff2480efdd32c | manveerpuri/Algorithms | /ciphers/vigenere_cipher.py | 2,125 | 4.21875 | 4 | alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def vigenère_cipher_encrypt(message, key):
message = message.lower()
key = key.lower()
ciphertext = ''
for i in range(len(message)):
char... |
15b6bf0b0e2cde915028af7972c31dc06fe7a021 | i13flyboy/Assigment2 | /test_placecollection.py | 1,028 | 3.640625 | 4 | """(Incomplete) Tests for PlaceCollection class."""
from place import Place
from place_collection import PlaceCollection
def run_tests():
"""Test PlaceCollection class."""
# Test empty PlaceCollection (defaults)
print("Test empty PlaceCollection:")
place_collection = PlaceCollection()
print(place... |
e855f3909dc2414dca6c9c01fcceca213e13ee06 | genocem/Exercices | /exercices/partie 1 exercice 1.py | 82 | 3.765625 | 4 | a=int(input("entrer un nembre:"))
b=int(input("entrer un nembre:"))
print(a+b)
|
e1169623aa9fdc5d3fdd1b5db432304bb0232a93 | genocem/Exercices | /exercices/partie 1 exercice 6.py | 216 | 4.03125 | 4 | x= int(input("entrer un nembre:"))
for i in range (11):
print(x,"*",i,"=",x*i)
for n in range (1,10):
print("table de multiplication de",n,":")
for l in range(10):
print(n,"*",l,"=",n*l) |
66b88d142ed25f5e8e3d9abed31d757812aeb05a | wlharvey4/Code-Challenges-Intl | /challenges/fizzbuzz/python/fizzbuzz.py | 536 | 3.6875 | 4 | # fizzbuzz/python/python.py
# ====================================================
# CREATED: 2018-05-29
# UPDATED: 2018-06-05
# VERSION: 0.2.0
# AUTHOR: wlharvey4
# ABOUT: Fizzbuzz code challenge in Python3
# NOTES:
# ----------------------------------------------------
# nn := {'n': INT}
def fizzbuzz(nn):
FIZZ = "... |
7ea70fbefcf8e74b4f470b1cca98bdc86a74a610 | 1131057908/yuke | /7-25/晚自习作业.py | 643 | 3.828125 | 4 | """
座右铭:吃饱不饿,努力学习
@project:预科
@author:Mr.Huang
@file:晚自习作业.PY
@ide:PyCharm
@time:2018-07-25 19:34:20
"""
# 1.利用map()和reduce()函数,实现类似于int()的功能。比如:'123'-123
# 2.利用map()实现类似于字符串的lower()函数的功能。比如将AbCdEF全部转换成小写
# from functools import reduce
# result1=map(int,['12312'])
# print(result1)
# for x in result1:
# print(x,type(... |
9d63e040191f4d7d91f38e80a84bdc58cf243dee | 1131057908/yuke | /7.10/教务系统.py | 4,424 | 3.890625 | 4 | #Author:zhang
#声明一个用于保存学员信息的列表
member_list=[]
while True:
print('''欢迎使用Python-13期学生信息管理系统
1-添加学员姓名
2-修改学员姓名
3-查询学员姓名
4-删除学员姓名
0-退出
''')
select_number=int(input('请选择您要操作的序号:'))
#因为用户可能不按照序号输入,所以要进行循环检测
while select_number<0 or select_number>4:
select_number=int(input('序号输入... |
b1b79d9eea685ec29883436b95f2e11c8ccb283b | 1131057908/yuke | /7.11/最佳体重.py | 281 | 3.8125 | 4 | while True:
height=int(input('请输入身高'))
weight=int(input('请输入体重'))
best_weight=height-105
if weight>best_weight:
print('偏胖')
if weight<best_weight:
print('偏瘦')
if weight==best_weight:
print('体重正常')
|
1123d459a824c66e96dc358deb597a24b3bff238 | 1131057908/yuke | /7.18/上课/练习.py | 1,800 | 3.84375 | 4 | #声明一个空字典
dict1={}
#声明一个非空字典
dict2={'adc':'12','spupoter':'34',}
#第二种方法
dict2=dict(name='张三',age='20')
#添加元素
dict2['height']='175'
print(dict2)
#查询元素:提供键
res=dict2['name']
print(res)
#get()根据键取出对应值,如果字典中有这个键,则直接取出,不存在这个键,
#则会输出 该键对应的值
res2=dict2.get('weight','66')
print(res2)
res3=dict2.get('name','黄')
print(res3)
#it... |
25c2157635e752c33a548ef0da50fdcc1e1beb03 | 1131057908/yuke | /7.12/列表 字典 集合.py | 1,957 | 4.03125 | 4 | # 列表:list
# 元组:tuple
# 字符串:str
# 集合:set
# # --------------------列表转换元组,字符串,集合'-------
# 列表转换成元组
list1=['a','b','c','d']
tup=tuple(list1)
print(type(tup))
print(tup)
# 列表转换成字符串
string=''.join(list1)
print(type(string))
print(string)
# 列表转换成集合, sep='' 去除空格
set1=set(list1)
print(type(string),string,sep='')
# --... |
410b89901dfa3610068201e31f42099e8dc9af2c | 1131057908/yuke | /7.18/上课/每日一练.py | 1,099 | 3.734375 | 4 | list1=[1,2,3,4,5,6]
for num in list1:
print(num)
while list1.count(num)>1:
res=list1.remove(num)
print(res)
# list1.sort()+0
# list2=set(list1)
#----------关系测算----------------
my_set_5={1,2,3,4,5}
my_set_6={4,5,6,7,8}
#1.intersection:求两个集合之间的交集
res=my_set_5.intersection(my_set_6)
print(res)
#2.union:求两个集合之间... |
3435cb3805d88c2587e37ad93ea43388d7e292ce | 1131057908/yuke | /7.14/学生管理系统.py | 3,473 | 3.9375 | 4 | #声明一个用于保存学员信息的列表
member_list=[]
while True:
print('''
1-添加学员
2-修改学员姓名
3-查询学生姓名
4-删除学员姓名
0-退出
''')
select_number=int(input('请输入操作序号:'))
while select_number<0 or select_number>4:
select_number=int(input('输入错误请再次输入:'))
if select_number==1:
name=input('请输入姓名:')
... |
2568d39f5a376b484dace0a9b0a1b8abdc33bd1c | 1131057908/yuke | /7-20/列表生成式.py | 660 | 4.0625 | 4 | """
座右铭:吃饱不饿,努力学习
@project:预科
@author:Mr.Huang
@file:列表生成式.PY
@ide:PyCharm
@time:2018-07-20 15:41:42
"""
#列表生成式;快速 生成列表的一种方式
my_list=[]
for x in range (1,11):
res=x**2
my_list.append(res)
print(my_list)
Fast_list=[x**2 for x in range (1,11)]
print(Fast_list)
#加入if判断
Fast_list_1=[x**x for x in range (1,11) if... |
8b541042210ac37619abfb45c11ad4fc4b181fd7 | 1131057908/yuke | /7-25/7-26/main.py | 1,430 | 3.578125 | 4 | """
座右铭:将来的你一定会感激现在拼命的自己
@project:7-25
@author:Mr.Zhang
@file:main.PY
@ide:PyCharm
@time:2018-07-25 16:40:30
"""
#import本质:相当于先把my_module这个模块中的所有代码先解释执行一遍,然后赋值给my_module这个变量。最后通过这个变量调用my_module里面的name,say_hello()
import my_module
my_module.say_hello()
# print(my_module.name)
# my_module.say_hello()
#from...import....本... |
16ae19d69b437f1a68c035b4225927840c33bf34 | 1131057908/yuke | /7.10/字符串的拼接.py | 2,555 | 3.75 | 4 | # 拼接字符串:就是将不同字符串或变量拼接成一个完整的字符串内容
#
# 第一种:使用占位符拼接字符串
# %d:整数类型的占位符 % -'数字' d 增大间隔
age=20
score=100
result="小明的年龄是%d,成绩是%d"%(age,score)
print(result)
# 拼接字符串的时候,如果之拼接一个变量,那么%后面不需要添加().
# 拼接两个或两个以上的变量需要加()
height=180
result1='小刚的身高是%d'%height
print(result1)
# %f : 小数类型的占位符,用于拼接小数类型的变量
# 默认情况下取小数点后六位
# .数字f 就是取小数点后几位
wei... |
0f71f73490302423f08b6bf6b20f919b48a61e76 | Fitzclutchington/BaruchViz | /Enrollment_status.py | 6,638 | 3.546875 | 4 | """
This script converts a spreadsheet containing students'
enrollment statuses into a csv file used to generate a
bar chart in iDashboards.
"""
import pandas as pd
import numpy as np
from datetime import date, datetime, timedelta
import time
import json
def edit_school_names(school):
if school == 'Z':
... |
a6017d7a699c3aff1fd59bd585011c2cb58d55c0 | piyushm27/iptoolkit | /lib_exp_acc/build/lib/IPTK/Classes/Annotator.py | 32,982 | 3.578125 | 4 | #!/usr/bin/env python
r"""The class provides methods for visualizing different aspects of the protein \
biology. This is achieved through three main methods:
1- add_segmented_track: which visualize information about \
non-overlapping protein substructures, for example, protein domains.
2-... |
89c01bf61bf6ad3ad23b5be5b78aab22755314d1 | jbm950/personal_projects | /General Python/Fightfactory/Fightfactory.py | 13,726 | 3.59375 | 4 | #-------------------------------------------------------------------------------
# Name: Fightfactory.py
# Purpose: Use nested classes next time if multiple things are going to be
# drawn on essentially the same screen
#
# Author: James
#
# Created: 20/06/2014
# Copyright: (c) James 2... |
5e5d508a9492837c46d18c00f912e305431ebced | patrickmmartin/owictrl | /utils/leapcontrol.py | 1,976 | 3.59375 | 4 | #!/usr/bin/python
"""
class to control the robot arm from the Leap Motion
with proportional control
"""
import Leap
import sys
from edgell import EdgeRaw, ACTION_BITS
class EdgeListener(Leap.Listener):
"""
listener for Leap events to control arm
"""
def __init__(self):
"""
cons... |
cf11c3fadb5ff7110adf2c7851d7d4130f14ff82 | wpfalive/learnpython | /py/test-ex41.py | 312 | 3.796875 | 4 | def convert():
results = []
snippet = ['a', 'b', 'c']
phrase = ['a1', 'b1', 'c1']
for sentence in snippet, phrase:
result = sentence[:]
results.append(result)
print "show me the result ", results
return results
question, answer = convert()
print question
print answer
|
854a2faa66e0bb335cab0678be69a4154c76c0f0 | DSAL0630/ALL | /Hints.py | 1,030 | 4.40625 | 4 | # How to turn a string into a list
myString = "arizona"
myList = list(myString)
print(myList)
# how to create a list with _ where the letters go
guesslist = []
for a in myList:
guessList.append("_")
print(guessList)
# how to replace a specific item in a list
# so say the user types r for guess you woul... |
b0df02e67d7f7cf5f4be992fbea01e1f428af654 | Swathygsb/DataStructuresandAlgorithmsInPython | /DataStructuresandAlgorithmsInPython/com/kranthi/Algorithms/challenges/addTwoBinaries.py | 672 | 3.90625 | 4 | """
Given two binary strings, return their sum (also a binary string).
Example:
Input: a = "11", b = "1"
Output: "100"
"""
def add_two_binary_nums(num1:str, num2: str) -> str:
max_len = max(len(num1), len(num2))
num1 = num1.zfill(max_len)
num2 = num2.zfill(max_len)
result = ''
carry = 0
... |
aebea8459f2c24ef6d527f79072ff520e730ff2c | Swathygsb/DataStructuresandAlgorithmsInPython | /DataStructuresandAlgorithmsInPython/com/kranthi/Algorithms/Arrays/rightArrayRotation.py | 442 | 3.640625 | 4 | """
Input: nums = [1,2,3,4,5,6,7], k = 3
Output: [5,6,7,1,2,3,4]
Explanation:
rotate 1 steps to the right: [7,1,2,3,4,5,6]
rotate 2 steps to the right: [6,7,1,2,3,4,5]
rotate 3 steps to the right: [5,6,7,1,2,3,4]
"""
def arrayRotate(arr:list, k:int):
n = len(arr)
res = [0]*n
if k > n:
k = k-n
f... |
683230e4d5b5b38acdf797a75589210fcc439852 | Swathygsb/DataStructuresandAlgorithmsInPython | /DataStructuresandAlgorithmsInPython/com/kranthi/Algorithms/challenges/easy/maxMoneyWithdraw.py | 633 | 4.125 | 4 | """
Maximum money that can be withdrawn in two steps
Last Updated : 10 May, 2019
There are two cash lockers, one has X number of coins and the other has Y number of coins, you can withdraw money at max two times, when you withdraw from a locker you will get the total money of the locker and the locker will be refilled ... |
be291d2acadef8a0f461cd01b2b6102354b02ea8 | Swathygsb/DataStructuresandAlgorithmsInPython | /DataStructuresandAlgorithmsInPython/com/kranthi/Algorithms/challenges/easy/findSoloElement.py | 468 | 3.765625 | 4 | # function to find the once
# appearing element in array
def findSingle(arr):
data = {}
for i in arr:
if i not in data:
data[i] = 1
else:
data[i] = data[i] + 1
if data.keys():
vals = [key for key, val in data.items() if val == 1]
if vals:
... |
74985ce7665f04f712e5cc25ea6a273d7b6e1c92 | Swathygsb/DataStructuresandAlgorithmsInPython | /DataStructuresandAlgorithmsInPython/com/kranthi/Algorithms/challenges/easy/fibonacci.py | 449 | 3.96875 | 4 | """
Fibonacci using O(n)
Note that if we use recurssion then it would become exponential ie O(n!)
"""
def fibonacciSumOfNo(n: str) -> str:
num1 = 0
num2 = 1
if n == 1:
return num1
if n == 2:
return num2
count = 1
c = 0
sumN = 0
while count < n:
c = num1 + num2... |
1cd6ea06a64ec9fd654e329da0e714e743373993 | KoredeDavid/budget | /budget.py | 8,136 | 4.09375 | 4 | # This ensures that the figure inputted is valid
def clean_amount(action):
invalid_amount = False
while not invalid_amount:
# This catches an error that is raised if the user inputs a str instead of an int or a float
try:
amount = int(input(f'\nHow much will you like to {action} Zuri... |
b62c6b5278fc0e271db495a394d33e5465b2cb54 | Bingohong/Data_Structure_Pyhon | /编程笔试真题/招商2018_跑步最快方法.py | 1,331 | 4.28125 | 4 | ''' 招商银行信用卡中心2018秋招编程题
* 小招喵跑步
* 小招喵喜欢在数轴上跑来跑去,假设它现在站在点n处,它只会3种走法,分别是:
* 1.数轴上向前走一步,即n=n+1
* 2.数轴上向后走一步,即n=n-1
* 3.数轴上使劲跳跃到当前点的两倍,即n=2*n
* 现在小招喵在原点,即n=0,它想去点x处,快帮小招喵算算最快的走法需要多少步?
* 输入描述:
* 小招喵想去的位置x
* 输出描述:
* 小招喵最少需要的步数
* 输入例子1:
* 3
* 输出例子1:
* 3
'''
'''解题思路:
从x倒着回到0
偶数,能跳的就跳,即n//2+1,加1是因为跳了一步
奇数,向前或前后走一步,... |
5cc4dc0520fe8d04b9fd534d35720a554d4006db | Bingohong/Data_Structure_Pyhon | /算法刷题/20171212-面试题刷题/BST转化为双向链表.py | 1,926 | 3.578125 | 4 | '''问题描述:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针的指向
'''
'''问题分析:
1)中序遍历完成转换,升序排序
2)plast指向双向链表尾部,要保持对双向链表尾部的跟踪
3)pcu节点的leftchild指向小值
4)plast节点的righchild指向大值
5)plast指向pcur,保持链表尾部跟踪
'''
#树节点结构
class treeNode(object):
def __init__(self, value=None, leftchild=None, rightchild=None):
self.value = value
self.... |
1cd960c7cfceda1e9351f73b550d8c59b296314a | Bingohong/Data_Structure_Pyhon | /算法刷题/20171212-面试题刷题/二叉树深度.py | 918 | 4.03125 | 4 | '''问题描述:求二叉树深度'''
'''问题分析:
1)后序遍历
2)如果二叉树为空,深度为0
3)如果二叉树不为空,二叉树深度 = max(左子树深度, 右子树深度) + 1
'''
class binaryTree(object):
"""docstring for binaryTree"""
def __init__(self, value, left, right):
self.value = value
self.left = left
self.right = right
def getTreeDepth(root):
if root == None:
return 0
left = get... |
2a5b09d98840556831ed165fe6b5830bc5ab954f | Bingohong/Data_Structure_Pyhon | /算法刷题/20171212-面试题刷题/判断两棵二叉树是否结构相同.py | 1,302 | 4.03125 | 4 | '''问题描述:判断两棵二叉树是否结构相同'''
'''问题分析:
1)先序遍历
2)如果二叉树都为空,True
3)如果二叉树一棵为空,另一棵非空,False
4)两棵树的左右子树同时递归
'''
class binaryTree(object):
"""docstring for binaryTree"""
def __init__(self, value, left, right):
self.value = value
self.left = left
self.right = right
def cmpStructure(root1, root2):
if root1 == None and root2... |
dd71d974e1cfa802f69b2320d4dcd71ce54fb5e5 | Bingohong/Data_Structure_Pyhon | /算法刷题/排列组合问题.py | 2,565 | 3.890625 | 4 | #---------------------------全排列/全组合问题--------------------
#全排列问题
#无重复字符串排列问题---递归方法
'''分析:
将第一个元素与后面元素依次交换,再将除第一个元素外的所有元素递归
abc -> abc ->递归bc
abc -> bac ->递归ac
abc -> cba ->递归ba
'''
def permutation(pstring,start,length):
if start == length - 1:
print(pstring)
else:
for i in range(start,length):
pstring = swap... |
951f1fa3a68584dc872b4e3f5f7325bfd40495f2 | Bingohong/Data_Structure_Pyhon | /算法刷题/20171212-面试题刷题/二叉树第K层节点个数.py | 2,542 | 3.9375 | 4 | '''问题描述:求二叉树第K层的节点个数'''
'''问题分析:递归解法
1)先序遍历
2)如果二叉树为空或者k<1,返回0
3)如果二叉树不为空并且k==1,返回1
4)如果二叉树不为空且k>1,返回左子树中k-1层的节点个数与右子树k-1层节点个数之和
计算k-1层节点个数,原因:
当二叉树递归进入下一层时,相当于当前树深度少一层;
当k=1时,遍历到达第k层;
这种计算节点的思路是想最终递归至K目标层,此时递归函数内k=1。
第k层的节点数量 = 第k层产生的递归函数数目
'''
class binaryTree(object):
"""docstring for binaryTree"""
def __init__(se... |
2c2c0aca3aeffab8f9ea457dd9cac1a06d584175 | LucasVictorCS/CatalogoHoteis | /CatHotels.py | 670 | 3.546875 | 4 | cat={
'Hotel A': {'price':300,'distanceBeach':100,'star':5},
'Hotel B': {'price':100,'distanceBeach':900,'star':3},
'HOtel C': {'price':400,'distanceBeach':100,'star':4},
'HOtel C': {'price':300,'distanceBeach':200,'star':5}
}
final=cat
for key in list(cat):
for key2 in list(cat):
a=cat[key]
b=cat[k... |
a2c351f8c192dda0a0aa59544023b05047f06fb2 | Djarahh/RushHour | /code/classes/board.py | 447 | 3.71875 | 4 | class Board(object):
""" Defines a board. """
def __init__(self):
"""Initialization of Board object."""
self.entrance = []
self.grid = 0
self.length = 0
def set_zero(self):
"""Sets all dictionary values of grid to 0"""
for y in range(self.length):
... |
68b5031f4f0afaf3a1971fad128efba1061c4f67 | Djarahh/RushHour | /code/visualization/visualize_board.py | 3,350 | 3.921875 | 4 | import tkinter as tk
class BoardVisualization:
def __init__(self, game, length):
"""
Visualizes a RushHour board with cars
board = Board object (with .entrance, .grid, .length)
cars = list (cars with .id, .length, .color, .coordinate, .direction)
counter = integer
... |
bc66fc85c8e3a82c9d1940ba38fe08223ce0366d | Grukz/py_learn | /messy/list_sort.py | 917 | 3.71875 | 4 | l = [1, 5, 3, 2, 7]
print l
print l.sort()
print l
l = [(2, 33.8, 40), (3, 43.15, 10), (4, 37.97, 16), (5, 46.81, 36),
(6, 48.77, 79), (8, 19.36, 79), (9, 6.76, 64)]
print l
l.sort(key=lambda x: x[1])
print l
l.sort(key=lambda x: x[2])
print l
l = [(2, 33.8, 40), (3, 43.15, 10), (4, 37.97, 16), (5, 46.81, 36),
... |
9f671bbdff4dafad8232d15b0f7014df5ec360bb | doggyeong/Kakao_Chatbot | /Parts/timetable.py | 1,484 | 3.53125 | 4 | import sqlite3
con=sqlite3.connect("timetable.db")
cur=con.cursor()
print("삭제시킬건가요 추가시킬건가요? (추가:1,수정:2)")
check=int(input())
print("몇반 시간표를 입력하실건가요?")
cla=int(input())
if check == 1:
if cla == 1:
n = 1
while n <= 7:
print("추가시킬 월요일 " + str(n) +"교시 과목이름을 입력하세요")... |
7cb78658749cae543c67ecb384b2845c6e83240b | pod-the-elder/pod-ticketing | /testingFiles/priorityMatrix.py | 287 | 3.8125 | 4 | # Basic Priority Calculation Formula
def priorityCalc():
priority = 0
delayCons = raw_input("What is the Consiquence of Delay? ")
failCons = raw_input("What is the Consiquence of Failure? ")
priority = int(delayCons) + int(failCons)
print(priority)
priorityCalc()
|
69a1f1253b868685830829a703a39579037082c5 | kbouch/PHYS200-2 | /Chapter-10.py | 1,076 | 3.640625 | 4 | # Ex. 10.1
def cumulative_sum(t):
new = []
for i in range(len(t)):
new.append(sum(t[:(i+1)]))
return new
numbers = [1,2,3,4,5,6,7,8,9,10]
sums = cumulative_sum(numbers)
print sums
print type(sums)
# Ex. 10.2
def chop(t):
l = len(t)
del t[0]
del t[len(t)-2]
t = ['a','b','c','d','e',... |
9499985fdbf7bd8958a6c25ad9b73d999672eb66 | kbouch/PHYS200-2 | /Chapter-16.py | 2,166 | 4.09375 | 4 | # Chapter 16 Exercises
# Ex. 16.1
class Time(object):
"""Represents a time, with attributes hours, minutes, and
seconds
"""
def print_time(t):
print '%.2d:%.2d:%.2d' % (t.hour, t.minute, t.second)
friday_night = Time()
friday_night.hour = 21
friday_night.minute = 53
friday_night.second = 3
print_ti... |
3f75676045cb71af05bba9b07719f8cbedd20e29 | AndrePina/Python-Course-Work | /octal_to_string.py | 1,886 | 4.28125 | 4 | # The permissions of a file in a Linux system are split into three sets of three permissions: read, write, and execute for the owner, group, and others. Each of the three values can be expressed as an octal number summing each permission, with 4 corresponding to read, 2 to write, and 1 to execute. Or it can be written ... |
2fc770de79803d05d6d76d9bd882c7a45f90008d | AndrePina/Python-Course-Work | /Week 2 - practice quiz Section 2 - answers.py | 184 | 3.546875 | 4 |
def order_numbers(number1, number2):
if number2 > number1:
return number1, number2
else:
return number2, number1
smaller, bigger = order_numbers(100, 99)
print(smaller, bigger) |
1dbb0a6edd1f533df3db0704d8b2d9cc2707c75d | AndrePina/Python-Course-Work | /poem.py | 260 | 3.625 | 4 | class Flower():
color = 'unknown'
rose = Flower()
rose.color = "red"
violet = Flower()
violet.color = "blue"
# this_pun_is_for_you = ___
print("Roses are {},".format(rose.color))
print("violets are {},".format(violet.color))
# print(this_pun_is_for_you) |
fa1dea0489348c35a849b9b4c313fe050760a216 | AndrePina/Python-Course-Work | /Hippopotamus.py | 207 | 3.609375 | 4 | def animal0(animal):
print(animal[3:6])
print(animal[-5])
print(animal[10:])
return
print(animal0("Hippopotamus"))
Name = ["Hippopotamus"]
colors = ["red", "white", "blue"]
colors.insert(2, "yellow")
|
0a36c97ac2084154e1fa0e8db8f8fd2459b3b7e4 | damartinezru/python-ejercicios | /ejercicios-colecciones/numerosPrimos.py | 432 | 3.84375 | 4 | # Escribir un programa que almacene en un lista los números primos comprendidos
# entre un rango definido por el usuario.
def almacenar(inicio, limite):
lista =[]
for x in range(inicio,limite):
if (x % 2 != 0):
lista.append(x)
return lista
print("Los numeros primos son :"+ str(almacena... |
1e77aa1d645a3a91c3e7d04bec821efab3bd5848 | damartinezru/python-ejercicios | /ejercicios-archivos/escritura.py | 382 | 3.78125 | 4 | # Escribir un programa que escriba la lista de caracteres ASCII dentro de un archivo de texto
def escribirArchivo():
texto = ""
for n in range(1, 254):
texto += " " + chr(n)
with open("D:/Escritorio/ejercicios-modelos2/ejercicios-20/ejercicios-archivos/file.txt", 'w', encoding="utf-8") as f:
... |
773001348776278736566731a9b963d4d191e00a | kolodach/python-algostructs | /linked-list/palindrome.py | 691 | 4.3125 | 4 | '''Palindrome
Implement a function to check if a linked list is a palindrome.
'''
from linkedlist import LinkedList
def is_palindrome(linkedlist: LinkedList) -> bool:
'''Determines whether list is a palindrome.
Args:
linkedlist: List to check
Returns:
True if the list is a palindrome and Fal... |
ee7d47d82beee3b2fb97c73e86d3082ad5b3cec3 | Lemespien/Tkinter-GUI-Idle-game | /class_recipe.py | 1,772 | 3.53125 | 4 | from class_resources import *
from class_building import *
class Recipe():
ALL_RECIPES = []
def __init__(self, unlocked_resource, required_resources):
self.unlocked_resource = unlocked_resource
self.name = unlocked_resource.name
self.required_resources = required_resources
sel... |
8d149988252340f25fc18e710c08a44506a399a3 | johnmanny/data_structure_demos | /queue_implementations/pq.py | 1,094 | 3.90625 | 4 | """
Author: John Nemeth
Sources:
Description: priority queue class file for assignment 2, problem 1
"""
from heapq import *
class priorityQueue:
def __init__(self):
self.q = []
def isEmpty(self):
return not bool(self.q)
def insert(self, x):
heappush(self.q, x)
def removeMi... |
ff8619b567dc8bfe9a96f5aaee901e3e4c10c198 | 2monsta/python_rpg_object_game | /non-class.py | 1,446 | 3.828125 | 4 | # this is a procedural apprach to a text based rpg game
# the hero is ging to fight a goblin
# the hero will have the option to:
# 1) fight the goblin
# 2) do nothing( the goblin will still attack the hero)
# 3) run away
import os
hero_health = 10;
hero_power = 10;
goblin_health = 6;
goblin_power = 2;
# run the game ... |
26c4c60856109df234e3c31dc0d422749ddfa0fb | LuannMateus/python-exercises | /python-files/class-exer/class17-listas_part_2.py | 544 | 3.59375 | 4 | '''Listas compostas;'''
pessoas = list()
dados = list()
totOver = totUnder = 0
for count in range(0, 2):
dados.append(str(input('Nomes: ')))
dados.append(str(input('Idade: ')))
pessoas.append(dados[:])
dados.clear()
for c in pessoas:
if c[1] > '21':
print(f'{c[0]} tem mais de 21 anos!')
... |
0c39bc4462d2d00d0b7fff1919ac83b904e9365c | LuannMateus/python-exercises | /python-files/third_world-exercises/8-tuplas/exer73-time.py | 843 | 3.71875 | 4 | # Colors
colors = {
'red': '\033[1;31m',
'green': '\033[1;32m',
'white': '\033[1;37m',
}
print('{}-{}='.format(colors['red'], colors['white']) * 20)
print('{:^40}'.format('CHAMPIONSHIP'))
print('{}-{}='.format(colors['red'], colors['white']) * 20)
times = ('Flamengo', 'Santos', 'Palmeiras', 'Grêmio', 'Ath... |
87bfa82502b8c98658e6176401c67625a955d835 | LuannMateus/python-exercises | /python-files/second_world-exercises/4-if_aninhado/exer38-numbers_comparer.py | 627 | 3.75 | 4 | from os import system
print('\033[1;34m-=-' * 12)
print('\033[4;31m\t<-- Numbers... -->\033[m')
print('\033[1;34m-=-' * 12)
n1 = int(input('\033[1;37mEnter with the first number: '))
n2 = int(input('Enter with the second number: '))
system('clear')
print('\033[1;34m-=-' * 15)
print('\033[4;31m\t<-- Numbers Comparing.... |
57163ccb196d855ef87534e82cdb677ba1fe8f6b | LuannMateus/python-exercises | /python-files/first_world-exercises/2-usando_modulos_do_python./2-Manipulando Textos/exer27-initial_last_name.py | 283 | 3.890625 | 4 | print('=' * 30)
print('<-- Playing with Split method -->')
print('=' * 30)
name = str(input('Enter with a name: ')).strip()
firstandlast = name.split()
print('First name: {}'.format(firstandlast[0]))
print('Last name: {}'.format(firstandlast[len(firstandlast) - 1]))
print('-' * 30)
|
646c19be04aa1d4a4d6eb731f801e1e91ea5a886 | LuannMateus/python-exercises | /python-files/first_world-exercises/1-tratando_e_fazendo_contas./exer14-graus_to_f.py | 291 | 3.96875 | 4 | print('\033[1;35m=' * 30)
print('<-- Degrees Celsius ̣to Fahrenheit -->')
print('=' * 30)
graus = float(input('Degrees Celsius: '))
conversion = graus * 9 / 5 + 32
print('=' * 20)
print('<-- Conversion -->')
print('-' * 20)
print('{}ºC to {}ºF'.format(graus, conversion))
print('=' * 20)
|
b878cf7afc41bd445a2f48cd2e3dcafdbb9df0f0 | LuannMateus/python-exercises | /python-files/second_world-exercises/7-loop_and_break/exer68B-par_or_odd.py | 1,006 | 3.828125 | 4 | from random import randint
# Colors
colors = {
'red': '\033[1;31m',
'green': '\033[1;32m',
'white': '\033[1;37m',
}
cont = 0
print('{}-{}='.format(colors['red'], colors['white']) * 20)
print('{:^40}'.format('Guess what the GAME MASTER chose'))
print('{}-{}='.format(colors['red'], colors['white']) * 20)
... |
47d67aea6269d1e11a49c357f4e676c90316ec99 | LuannMateus/python-exercises | /python-files/third_world-exercises/10-listas_part_2/exer85-listas_com_pares_impares.py | 857 | 4.625 | 5 | '''Exercício Python 085: Crie um programa onde o usuário possa digitar sete
valores numéricos e cadastre-os em uma lista única que mantenha separados os
valores pares e ímpares. No final, mostre os valores
pares e ímpares em ordem crescente.'''
from typing import List
c = {
'white': '\033[1;37m',
'red': '\033... |
3b823e00ca4baaae9683b51f09aa865d193aaf8d | LuannMateus/python-exercises | /python-files/third_world-exercises/14-modulos_e_pacotes/exer109/coin.py | 556 | 3.5625 | 4 | def half(value, fort=False):
value = value / 2
return value if fort is False else rep(value)
def double(value, fort=False):
value = value * 2
return value if fort is False else rep(value)
def increase(value, porc, fort=False):
value += (porc / 100) * value
return value if fort is False else ... |
7580e5c676de31362dc657192d4a7ed4ca3d6086 | LuannMateus/python-exercises | /python-files/first_world-exercises/1-tratando_e_fazendo_contas./exer07-media.py | 517 | 3.546875 | 4 | from os import system
print('\033[1;33m-=-' * 12)
print('\033[1;34m\t <-- Média -->')
print('\033[1;33m-=-' * 12)
nota1 = float(input('\033[1;32mDigite a primera nota: '))
nota2 = float(input('Digite a segunda nota: '))
system('clear')
print('\033[1;33m-------------------------')
print(' \033[1;34m<-- Média Final -... |
3b503d569dc86ba652d3a7aa2acded9ade1148ba | LuannMateus/python-exercises | /python-files/third_world-exercises/13-functions_part_2/exer101-voting_functions.py | 810 | 4.125 | 4 | '''Exercício Python 101: Crie um programa que tenha uma função chamada voto()
que vai receber como parâmetro o ano de nascimento de uma pessoa, retornando um
valor literal indicando se uma pessoa tem voto
NEGADO, OPCIONAL e OBRIGATÓRIO nas eleições.'''
# Title;
def title():
print('\033[1;37m~~' * 20)
print('V... |
7f33dbaf1c99a4305309677e9e3de532adaacdfa | LuannMateus/python-exercises | /python-files/second_world-exercises/4-if_aninhado/exer45-jokenpon_game.py | 2,917 | 3.5 | 4 | from random import choice
from time import sleep
from os import system
colors = {
'red': '\033[1;31m',
'green': '\033[1;32m',
'white': '\033[1;37m',
}
print('{}-{}='.format(colors['white'], colors['red']) * 25)
print('\t\t{} JOKENPÔN'.format(colors['white']))
print('{}-{}='.format(colors['white'], colors... |
2f39a7c581feb8278e6ced54b4e40c567ca1d6f2 | LuannMateus/python-exercises | /python-files/third_world-exercises/13-functions_part_2/exer106-sistema_interativo.py | 1,093 | 4.0625 | 4 | '''Exercício Python 106: Faça um mini-sistema que utilize o Interactive Help do
Python. O usuário vai digitar o comando e o manual vai aparecer. Quando o
usuário digitar a palavra 'FIM',
o programa se encerrará. Importante: use cores.'''
from time import sleep
# Cores:
c = (
'\033[m', # 0 - No color
... |
abdb1f00c1c120c72990aa33acad76c8bd1e55e0 | LuannMateus/python-exercises | /python-files/second_world-exercises/7-loop_and_break/exer71B-caixa_eletronico.py | 533 | 3.828125 | 4 | # Colors
colors = {
'red': '\033[1;31m',
'green': '\033[1;32m',
'white': '\033[1;37m',
}
print('{}-{}='.format(colors['red'], colors['white']) * 20)
print('{:^40}'.format('BANK'))
print('{}-{}='.format(colors['red'], colors['white']) * 20)
sacar = float(input('Digite o valor: '))
cedulas = [1, 10, 20, 50]... |
ac2c67548c3779db6bc6934c4f650e9ccbd455b9 | LuannMateus/python-exercises | /python-files/third_world-exercises/13-functions_part_2/exer103-ficha_do_jogador.py | 775 | 4.40625 | 4 | '''Exercício Python 103: Faça um programa que tenha uma função chamada ficha(),
que receba dois parâmetros opcionais: o nome de um jogador e quantos gols ele
marcou. O programa deverá ser capaz de mostrar a ficha do jogador, mesmo que
algum dado não tenha sido informado corretamente.'''
# Title;
def title():
prin... |
932016366afdff8da4bca4261f1c728beece1fd2 | almirderland/pp2 | /1attestation/papka/6.py | 258 | 3.828125 | 4 | count = int(input())
array = str(input()) # 2 4 3 -1 7 12 -4
list_elem = array.split()#[2, 4, 3, .....]
set_uniq = set()
for i in range(len(list_elem)):
set_uniq.add(list_elem[i])
if len(set_uniq) == len(list_elem):
print("YES")
else:
print("NO") |
cfa6579719da6d229dc989adf5965bdfe0150461 | almirderland/pp2 | /1attestation/papka/2.py | 96 | 3.515625 | 4 | import re
a = "The rain in Spain aijsnfa ias aosjf ai ai ai"
x = re.findall("Thain", a)
print(x) |
9539d812a489fda173e0afeee022003fe4d180e3 | almirderland/pp2 | /1attestation/papka2/d.py | 582 | 3.59375 | 4 | def power_of_two(word_len):
pwr = 0
while pwr <= 100:
if 2 ** pwr == word_len:
return True
pwr += 1
return False
n = int(input())
ch_s = "!@#$%^&*()_+~`'<>/?.,/:;’1234567890"
while n > 0:
v = list(map(str, input().split()))
new_v = []
for word in v:
x = ''
... |
77a88b41c7d5c84588784f0f1235ca2d826cf10b | smartTigerCode98/translator_desctop | /additional_functions/formated_line.py | 598 | 3.78125 | 4 |
class Formated(object):
@staticmethod
def formated(line, width):
len_line = len(line)
if len_line <= width:
new_line = ''
difference_in_len = width - len_line
left_indent = round(difference_in_len / 2)
right_indent = difference_in_len - left_inde... |
2b92698b35343bfb686f4cdd01bb03ba349bf0a5 | cielo-cerezo-tm/tutoring | /test_viz.py | 400 | 4.09375 | 4 | import matplotlib.pyplot as plt
import numpy as np
plt.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the axes.
plt.plot([1,2,3,4], [0,0,0,0])
a=[1,2,3,4]
b=[1,4,6,3]
plt.plot(a,b)
plt.set_xlabel('x label') # Add an x-label to the axes.
plt.set_ylabel('y label') # Add a y-label to the axes.
plt.set_title("Si... |
5ef6253279c1788d925e7a5dc59c22edb6e18b5f | Shivang-Agarwal11/python-proj | /SalaryPredictionUsingLinearRegression/SalaryPredictionBasedOnExperienceUsingLR.py | 1,070 | 3.90625 | 4 | #Salary Prediction based on number of years of experience
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# import the dataset
dataset = pd.read_csv('Salary-Data.csv')
x = dataset.iloc[:, :-1].... |
31380a8035d318fb66afcffb89eaa31c604c3f7d | ManuNeuro/PyRCN | /examples/digits-last-state.py | 15,868 | 3.78125 | 4 | #!/usr/bin/env python
# coding: utf-8
# # Recognizing hand-written digits
#
# ## Introduction
#
# This notebook adapts the existing example of applying support vector classification from scikit-learn ([https://scikit-learn.org/stable/auto_examples/classification/plot_digits_classification.html#sphx-glr-auto-examples... |
c35ace6030f04cc5b025d582c4cc6e87dfaee1ea | PrathamSaxena1401/codechef-beginner | /FLOW006.py | 141 | 3.703125 | 4 |
#sum of digits
T=int(input())
for i in range(T):
sum=0
N=int(input())
for dig in str(N):
sum=sum+int(dig)
print(sum) |
1471cbeff3f503e3218d44489b0574cd0d65dd3b | sxu2583/Jarvis-Python | /basicAudio/speech_text.py | 1,650 | 4.09375 | 4 | #!/usr/bin/env python3
# Requires PyAudio and PySpeech.
"""
Using the python pyAudio and speech libraries we
will convert speech to text via a built in learning
algorithm similar to google api.
Algorithm -> Google api -> Text
"""
"""
You need to have your sound turned on otherwise an erorr occurs via the
... |
4872d8f367d907b388c7bfdc261df40ffa0c0bd1 | ksandrmatveyev/python_training | /parseconfig/example.py | 672 | 3.671875 | 4 | import yaml
def yaml_loader(filepath):
"""Load a yaml file"""
with open(filepath, 'r') as file_descriptor:
data = yaml.load(file_descriptor)
return data
def yaml_dump(filepath, data):
"""Dumps data to yaml file"""
with open(filepath, 'w') as file_descriptor:
yaml.dump(data, file_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.