blob_id stringlengths 40 40 | repo_name stringlengths 5 119 | path stringlengths 2 424 | length_bytes int64 36 888k | score float64 3.5 5.22 | int_score int64 4 5 | text stringlengths 27 888k |
|---|---|---|---|---|---|---|
d7a610da41df1c2d0f710db3336ea59dd5cecfcd | rafaelperazzo/programacao-web | /moodledata/vpl_data/13/usersdata/75/4939/submittedfiles/flipper.py | 295 | 3.96875 | 4 | # -*- coding: utf-8 -*-
from __future__ import division
import math
#Entrada
P= input ('Digite a posição de P:')
R= input ('Digite a posição de R:')
#Processamento e Saida:
if (P==R) and (R==1):
print ('A')
if (P>R):
print ('B')
if (P<R) or ((P==R) and (R==0)):
print ('C')
|
e6a52c25ec837bdf427f25050ebef742cacae46e | NurseQ/Benchmark-of-Algorithms | /algo.py | 8,376 | 4.125 | 4 | # import packages to be used for this program
from random import randint
from statistics import mean
import time
# Selection sort algorithm, adapted from https://www.pythoncentral.io/selection-sort-implementation-guide/
def selectionSort(arr):
for i in range(len(arr)):
# Find the element with lowest value... |
56d009a51f872b2d974c4155b3ae9e55580968f6 | pla0599/adm1n | /game_v1.0.0 | 878 | 4 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019-2020 LX
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0... |
0af6b99e2a016399b79eae501b543c6ea136f4a0 | mathias-madsen/information_theory | /edit_distance.py | 4,425 | 4.125 | 4 | import numpy as np
def edit_distance_analysis(word1, word2):
"""" Obtained details on how to convert one word into the other.
Notes:
¯¯¯¯¯¯
The edit commands considered are:
- correct transmission of one letter (cost=0)
- spurious deletion from the input stream (cost=1)
- spurious ins... |
e7145ecfd701a38e0437b1c9e323d78bc324745e | Vitoria0/Activities-Python | /Cap-2/043-IMC.py | 1,036 | 3.765625 | 4 | peso = float(input('Qual é o seu peso? (Kg) '))
altura = float(input('Qual é a sua altura? (m) '))
imc = peso / (altura ** 2)
print('O IMC dessa pessoa é de {:.1f}'.format(imc))
if imc < 17:
print('Muito abaixo do peso')
print('O que pode acontecer?\nQueda de cabelo, infertilidade, ausência menstrual')
elif im... |
3204a8a5ce13fa08c44477348a803626a591a80e | ashwynh21/rnn | /declarations/account.py | 3,812 | 3.828125 | 4 | """
We define this account class because we require a defined sort of score board for our agent that will allow it to
gauge quantitatively its performance.
"""
from typing import Dict
from declarations.action import Action
from declarations.position import Position
from declarations.result import Result
from declarati... |
eb046f8fc2c260942a28676bb2649b628f19e220 | codpro880/project_euler | /python/problem__18.py | 1,781 | 3.8125 | 4 | # Just copy/pasta-ed from project euler
problem_triangle_str = """75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91... |
60b961524aa20fd75cbf040027e9828256987df0 | acarbonaro/project-euler | /euler008.py | 2,262 | 3.59375 | 4 | """
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
"""
from functools import reduce
THOUSAND_DIGITS = int("7316717653133062491922... |
cbd619e3b5abcebd66ba2f4d28338aad472ae8f2 | guilhermejcmarinho/Praticas_Python_Elson | /02-Estrutura_de_Decisao/06-Maior_de_tres.py | 438 | 4.1875 | 4 | numero01 = int(input('Informe o primeiro numero:'))
numero02 = int(input('Informe o segundo numero:'))
numero03 = int(input('Informe o terceiro numero:'))
if numero01>numero02 and numero01>numero03:
print('Primeiro numero: {} é o maior.'.format(numero01))
elif numero01<numero02 and numero02>numero03:
print('Pr... |
a0695231f854782e55a3fded51bfa06b1ec15407 | sanyam-dev/EnC0de-DeCo83 | /Binary_En_De-Code.py | 1,132 | 4.09375 | 4 | """
Author : Sanyam Jha
Code : Play around with your friends OR store your secrets with this Binary Encoder - Decoder
"""
# This Code Converts String to Binary
def str_to_bin(s):
res_str = ""
for i in range(len(s)):
bin1 = '{0:08b}'.format(ord(s[i]))
res_str = res_str + " " + bin1
return ... |
724e4a2fd695d0eaaf845dd8aa23b3e0295ad446 | AmitabhKotha/MyCaptainPython | /FileExtension.py | 487 | 4.125 | 4 | fileEx ={
"py":"python",
"cpp":"c++",
"doc":"Word",
"docx":"Word",
"rtf":"Rich Text Format",
"wpd":"WordPerfect Document",
"pdf":"Portable Document File"
"txt":"text"
}
filename = input("Input the Filename: ")
exten = filename.split(".")
#print(fileEx[exten[-1]])
if exten[-1... |
f74700bbd58a7f8c62c76bb8bf3c2d50f3d439be | jiechenyi/jyc-record- | /Algorithm/leetcode/81.搜索旋转排序数组II.py | 974 | 3.8125 | 4 | """
81.搜索旋转排序数组II
假设按照升序排序的数组在预先未知的某个点上进行了旋转。
( 例如,数组 [0,0,1,2,2,5,6] 可能变为 [2,5,6,0,0,1,2] )。
编写一个函数来判断给定的目标值是否存在于数组中。若存在返回 true,否则返回 false。
"""
def search(nums, target):
n = len(nums)
p = n
for i in range(n):
if i>0 and nums[i] < nums[i-1]:
p = i
break
def bs... |
6c684064fe9ed80bea9c4f899150a5e4791d4020 | marcelcosme/URI | /PYTHON/2449(Important)(accepted).py | 443 | 3.578125 | 4 | def soma_dois(numero1, numero2, ideal):
aumenta = ideal - numero1
numero1 += aumenta
numero2 += aumenta
return numero1, numero2, abs(aumenta)
numeros, ideal = map(int, input().split())
x = list(map(int, input().split()))
aumenta_total = 0
for i in range(numeros - 1):
if x[i] != ideal:
x[i... |
f85530c2ce7396e6e8dfd519c92553d0cc9136b9 | chrisxue815/leetcode_python | /problems/test_0005_iteration.py | 814 | 3.59375 | 4 | import unittest
import utils
# O(n^2) time. O(1) space. Palindrome.
class Solution:
def longestPalindrome(self, s: str) -> str:
n = len(s)
max_lo = 0
max_len = 0
start = 0
while start < n:
lo = start - 1
hi = start + 1
while hi < n and... |
edafb24b836622b8d84c7d1c06b5d7518f30a5f0 | asilvino/tempnotebook | /openkattis/towers.py | 2,375 | 3.5 | 4 | #! /usr/bin/python2
import sys
import math
import StringIO
# import timeit
t1 = "2^1^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2\n"
t2 = "100^10^1^10^100^100^100^100^100^100^100^100^100^100^100^100^100^100^100^100^1... |
3269098ba37f6f0c515a32fca43cfd902849c008 | archeranimesh/python3_OOPs | /SRC/Chapter_02-Objects-In-Python/point_v03.py | 1,032 | 4.1875 | 4 | import math
class Point:
"Represents a point in two-dimensinal geometric coordinates"
def __init__(self, x=0, y=0):
"""Initialize the postion of a new point. The x and y coordinate
can be specified. If they are not, the point defaults to the origin. """
self.move(x, y)
# Move met... |
59bdc67d23c081190d6d53e79bd6059b30f1c678 | druv022/ML | /main_1/polynomial_regression.py | 1,675 | 3.90625 | 4 | import numpy as np
import matplotlib.pyplot as plt
class polynomial_regression():
"""description of class"""
def __init__(self):
return
def designMatrix(self,x,m):
"""designMatrix(self,x,m)
returns np.asarray(design matrix)
Parameters
-----------------------
... |
bacecf6e098c2beef963dcdcd0820ca5f8a8b15b | KemalAltwlkany/preference-articulation | /PreferenceArticulation/BenchmarkObjectives.py | 2,591 | 3.953125 | 4 | import math as math
class MOO_Problem:
"""
Class is never to be instantiated in the first place, its just a wrapper to keep all the benchmark functions used
in one nice class, which should be used as static functions.
"""
@staticmethod
def BK1(x):
"""
The BK1 test problem.
... |
5c29b88507b575a06887bc7998b35a73889f455d | C-milo/georgian-data-programing | /Assignment5/sqllite_exercise.py | 3,606 | 3.953125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 19:39:15 2019
@author: Nuthan
"""
'''
Using Python and SQLite (or SQL server if you desire) create a groups database
Create two tables one that contains the names and IDs of your group members and one that contains course names and course IDs
Create a one to many rela... |
0b66c8e6e885028304bc52ef56ac630cf6983145 | dundunmao/LeetCode2019 | /104. Maximum Depth of Binary Tree.py | 4,761 | 3.890625 | 4 | # 给定一个二叉树,找出其最大深度。
#
# 二叉树的深度为根节点到最远叶子节点的距离。
#
# 您在真实的面试中是否遇到过这个题? Yes
# 样例
# 给出一棵如下的二叉树:
#
# 1
# / \
# 2 3
# / \
# 4 5
# 这个二叉树的最大深度为3.
# Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
class Solution:
"""
@param... |
c7f10a666cc7d40a12a0d2671fa67f50372ce5ba | emredenizozer/algorithms | /AID.py | 1,753 | 3.890625 | 4 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'findMatch' function below.
#
# The function is expected to return a STRING.
# The function accepts following parameters:
# 1. STRING_ARRAY possibleMatches
# 2. STRING crossword
#
def findMatch(possibleMatches, crossword):
... |
ac0f42d9d771005a2641afbbb75a17a05930f457 | shirataaki/Python | /SymmeticTree.py | 902 | 3.84375 | 4 | # ノードクラスの定義
class TreeNode:
def __init__(self, val=0, left=None, right=None): # コンストラクタ
self.val = val #ノードがもつ数値
self.left = left # ノードの左エッジ
self.right = right # 右エッジ
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
if root == None:
return Tru... |
06948cfe8945efa767ed9cc1b9ad0cb33d515daa | andrelima19/Projetos_Python | /Developer/Python_Definitivo/Exercícios/Condicionais_If_Else/venv/Ex 34 – Aumentos múltiplos.py | 609 | 3.8125 | 4 | # Exercício Python 34: Escreva um programa que pergunte o salário de um funcionário e
# calcule o valor do seu aumento. Para salários superiores a R$1250,00, calcule um aumento de 10%.
# Para os inferiores ou iguais, o aumento é de 15%.
salario = float(input('Informe o salário: '))
if salario > 1250:
aumento = (s... |
fdc37b0391d4d75e3ab4862bd8759d37ed064540 | Conquerk/test | /python/day18/code/super.py | 447 | 3.671875 | 4 | #此示例 示意用super函数显示的调用被覆盖的方法
class A:
def work(self):
print("A.work被调用")
class B(A):
def work(self):
"""此方法覆盖父类的work"""
print("B.work被调用")
def mywork(self):
#调用自己的方法
#调用父类的方法
self.work()
super(B,self).work()
b=B()
# b.work()
# A.work(b)
# super(B,b).work... |
582b5d3d807272ab41be1aede8a35cc6bd2e555b | zedikram/I0320116_Zedi-Ikram-El-Fathi_Tugas4 | /I0320116_Exercise 4.10.py | 139 | 3.515625 | 4 | string: Hello World
skipping: x x x x x #characters marked with x
final str: HloWrd
#string
str = "Hello World"
#skip
new_str = str[0::2] |
f52d5438a310cb4dceafaf29dbe4027fca8b94ab | ArifulSourov/Problem-solving | /Quick Sort.py | 1,305 | 3.625 | 4 | elements = [23, 1, 4, 33, 14, 7, 11, 30]
def quick_sort(elements, start, end):
if start < end:
pi = partion(elements, start, end)
quick_sort(elements, start, pi-1)
quick_sort(elements, pi+1, end)
def partion(elements, start, end):
pivot_index = start
pivot = elements[pivot_index]... |
a6d02fcfe6210c4e15d87d6601b98dcf11a76aed | chenxu0602/LeetCode | /1346.check-if-n-and-its-double-exist.py | 1,191 | 3.75 | 4 | #
# @lc app=leetcode id=1346 lang=python3
#
# [1346] Check If N and Its Double Exist
#
# https://leetcode.com/problems/check-if-n-and-its-double-exist/description/
#
# algorithms
# Easy (36.87%)
# Likes: 240
# Dislikes: 37
# Total Accepted: 65.8K
# Total Submissions: 178.8K
# Testcase Example: '[10,2,5,3]'
#
# G... |
5d85798847de1c6516b71236e3ca9518bb59144c | phgilliam/100DaysOfCode | /PracticePython/ex8.py | 725 | 3.8125 | 4 | import random
def comp_rps():
seq = ['r','p','s']
return str(random.choice(seq))
def game(comp,play):
if play == 'r' and comp == 's':
return 'Player Wins!'
elif play == 'p' and comp == 'r':
return 'Player Wins!'
elif play == 's' and comp == 'p':
return 'Player Wins!'
el... |
12836db6995280c1992bd03774cb3fee31e3606a | miaviles/Data-Structures-Algorithms-Python | /random_interview_questions/seven_sided_dice.py | 663 | 4.09375 | 4 | from random import randint
# Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice!
def dice5():
return randint(1, 5)
def convert5to7():
# For constant re-roll purposes
while True:
# Roll the dice twice
roll_1 = dice5()
roll_2 = dice5()
# Convert the c... |
4141391de313279a9bf0f271f942f835838d6087 | ravikumarvj/DS-and-algorithms | /Graphs/hamilton.py | 2,282 | 3.671875 | 4 | ### COPIED ### VERIFIED
from graph import NGraph
def print_all_hamilton_path_r(g, start, path, visited):
# All nodes are visited. Found a hamilton path.
if len(visited) == len(g.vert_list):
print(path)
return
node = g.vert_list[start]
for neigh in node.get_neighs():
if neigh... |
5c05343b01de0ba400d93704cc5e352d221d7872 | neerajsharma9195/count-sketch-feature-selection | /src/utils/hash_generator.py | 1,323 | 3.515625 | 4 | import random
from src.utils.utils import isPrime
class HashGeneration():
def __init__(self, num_hash, size):
self.num_hash = num_hash
self.size = size
self.primes = []
self.first = []
self.second = []
self.generate_hash_function()
def generate_hash_function(se... |
9b4e27d79ea8b3a45da1cf35d19e27838bc38465 | a-harper/pygamelearning | /guessing.py | 625 | 3.90625 | 4 | __author__ = 'harpera'
import random
answer = random.randrange(1, 100)
guess = 0
attemptCount = 1
attemptLimit = 7
print("Hi! I'm thinking of a random number between 1 and 100.")
while guess != answer:
if attemptCount > attemptLimit:
print("Aw, you ran out of tries. The number was", answer)
break
... |
ca9651b03dca037b0c1404ffe0196f529dbbd690 | iiLincolnii/Homecoming | /22.py | 401 | 3.609375 | 4 | def main():
basis=int(input("输入一个基础数: "))
n=int(input('输入该数长度: '))
arr=[0]*n
b=basis
sum=0
for i in range(n):
arr[i]=basis
sum +=basis
basis=basis * 10 + b
print("%d="%sum,end='')
for i in range(n):
print("%d"%arr[i],end='')
if i < n-1:
... |
c1019b17f2d68b5e00dc233698bef4122a6c7a75 | CrazyIEEE/algorithm | /OnlineJudge/LeetCode/第1个进度/1315.祖父节点值为偶数的节点和.py | 1,858 | 3.59375 | 4 | #
# @lc app=leetcode.cn id=1315 lang=python3
#
# [1315] 祖父节点值为偶数的节点和
#
# https://leetcode-cn.com/problems/sum-of-nodes-with-even-valued-grandparent/description/
#
# algorithms
# Medium (80.69%)
# Likes: 34
# Dislikes: 0
# Total Accepted: 7.1K
# Total Submissions: 8.8K
# Testcase Example: '[6,7,8,2,7,1,3,9,null,1... |
26fb53b4f453836de7b05aa02902eb205b0ed035 | OliviaT1029/Summer-Camp-Project | /Substitute.py | 585 | 3.859375 | 4 | import random
alphabet = "abcdefghijklmnopqrstuvwxyz"
def main():
key = make_key(alphabet)
original = input("Message: ").lower()
ciphertext = encrypt(original, key)
plaintext = decrypt(ciphertext, key)
print()
print("Original text: ", original)
print("Encrypted text:", ciphertext)
... |
cecb0fc3866c66088f2c231af9b110787dbe0d1f | AyberkYavuz/body_type_estimator | /core/file_handler.py | 805 | 3.96875 | 4 | import pickle
class PickleHandler:
"""PickleHandler which is used for saving, loading and dumping python objects.
"""
def save_object(self, path, obj):
"""Saves the python object.
Args:
path: str. Saving location of the python object.
obj: object. Python object to b... |
7b91555a2044d1c5e22825831e1716a72554a0e5 | kaufmann42/Machine-Learning-Work | /HW2/cm.py | 1,134 | 3.515625 | 4 | # John Kaufmann
# 3/16/2016
# BME4931
#
# print a confusion matrix given the predicted classifiers, the actual classifiers and the name of the structure
def print_ConfusionMatrix(predicted, actual, name):
actual = predicted
total = actual.shape[0]
one = 0
two = 0
three = 0
four = 0
#const... |
b15b2fbe8aeea17f97af482aa7e208d1dcd64ec4 | DimoDimchev/Softuni-Python-OOP | /Decorators/even_numbers.py | 281 | 3.75 | 4 | def even_numbers(function):
def wrapper(*args, **kwargs):
func = function(*args, **kwargs)
return [num for num in func if num % 2 == 0]
return wrapper
# @even_numbers
# def get_numbers(numbers):
# return numbers
#
# print(get_numbers([1, 2, 3, 4, 5])) |
b133fd79aee52d51607fdca83b9d184a6eaf1156 | GabrielCzar/Analise-de-Algoritmos | /monitoria/06-12/recursivo.py | 477 | 3.703125 | 4 | itens = [5, 11, 5, 1]
def tesouro(soma, i):
if soma == 0 and i == 0:
return True
if not soma == 0 and i == 0:
return False
if soma == 0 and not i == 0:
return True
global itens
return tesouro (soma, i - 1) or tesouro(soma - itens[i], i - 1)
def main():
global itens
soma =... |
d49ec9c3e318fc535b5be4f43dd4c0ea3386ca02 | PranjalBalar/Algorithms | /Arithmetic/EightQueens.py | 1,435 | 4 | 4 | # -*- coding: utf-8 -*-
#This program places 8 queens on a chessboard
#It uses backtracking to find the solution
global N
N = 8
def display(board):
for i in range(N):
for j in range(N):
print board[i][j],
print
def isSafe(board, row, col):
for i in range(col):
... |
8f1ab4e41d40a13918efe67e79054258f5da398e | Dave-weatherby/All-Projects | /Python-Projects/flowChartToCode/flowChartToCode.py | 549 | 3.71875 | 4 | def main():
startData = [100, 2, 323, 66, 65, 67, 99, 27, 212, 8]
sortedData = []
# main for loop
for y in range(0, 10):
largest = 0
# sorting from largest to smallest
for x in range(0, 10):
if startData[x] > largest and startData[x] != -1:
largest = s... |
14457f19aa27d2cea152d0369a15355d011e9984 | endy-see/AlgorithmPython | /SwordOffer/61-PrintZhiTree.py | 2,909 | 3.9375 | 4 | """
按之字形顺序打印二叉树
题目:请实现一个函数按照之字形打印二叉树,即第一层按照从左到右的顺序打印,
第二层按照从右至左的顺序打印,第三层按照从左到右的顺序打印,其他层以此类推
思路:
1. 两个栈实现 -> 逻辑清晰 快 容易写
2. 用双端队列 用flag控制打印方向(好是好,但是不知道什么时候该遍历下一层,这种方法先放着吧)
flag=True 从左往右打印 从左边弹出节点 从右边加入其孩子节点 先入左孩子再入右孩子
flag=False 从右往左打印 从右边弹出节点 从左边加入其孩子节点 先入右孩子再入左孩子
count 记录每次打印的节点个数
"""
from collections import deque
... |
895710e9b7ab0b9d8bacfdb8939ea0750a597344 | yang4978/LeetCode | /Python3/0515. Find Largest Value in Each Tree Row.py | 1,307 | 3.734375 | 4 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def largestValues(self, root: TreeNode) -> List[int]:
if not root:
return []
queue = [root]
res = []... |
f979bda62d0af287ef35cb3b70a7c9b29907ebd3 | yamashitamasato/atcoder | /atcoder009A.py | 66 | 3.5 | 4 | N=int(input())
if(N%2==0):
print(N/2)
else:
print((N/2)+1) |
c20075cea6ee0450d736e68a0f666d90b8dd5f53 | mraza2024/iq_game_edge | /iq_game_edge.py | 2,156 | 4.375 | 4 | #how smart are you?
print("Welcome to the Intellectual Game! You will see 10 questions that will test your general knowledge and intelligence. Your goal is to answer all the questions correctly, otherwise the game will stop. At the end of the game, the program will show your result. Good luck!")
questions=["Which of ... |
40f7e9d4b43bdb587bf0ab97ee0aa834547fccf2 | pideviq/quizzes | /Python/reverse_and_add.py | 2,254 | 4.15625 | 4 | ''' == EN ==
The problem is as follows: choose a number, reverse it's digits and add it
to the original. If the sum is not a palindrome (which means, it is not the
same number from left to right and right to left), repeat this procedure.
For example:
195 (initial... |
fa754ac465e633bd84fe145e1445274a1b19a640 | KKosukeee/CodingQuestions | /LeetCode/266_palindrome_permutation.py | 1,066 | 3.921875 | 4 | """
Solution for 266. Palindrome Permutation
https://leetcode.com/problems/palindrome-permutation/
"""
from collections import defaultdict
class Solution:
"""
Runtime: 28 ms, faster than 97.34% of Python3 online submissions for Palindrome Permutation.
Memory Usage: 13.6 MB, less than 50.00% of Python3 onli... |
653053886fb93a20a941069b8f97897c757be92c | jimibarra/cn_python_programming | /15_aggregate_functions/15_03_my_enumerate.py | 445 | 4.21875 | 4 | '''
Reproduce the functionality of python's .enumerate()
Define a function my_enumerate() that takes an iterable as input
and yields the element and its index
'''
def my_enumerate(sequence):
my_list = []
count = 0
for item in sequence:
my_tuple = (count, item)
my_list.append(my_... |
28dcd707d2fc0da0238092eb4306141449123f1a | johanwahyudi/Cryptography | /Classic/Transposition-Cipher/Encrypt.py | 2,017 | 4.0625 | 4 | #!/usr/bin/env python
from string import lowercase, uppercase
#library cuma untuk besar kecil huruf saja
#fungsi enkripsi caesar
def caesar_en(text, key):
result = []
for c in text:
if c in lowercase:
enkripsi = lowercase.index(c)
enkripsi = (enkripsi + key) % 26
res... |
e25e7be39934dd4a27bb4bf1b7a87ffbfef2621d | ElazarNeeman/python_zth | /overview/p22_functions/task2_ref.py | 985 | 4.21875 | 4 | # write a function 'above_avg' which can take an arbitrary number of arguments and returns a list contains
# only the elements that are above the average
def above_avg(*args):
avg = sum(args) / len(args)
return list(filter(lambda e: e > avg, args))
print(above_avg(10, 2, 4, 9, 34, 3, 15))
# write a func... |
ad9791162854c5299a00ee39fd7d18fcb54a785d | benjiemalinao87/LearnPythonTheHardWay | /Functions/func.py | 411 | 3.671875 | 4 |
# get name function,name& mobile hardcoded
def print_two(arg1, arg2):
print(f"Enter your name: {arg1}")
print(f'Enter you mobile: {arg2}')
# get name&mobile form users input
# this just takes one argument
def print_one(arg1):
print(f"Enter age: {arg1}")
# this one takes no arguments
def print_none():
... |
4210c248c291a573248f5fcb53ca91222df5f125 | dejuata/Mario-Smart | /app/game/agent/node.py | 2,528 | 3.796875 | 4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Basado en https://www.cs.us.es/cursos/iati-2012/
from game.utilities.utilities import find_position as find_mario
class Node:
"""
Un nodo se define como:
• El estado del problema
• Una referencia al nodo padre
• El operador que se aplicó para generar el nodo
• Pr... |
ad4645a495dbbfdcbf48e6426db56899e078cb52 | 2226171237/Algorithmpractice | /NewKe/t2.py | 2,177 | 3.71875 | 4 | '''
题目描述
对于一个给定的正整数组成的数组 a[] ,如果将 a 倒序后数字的排列与 a 完全相同,我们称这个数组为“回文”的。
例如, [1, 2, 3, 2, 1] 的倒序是他自己,所以是一个回文的数组;而 [1, 2, 3, 1, 2] 的倒序是 [2, 1, 3, 2, 1] ,
所以不是一个回文的数组。对于任意一个正整数数组,如果我们向其中某些特定的位置插入一些正整数,那么我们总是能构
造出一个回文的数组。输入一个正整数组成的数组,要求你插入一些数字,使其变为回文的数组,且数组中所有数字的和尽
可能小。输出这个插入后数组中元素的和。例如,对于数组 [1, 2, 3, 1, 2] 我们可以插入两个 1 将其变为回文的数... |
927f4bc708c1ffb46ac5c4ef885d9c9198d30588 | endoeduardo/snake | /objects.py | 1,180 | 3.515625 | 4 | import pygame
from random import randint
class Apple():
"""Configurações da maçã"""
def __init__(self, settings):
self.settings = settings
#Criando uma surface pra maçã
self.skin = pygame.Surface((self.settings.apple_width, self.settings.apple_height))
self.skin.fill(self.sett... |
2a66adf329dc2feaad9df713bbe57ea20317960d | madhatter1069/terminal-connect-four | /connectfour_functions.py | 3,065 | 4 | 4 | ##Jared Clark 76551956 and Jack Callahan 37163374
import connectfour
def create_game():
'''creates a new game and game board.'''
this_game=connectfour.new_game()
return this_game
def use_drop(gamestate: connectfour.GameState, col_num: int):
'''takes the game move and uses the drop function'''
game... |
2889144f0532f20229cec0b7e481cb210f1aa9de | BrianFreeman0620/Movie_Database | /Movie Database.py | 10,819 | 4.125 | 4 | # Imports the needed code to open excel files, create graphics windows, and
# quickly run math equations
import pandas as pd
from graphics import *
from math import *
# Finds the distance between two objects given two lists of numbers
def minkowskiDist(v1,v2,p):
sumOfV = 0
for value in range(len(v1)):... |
2087d9cd98007d836cd39520f3acbc41edbafe77 | fragoso988/treinos_python | /PythonExercicios/aula010.py | 3,362 | 4.125 | 4 | import random
from datetime import date
print("Desafio 028")
print("""\nEscreva um programa que faça o computador pensar em um número inteiro entre 0 e 5.
Peça para o usuário descobrir qual o número.\n""")
sorteio = random.randint(0,5)
n = int(input("Digite um número de 0 a 5: "))
if(n == sorteio):
print("Parab... |
7b2d0547005a77626a4cfff28b48986ed2cbf173 | jasonsinger16/PFB2017_problemsets | /Python_probset6/ps6_02.py | 512 | 3.75 | 4 | #!/usr/bin/env python
# Substitute every occurrence of "Nobody" in the file 'Python_06_nobody.txt' with "Catherine"
# Write an output file with Catherine's name ==> Catherine.txt
poem_file = open('Python_06_nobody.txt', 'r')
poem_subbed = open('Python_06_Catherine.txt', 'w')
poem_text = poem_file.read()
poem_text_s... |
d9499db129b557c05f1045aff9f9bde1dcd23689 | JWKennington/apsjournals | /apsjournals/util.py | 924 | 4.03125 | 4 | """Miscellaneous utilities
"""
import datetime
def month_name_to_num(m: str):
"""Convert a month name to a number
Args:
m:
str, the name of the month
Returns:
int, the month number
"""
return datetime.datetime.strptime(m, '%B').month
def parse_start_end(tr: str):
... |
4eb6f5915ba650f59edbea6f877be1a9b9885884 | TatsuLee/pythonPractice | /leet/l110.py | 701 | 3.765625 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, root, d):
if root is None:
return d, True
dl, flag = self.dfs(root.left, d+1)... |
417a0f3ccc24b2a5aa2d9d009b5ba06c6c8fec42 | zeroam/dev-study | /d20200507/simple_server.py | 905 | 3.53125 | 4 | import socket
HOST = "127.0.0.1"
PORT = 9000
RESPONSE = b"""\
HTTP/1.1 200 OK
Content-type: text/html
Content-length: 14
<h1>Hello</h1>"""
# AF_INET(ipv4 주소를 사용하는, IP), SOCK_STREAM(연결형 통신, TCP)의 소켓 생성 => TCP/IP 소켓 생성
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 해당 소켓을 재사용할 수 있도록 옵션 설정
server... |
a57c94fa53980ea1beb6c8641a46f8976f3a67ae | violenttestpen/DataStructureAlgorithms | /Sort/InsertionSort.py | 420 | 3.765625 | 4 | # insertion sort [O(n**2)]
def isort(array):
a = array[:]
# start from the second element
for i in range(1, len(array)):
# move left
x = i - 1
while x >= 0:
if a[x] > a[x + 1]:
a[x], a[x + 1] = a[x + 1], a[x]
else:
# all previo... |
afeccaf1f7d9b2c317c0c63fb773258d162ef865 | CaptainLazarus/Python-Assignments | /Ass 3/10.py | 374 | 4.0625 | 4 | from statistics import median
size = int(input("Enter the size of array "))
arr = []
for i in range(size):
ele = int(input())
arr.append(ele)
mean = sum(arr)/len(arr)
Median = median(arr)
count_ = 0
for i in arr:
if arr.count(i) > count_:
count_ = arr.count(i)
k = i
mode = k
print("The Mean , Median , Mode are... |
3fa17260900582b293669ff40af5cd895f065504 | iamslash/examplesofml | /keras/basic.py | 553 | 3.625 | 4 | # regression ANN example
def main(_epochs):
import keras
import numpy
x = numpy.array([0, 1, 2, 3, 4])
y = 2 * x + 1
model = keras.models.Sequential()
model.add(keras.layers.Dense(1, input_shape=(1,)))
model.compile('SGD', 'mse')
model.fit(x[:3], y[:3], epochs=2000, verbose=0)
p... |
4943825d62e9cb7d007ebd047e8764482335c4e7 | ivanoel/db.sqlite3 | /dbprecos.py | 1,246 | 3.65625 | 4 | #!/usr/bin/python3
# __autor__ == '__Ivanoel__'
# Banco de Dados SQLite, tem varias funções e objetos que acessam o banco.
import sqlite3
# criamos o .db
conexao = sqlite3.connect('preços.db')
# cursores são objetos utilizados para enviar comandos e
# receber resultados do db chamando o método cursor().
cur = conex... |
d3f360c479692ac45265ba823044b69e9b58b613 | Taoge123/OptimizedLeetcode | /LeetcodeNew/python/LC_363.py | 2,899 | 3.859375 | 4 |
"""
560. Subarray Sum Equals K
974. Subarray Sums Divisible by K
325. Maximum Size Subarray Sum Equals k
1074. Number of Submatrices That Sum to Target
363. Max Sum of Rectangle No Larger Than K
"""
"""
Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its su... |
654b003cf635c2503ded7dd2acb2d34c7974616f | cahern10/openAsset | /sectionA/Exercise1/magickWrapper.py | 1,619 | 3.9375 | 4 | import subprocess
import os
import sys
"""
validateInputPath checks to see if the input path
provided by the user is valid
:param inputPath: contains the string of the path
:return: passes back true if the function does not error out
"""
def validateInputPath(inputPath):
if not os.path.exists(inputPath):
... |
1c6432116f4ee180bd54cdac8d79a7a696495983 | ZhouPan1998/DataStructures_Algorithms | /pythonds/trees/binary_tree.py | 2,087 | 4.0625 | 4 | # -*- coding: utf-8 -*-
from typing import Union
class BinaryTree:
"""二叉树"""
def __init__(self, item=None):
self.__data = item
self.__left = None
self.__right = None
@property
def data(self):
return self.__data
@data.setter
def data(self, item):
self... |
063a730e4a036736c290b9436d681770d38e39f9 | shubin-denis/algorithms-and-data-structures-Python | /Lesson_1/Task_9.py | 491 | 4.34375 | 4 | # Вводятся три разных числа. Найти, какое из них является средним
# (больше одного, но меньше другого).
x = int(input('первое число: '))
y = int(input('второе число: '))
z = int(input('третье число: '))
if z > x > y:
print(f'Среднее число: {x}')
elif z > y > x:
print(f'Среднее число: {y}')
else:
print(f'... |
52b8cbd54306de4652462476fcff8e1dc36ba3e9 | tonumikk/Learn-Python | /ex21.py | 1,159 | 4.15625 | 4 | def add(a, b):
print "ADDING %d + %d" % (a, b)
return a + b
def subtract(a, b):
print "SUBTRACTING %d - %d" % (a, b)
return a - b
def multiply(a, b):
print "MULTIPLYING %d * %d" % (a, b)
return a * b
def divide(a, b):
print "DIVIDING %d /%d" % (a, b)
return a /b
print "Let's do som... |
1021f155bedec8c20327ee238d47ab9d61083304 | MiniOK/companyone | /src/scripts/conversion/shutil_test.py | 749 | 3.59375 | 4 | # 文件复制
# -*- coding:utf-8 -*-
import shutil
# file_path = r"C:\Users\miniloveliness\Desktop\test_code\test.txt"
# new_path = r"C:\Users\miniloveliness\Desktop\new.txt"
# shutil.copyfileobj(open(file_path, 'r', encoding='utf-8'), open(new_path, 'w', encoding='utf-8'))
# class EvaException(BaseException):
# # def ... |
7dce2978078f533ef5fbde4d0938fa6559b8da08 | lbrusaoconnell/Python-Server-Practice | /c.py | 4,619 | 3.53125 | 4 | import socket
import threading
import time
import turtle
HEADER = 64
PORT = 2021
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
#SERVER = '47.149.222.226'
SERVER = '192.168.1.56'
ADDR = (SERVER, PORT)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)
def send(msg):
message = msg... |
60bf40eb3cb1e04260a0699ace274cb46441f0c7 | GabrielBrotas/Python | /modulo 2/Exercicios/Ex059 - Menu de opcoes.py | 1,064 | 4.0625 | 4 | # prpgrama que leia 2 valores e mostre um menu na tela
# 1 somar, 2 multiplicar, 3 maior, 4 menor e 5 sair
n1 = int(input('valor 1: '))
n2 = int(input('valor 2: '))
c = 0
s = 0
print('''numero 1 = {} e numero 2 = {}. Qual operacao realizar?'
[1] soma
[2] multiplicacao
[3] maior
[4] menor
... |
dc07a8eb340dde953c1ffbef42622b6f05f0fab9 | rfk/autoself | /autoself/testmeta.py | 443 | 3.515625 | 4 |
import autoself
__metaclass__=autoself.autoself
class Test1:
def __init__(color,size):
self.color = color
self.size = size
def show():
print "I am a " + self.size + ", " + self.color + " thing"
def myclass():
return cls
t = Test1("blue","big")
if not t.color == "blue":
... |
8ca0ea303b0fb3e9ca96723fc4556d14e517ac6d | bawuju/LeetcodeSolution | /python/599.py | 1,881 | 3.765625 | 4 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
class Solution(object):
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
index_sum = -1
result = []
map1 = {}
for index in range(l... |
65974ea3211a2b1dc8e8fccf44d484d4d9f7ae17 | Andromeda2333/ImageProcessing | /Demo_6_17_2014/test/test_thread_1.py | 1,268 | 3.8125 | 4 | #coding=utf-8
'''
Created on 2014年7月12日
@author: lenovo
'''
import time
import threading
from mutex import mutex
from itertools import count
# def timer(no, interval):
# cnt = 0
# while cnt<10:
# print 'Thread:(%d) Time:%s\n'%(no, time.ctime())
# time.sleep(interval)
# cnt... |
275736008b7c3f50a84a4290e7a485611612f5d1 | saddaf88/Coding-Challenge | /HackerRank/if-else.py | 779 | 4.3125 | 4 | # Task
# Given an integer, , perform the following conditional actions:
#
# If is odd, print Weird
# If is even and in the inclusive range of to , print Not Weird
# If is even and in the inclusive range of to , print Weird
# If is even and greater than , print Not Weird
# Input Format
#
# A single line containing... |
eb4dd738071d04695f6e8364eaacce3439282c4d | ArunCSK/MachineLearningAlgorithms | /PyGames/maze1.py | 10,817 | 3.671875 | 4 | import random
import pygame
import time
pygame.init()
WHITE = (255,255,255)
GREY = (20,20,20)
BLACK = (0,0,0)
PURPLE = (100,0,100)
RED = (255,0,0)
BLUE = (0, 0, 255)
size = (1200,700)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Maze Generator")
done = False
clock = pygame.time.Clock()
width... |
b0cf02c345dd94786ab302e99ee9e5b5ff98ab0a | zainllw0w/skillbox | /lessons 21/HomeWork/task3.py | 169 | 3.5625 | 4 | def f(n, k=1, i=1, my_list=[1]):
if i == n:
return my_list[-1]
my_list.append(k)
last_num = my_list[-2]
return f(n, k+last_num, i+1)
print(f(6)) |
9830a1b0bd3bd18feecba5ab19ec9ef787a4a3c2 | amulshrestha/Python-Projects | /Find IP Address of any Website/findIP.py | 1,478 | 4.375 | 4 | '''
Get IP Address of any website using python
Author: Amul Shrestha
'''
#Importing necessary packages.
import socket
#Displaying Banner
print("""
_____ _ _ ___ ____ __
| ___(_)_ __ __| | |_ _| _ \ ___ / _| __ _ _ __ _ _
| |_ | | '_ \ / _` | | || |_) | / _ \| |_ / _` | '_ ... |
dd5257077929dc33201ed04414dcf68281814ef5 | OlehYavoriv/Ping-pong | /pongEngine.py | 3,927 | 3.609375 | 4 | from random import uniform, choice
from typing import Union, Tuple, List
class Ball:
def __init__(self, game, radius, speed):
self._game = game
self._speed = speed
self._radius = radius
self.__dx = 0
self.__dy = 0
self.__x = game.width / 2 - self._radius
sel... |
417bb0b4d940ae081b2f94003dea3dcfcf130e67 | nishikaverma/Python_progs | /sum.py | 203 | 3.859375 | 4 |
print("there sum is",int(input('enter 1st no'))+int(input('enter 2nd no.')))
print('Enter two no.s for addition')
a=int(input())
b=int(input())
s=a+b
print("a=",a,"b=",b)
print('There sum is:',s)
|
bd821944cf162d368b3d6b347d88d458e4fa501b | Prathiksha-Hegde/Leetcode-Solutions | /008_Min_Stack.py | 717 | 4 | 4 | class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.list_values =[]
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.list_values.insert(len(self.list_values),x)
def... |
0301aebb67c460c82a84c6d52a131ad8b9e334cf | ajdeve/python | /Shuffling (Zip, Accumulate, Sum, Good Pairs).py | 1,886 | 4.03125 | 4 | #!/usr/bin/env python
# coding: utf-8
# # shuffle the array
# ### zip
# In[46]:
nums = [2,5,1,3,4,7]
n = 3
# In[77]:
def shuffleArray(nums, n):
list1 = []
list2 = []
list3 = []
for i in range(0,n):
list1.append(nums[i])
for j in range(n,len(nums)):
list2.append(nums[j])
... |
0ea5f775dc2ed46a9e29204678079f320b79a5e8 | jesuarva/Python-TicTacToe | /tic-tac-toe.py | 2,856 | 3.609375 | 4 | #Defining MAIN board
board ="""
*---------------*
| |
{a} | {b} | {c}
---+---+---
{d} | {e} | {f}
---+---+---
{g} | {h} | {i}
| |
*---------------*
"""
#Defining the positjons on board.
#dict(positon) = how current game is going
#dict(available) = available positions in cu... |
f946cdd45f6bed21d06d6ee48a3ff954df1ee706 | abdulahia/Hangman | /Hangman.py | 5,965 | 4.375 | 4 | ######################################################################
# Author(s): Ahmed Abdulahi
# Username(s): abdulahia
#
# Assignment: P01 final project
#
# Purpose: The game of hangman: will invite the user to guess words from possible word bank and by guessing letter by
# letter the turtle will be drawing the ha... |
cc7f62fe4da210761ba3e7fa85dc5e9de4d1e6c8 | RGonzaloLeandro/python-initial-course | /Promedio.py | 246 | 3.953125 | 4 | def promediar(a,b,c):
resultado = (a + b + c)/3
return resultado
nota_1 = int(input("Primera nota?"))
nota_2 = int(input("Segunda nota?"))
nota_3 = int(input("Tercera nota?"))
print("El promedio es:", promediar(nota_1, nota_2, nota_3))
|
49c1cf70f69b20595a4c0de9c8aaf75ecffe7eda | wltrallen2/Python-TechDegree-Project-2 | /ciphers/transposition.py | 4,288 | 4.15625 | 4 | from .ciphers import Cipher
class Transposition(Cipher):
"""This class encodes and decodes messages using the Rail Fence Cipher
(a version of the Transposition cipher as defined at
https://en.wikipedia.org/wiki/Transposition_cipher). The initializer
requires an int that represents the number of rails ... |
98c980d06df047d0792f87b7f6ca3d6cb1c34b4a | NaoiseGaffney/PythonMTACourseCertification | /GaffTest/comprehensionInPython.py | 4,061 | 4.84375 | 5 | numbers = [1, 2, 3, 4, 5]
text = ["One", "Two", "Three", "Four", "Five"]
# List and Dictionary Comprehensions, For-, and If-statements first followed by List and Dictionary Comprehensions
# doing the same thing.
# --- 1. Simple example
print("\n--- Example 1, List Comprehension:")
# For-loop...
result = []
for x in ... |
af7c480c7a1e1e1f83755724ee1025e1bec7ad32 | AlexFue/Interview-Practice-Problems | /sorting_algorithm/color_sort.py | 3,054 | 4.15625 | 4 | Problem:
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
Follow up:
Could you sol... |
1dc11f3bc927c0b768f71de88fca6b0870dcd1e6 | neveSZ/fatecsp-ads | /IAL-002/Listas/2-Seleção/07.py | 680 | 3.84375 | 4 | '''
Fornecido os coeficientes de uma equação de segundo grau (com a≠0, ou seja,
não é necessário verificar a existência da equação), exibir suas raízes.
Obs. (2): Caso Δ seja negativo, imprimir suas raízes no formato x-yi e x+yi,
apos calcular x e y.
'''
a = float(input('a: '))
b = float(input('b: '))
c = float(input(... |
9a10fedbf1aff6d2a77035b3b88c52ae8b3fdb29 | gavrie/pycourse | /examples/attr.py | 210 | 3.59375 | 4 | class Foo(object):
def __init__(self, a):
self._a = a
@property
def a(self):
return self._a
@a.setter
def a(self, value):
print "setter"
self._a = value
f = Foo(123)
print f.a
f.a = 5
print f.a
|
87643f43071ba086d24c97d510e88b5083d193cb | CristianoFernandes/LearningPython | /desafios/desafio_018.py | 348 | 3.953125 | 4 | print('#' * 43)
print('#' * 15, 'DESAFIO 018', '#' * 15)
import math
angulo = int(input('Digite a medida do ângulo: '))
print('O seno de um angulo de', angulo, 'º é: ', math.sin(angulo))
print('O cosseno de um angulo de', angulo, 'º é', math.cos(angulo))
print('A tangente de um angulo de', angulo, 'º é', math.tan(angu... |
cc627b17eb30f10da4af33b7d1c9d9e391dfc348 | jaqamoah/CS210 | /Release/PythonCode.py | 1,333 | 4.09375 | 4 | import re
import string
import fileinput
contents = dict() # Dictionary to store items from the input file.
# Method to display the frequency of a specific item
def display_specific_items(value):
read_data() # Method to read the items from the input file and store them in a dictionary.
key = conte... |
229953ea3a0ec15c980f9814f2c683601550f84f | celshee/areacalsi | /area.py | 156 | 4 | 4 | def area():
r=int(input("enter the radius of the circle"))
area1=3.14*(r**2)
print(area1)
area()
print("the area of the circle is ",)
|
a1ab9993a1f555a744c4699e6e9594e0c39c28f0 | Bonfim-luiz/Introducao_Ciencia_Computacao_Python_Parte_2_Coursera | /Semana 2/Conta_letras.py | 1,219 | 3.9375 | 4 | import re
def conta_letras(frase, contar="vogais"):
"""A função conta_letras(frase, contar="vogais"), que recebe como
primeiro parâmetro uma string contendo uma frase e como segundo
parâmetro uma outra string. Este segundo parâmetro deve ser opcional."""
consoantes = ''
vogais = ''
fras... |
07cc4dcf09903fa36ed2a047283debb1e74760ea | appinfin/RootCount | /RootCount.py | 1,487 | 3.796875 | 4 |
Af = True
Bf = True
Cf = True
def root_count(A, B, C):
""" Вычисляет число корней квадратного ур-ния
"""
if A!=0:
D = B**2 - 4*A*C
if D > 0:
print(f'D = {round(D, 2)} -> Два корня: ', end=' ')
print(f'X1 = {round((-B -D**0.5) / (2*A), 2)};', end=' ')
... |
3e0d79a1c85da1be5feb95ff688d9aa1614e9b6f | ritwiksingh21/WebTest | /qclass.py | 557 | 3.640625 | 4 | class Question():
def __init__(self):
self.text = ""
self.tags = []
class QuestionMC(Question):
def __init__(self):
super().__init__()
self.answers = []
self.correctAnswers = []
self.correctAnswerLabels = [] #should i use this?
class Answer():
def __init__(... |
c73ce129433199c507cecac9f2bce5dbcfe95ac5 | dtingg/Fall2018-PY210A | /students/KyleBarry/session04/trigrammify.py | 2,059 | 3.765625 | 4 | import random
import requests
from bs4 import BeautifulSoup
def get_text(url):
"""
Get text data from url of gutenberg project so as to not have it within
code
"""
page = requests.get(url)
soup = BeautifulSoup(page.content, "lxml")
text = soup.find_all("p")
texter = [i.text for i in te... |
86cb1f3b6ca9bc783cd5cc0cef07a4eb51711f7e | emmagordon/python-bee | /hard/roman_numerals.py | 635 | 3.875 | 4 | #!/usr/bin/env python
"""Write a function, f, which, given a positive integer, returns the
value as a roman numeral.
where, in roman numerals:
i = 1
v = 5
x = 10
l = 50
c = 100
d = 500
The value you return should use as few characters as possible, e.g. 4
should be 'iv' rather than 'iiii'.
You can assume the number y... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.