blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
0bfc8ba2a3d3277b923d8f4570c195dfe8f81cbf | jclewis7682/SDN | /myPythonScripts/Python Review 1.py | 3,888 | 4.3125 | 4 | ##Author: Jesse Lewis##
##Date: 27JAN21##
##Python Review 1 Homework##
'''
#####################Part 1 - Version one (long version)
fullName = input("What is your first and last name: ")
newName = fullName.split()
firstName = newName[0]
lastName = newName[1]
print("Welcome to Python, " + firstName.capitalize() + " ... |
b6d7f078704bb4a49f187bdffefa6b5f3b01dfbe | wow01022634/udemy_python_quickstart | /3_Data_Type/3-5_Tuples.py | 111 | 3.765625 | 4 | countries = ('uk','usa','france','swiss')
print(countries[0])
for country in countries:
print(country) |
825ffa977a5878827f757ae398e0823c0a18f4c3 | w7374520/Coursepy | /L07/prepareCouse/opp_1.py | 531 | 3.921875 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#Author:xp
#blog_url: http://blog.csdn.net/wuxingpu5/article/details/71209731
std1 = { 'name': 'Michael', 'score': 98 }
std2 = { 'name': 'Bob', 'score': 81 }
std3={'name':'xp','score':111}
def print_score(std):
print('%s %s'%(std['name'],std['score']))
class Student(ob... |
e7c004299886821dca5489d2d51089ec88b3edfc | k11a/python | /programs/class/class2.py | 4,218 | 3.84375 | 4 | # import random
# import string
# x=1
# l=[]
# while x<1000000:
# x += 1
# l.append(' '.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for c in range(512)))
# if x % 10000 == 0:
# print (x,end='\n')
# print (l[-1],end='\n')
# print()
# x=1
# input()
# whi... |
bdc0702296b9e1a19f757e0824dc910dc846ea0d | Frgk/myprogscript | /cesarcode.py | 1,097 | 3.96875 | 4 |
#NEED TO IMPROVE THE PROGRAM
text = input("Enter the text to code : ") #Enter the text to code
key = int(input("Entrez the key : ")) #Enter the key, and convert to an integer
alphabet = ['a', 'b', 'c', 'd', 'f', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w... |
ae9a372d4b9c04a753bb44b1fb9709868af5faa5 | netor27/codefights-solutions | /arcade/python/arcade-theCore/11_SpringOfIntegration/092_StringsCrossover.py | 1,194 | 4.1875 | 4 | '''
Define crossover operation over two equal-length strings A and B as follows:
the result of that operation is a string of the same length as the input strings
result[i] is either A[i] or B[i], chosen at random
Given array of strings inputArray and a string result, find for how many pairs of strings from inputArray ... |
144f7d6defe2d99d49610a89aa55177f46932eac | malleswar0511/Assignments | /marks,avg,percentage.py | 537 | 3.984375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 21 06:31:36 2020
@author: mahi
"""
subject1=int(input("enter subject1 marks : "))
subject2=int(input("enter subject2 marks : "))
subject3=int(input("enter subject3 marks : "))
subject4=int(input("enter subject4 marks : "))
subject5=int(input("enter ... |
a8d8af91accd2ddc8470113fab56f1c040a63780 | BenitezDI/All | /Practice3.py | 356 | 4.15625 | 4 | ## Dayanara Benitez
#September 26,2019
#Period 6
#Practice3.py
week = input("What day of the week is it?")
if week == "Monday":
print ("Its Monday, the weekend is over")
elif week == "Friday":
print ("It's Friday, the weekend is close")
elif week == "Saturday":
print ("It's the weekend, time to relax"... |
4e276ee9703d0eef21c4f1c3dc5a8549c831b700 | marcos-dev-web/dns-enum | /run.py | 1,986 | 3.625 | 4 | #!/bin/python3
from dns import resolver
import argparse
import os
parser = argparse.ArgumentParser(description='To parse an url and a wordlist')
parser.add_argument('--url', type=str, nargs='+', help='parse an url as: http://example.com')
parser.add_argument('--wordlist', type=str, nargs='+', help='parse an wordlist ... |
64ced3312d76ffdd17a6e2d1f69716afe866ff8c | Emerson53na/exercicios-python-3 | /047 contagem de pares.py | 119 | 3.84375 | 4 | while True:
for c in range(2, 51, 2):
print('.', end=' ')
print(f'{c}', end=' ')
input(' ...')
|
b130d5243c00b62c10dee4ce8d6b5e521aab7e5b | emekaiwu/switch_emeka | /bank.py | 923 | 3.96875 | 4 |
class Banking():
balance = 0.0
def __init__(self,username,phone,email):
self.username = username
self.phone = phone
self.email = email
self.acc_no = ""
def create_Account(self):
self.acc_no = ""
print (input("enter your account number"))
def check_Balanc... |
7d19e8ed469d3dca5025ce538f2bd2beebc0c8a0 | satanas/leetcode | /find-all-duplicate-numbers/find-all-duplicate-numbers.py | 562 | 3.859375 | 4 | def find_all_duplicates(nums):
duplicateNumbers = []
i = 0
while i < len(nums):
if nums[i] == i + 1:
i += 1
else:
if nums[nums[i] - 1] == nums[i]:
duplicateNumbers.append(nums[i])
i += 1
else:
temp = nums[num... |
00a50c1cb8d224b8bd290f572b3eaec081ba7753 | BimuratMukhtar/IntroML | /Labs/Lab1/lab1.py | 1,448 | 3.765625 | 4 | """Utility functions for loading and plotting data."""
import csv
import numpy as np
import matplotlib.pyplot as plt
def load_reviews_data(reviews_data_path):
"""Loads the reviews dataset as a list of dictionaries.
Arguments:
reviews_data_path(str): Path to the reviews dataset .csv file.
... |
6f29239f8a84bb9323cc267475bbbbbb2f2bdca6 | Joecth/leetcode_3rd_vscode | /953.verifying-an-alien-dictionary.py | 5,564 | 3.984375 | 4 | #
# @lc app=leetcode id=953 lang=python3
#
# [953] Verifying an Alien Dictionary
#
# https://leetcode.com/problems/verifying-an-alien-dictionary/description/
#
# algorithms
# Easy (54.94%)
# Likes: 721
# Dislikes: 282
# Total Accepted: 99.7K
# Total Submissions: 182.5K
# Testcase Example: '["hello","leetcode"]\n... |
7110d6695d2b10732f697b7b1f3b7458b55c593c | nelsonlove/gpt-utils | /src/gpt_utils/generate_stem.py | 823 | 3.546875 | 4 | from . import GPT
from .prompt import ConversionPrompt
@GPT.requires_key
def generate_stem(in_text):
"""Returns a sentence stem containing the word or phrase and
the appropriate form of the verb "to be"."""
prompt = ConversionPrompt(
'I', 'O',
("Golf", "Golf is..."),
("Beetles", "B... |
ab65ec0da1f5f6d3980f730381efa8603457c66f | DaviMoreira58/PythonExc | /exc009.py | 1,064 | 4.09375 | 4 | #Faça um programa que leia um numero inteiro qualquer e mostre na tela a sua tabuada.
# MEU JEITO
#n1 = int(input('Digite um numero: '))
#n2 = n1 * 1
#n3 = n1 * 2
#n4 = n1 * 3
#n5 = n1 * 4
#n6 = n1 * 5
#n7 = n1 * 6
#n8 = n1 * 7
#n9 = n1 * 8
#n10 = n1 * 9
#n11 = n1 * 10
#print('Tabuada do {}: \n x1: {} \n x2: {} \n x3... |
4e62adeb05d35322c3e31422a080c3e8181c6458 | antdevelopment1/game_of_thrones | /dead_characters.py | 792 | 3.875 | 4 | # Imports text file that we want to retireve infornmation from.
from characters import characters
# Find everyone who is dead.
# Creates a function that takes a parameter.
def is_dead():
# Holds value for number of dead people.
count = 0
# For each dictionary in the characters list. ... |
7e429545dae4ce30e069a5d672f257912b12fc20 | kellybrower/crypto_alg | /sqrtmod.py | 503 | 3.625 | 4 | def sqrtmod(a1, a2, p1, p2):
'''returns the 4 residues from a pair of modulos'''
if p1 % 4 == 3 and p2 % 4 == 3:
x = pow(a1, (p1+1)//4,p1)
neg_x = -pow(a1, (p1+1)//4, p1)
y = pow(a2, (p2+1)//4, p2)
neg_y = -pow(a2, (p2+1)//4, p2)
sqrts = [x, neg_x, y, neg_y]
return sqrts
else:
print('nope')
def squ... |
756c916de01d22adc3f4642a6032c9a00689ac63 | A-khateeb/Full-Stack-Development-Path | /Python/PCC/Chapter10/LearningPython.py | 311 | 3.765625 | 4 | file_path = ("learning_python.txt")
with open(file_path) as file_object:
lines = file_object.read()
print(lines)
with open(file_path) as file_object:
for i in file_object:
print(i)
with open(file_path) as file_object:
lines = file_object.readlines()
for i in lines:
print(i)
|
d4c7d7b137ee81ec21ec3a24f2f644390af1ce13 | leetcode-notes/daily-algorithms-practice | /leetcode/771_jewels_stones.py | 455 | 3.609375 | 4 | from collections import Counter
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
counts = Counter(J)
jewels = 0
for c in S:
if c in counts:
jewels += 1
return jewels
'''
Success
Details
Runtime: 40 ms, faster than 21.61% of Python3
M... |
d12d25e80e3d90a47a5870a1f86ec5f0ad420138 | annettefo/praetorian_py | /refresher_python/modularized.py | 826 | 3.734375 | 4 | import random
import sys
import os
#OBJECT ORIENTED PROGRAMMING, ATTRIBUTES. CLASSES
class Animal:
def __init__(self, name, height, weight, sound):
self.name = name
self.height = height
self.weight = weight
self.sound = sound
def __str__(self):
return "{} is {} cm tall ... |
6566f7db9e36f2eec484762be952760d8bec67ac | ljrdemail/AID1810 | /OOP/Day01/classdemo.py | 421 | 3.625 | 4 | # -*- coding:utf-8 -*-
class Dog:
pass
dog1 = Dog()
dog2 = [1, 2, 3, 4]
print(dog1, dog2)
print(type(dog1),type(dog2))
#或
print(dog1.__class__,dog2.__class__) # new对象的时候就绑定了 这个对象的类
print(dog1.__class__ is Dog)
dog3=dog1.__class__()#调用构造函数创建一个与dog1 同类的对象
#返回一个新的 dog对象 dog3
print(dog3)
#class 属性就是用来创建此实例的类 |
f27c25e0aa54972757a087cebdf0bfb076ce8df6 | aimalanos/Irtiqa | /Player.py | 64,055 | 3.71875 | 4 | import random
import os
def asOrderedList(d):
ordered = []
for key in d:
ordered.append([key, d[key]])
ordered.sort()
return ordered
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
class Player:
def __init__(self, w):
self.world = w
self.name = input(... |
40182de0518838d13fb0d681b34c8fef730a17f4 | landonholmes/advent-of-code-2020 | /07/1.py | 1,393 | 3.640625 | 4 | from collections import defaultdict
import re
def parse_bag_rules():
rules_parsed = {}
with open('input.txt') as f:
lines = [l.rstrip('\n') for l in f]
for line in lines:
bag_rules_split = line.split(' bags contain')
outer_bag = bag_rules_split[0]
inner_bags = bag_rules_sp... |
77076379449b2dd01d7effb7017e139d1bb50d4e | Lakhankumawat/Hacktoberfest-2020 | /fibanocii_sequence.py | 122 | 3.734375 | 4 | n=int(input("Enter a no:"))
a=0
b=1
print(a)
sum=a+b
print(sum)
for i in range(n):
c=a+b
a=b
b=c
print(c)
|
fe9c1d6d24fd36fce473d3eba4ffd3f140f8fa0e | AdamZhouSE/pythonHomework | /Code/CodeRecords/2369/60627/238732.py | 160 | 3.5 | 4 | # 2
n = int(input())
outp = input()
for in range(n-1):
inp = input()
ind = outp.find(inp[0])
outp = ''.join(list(outp).insert(ind,inp))
print(outp)
|
e11dfcaf1a4a4fbd144a51a0ec82fb248738f2ec | simonsenh/AS91883v1-and-AS91884v1 | /main.py | 2,335 | 4.09375 | 4 | import math
import random
computer_money = 100
your_money = 100
computer_bet = 0
your_bet = 5
add_bet = 0
cards_one = random.randint(1,13)
cards_two = random.randint(1,13)
cards_three = random.randint(1,13)
cards_four = random.randint(1,13)
cards_five = random.randint(1,13)
your_card_one = random.randint(1,13)
your_c... |
5c3a69829099fc99fc02e0338ca5f977abbd31ac | SeanNeilTalbot/The-Start-of-my-Python-Journey | /2.4.Lists.py | 1,112 | 4.28125 | 4 | #Lists.py
#In this section we look at creating lists, Updating lists and Searching Lists
#Creating Lists
guests = ['Christopher','Susan','Bill','Satya']
#Print the first guests, which is in position 0
print(guests[0])
#Print second guest
print(guests[1])
#Print the last entry
print(guests[-1])
sco... |
ac7afc06e47d528adaa8e6aa2e8f79c8740c5890 | kurapatirajiv/HackerRank | /TextWrap.py | 287 | 4 | 4 | # Enter your code here. Read input from STDIN. Print output to STDOUT
# https://www.hackerrank.com/challenges/text-wrap
import textwrap;
# Groups the string into the number given and prints vertically for fill and horizontally for wrap
print textwrap.fill(raw_input(),int(raw_input()));
|
20ae71ca8cd1f58d93de30761efe5bdfd47df309 | stellakaniaru/simple-python-games | /truth_or_dare.py | 3,479 | 4.28125 | 4 | '''A game of truth or dare.'''
from sys import exit
import random
import time
def play():
'''Initiates the game and spells out the instructions of the game.'''
print('''
WELCOME MATES!'
Its time for an awesome game of TRUTH or DARE!'
Each one in the crowd will pick a number and we\'ll do this randomly.'
A num... |
5e6ac8a4217932e92ded7fd103c222dbcfb7bf2c | Srishti20022/Python-basics | /Lists/Question 10.py | 1,282 | 4.40625 | 4 | #Split function
# Syntax
# string-name.split(separator, max-split)
# Returns list of type string
string = "a b c d e f"
print("\n\n\n"+string)
print("Splitting of string with ' ' as separator and no maxsplit : "+str(string.split(" ")))
print("Splitting of string with ' ' as separator and 5 maxsplit : "+str(strin... |
8c7d7e1bd0846341298892ac374e50bcc77b1617 | sharmaji27/InterviewBit-Problems | /Trees/Populate Next Right Pointers Tree.py | 1,603 | 4.3125 | 4 | '''
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
Initially, all next pointers are set to N... |
e51ba3597569cda6d9a5e187eff4b6907926e9f8 | Hujedamej/BwInf39_A1 | /BwInf39_A1.py | 2,408 | 3.5625 | 4 | fname = 'raetsel4.txt'
def read_file(fname):
# reads a file and returns a text string and a word tuple
with open('beispieldaten/'+fname, 'r') as fin:
text = fin.readline().strip().split()
text_list = text.copy()
for i in range(len(text)):
text_list[i] = text_list[i].strip(',... |
adafb40b32572726b549c67be68a57a9cdd62523 | FernandoFalcone-dev/exercicios-Python | /pacote-Download/pythontestes/desafio005.py | 220 | 3.859375 | 4 | ni = int(input('Digite um número: '))
su = ni + 1
ant = ni - 1
print('O sucessor dele é {}'.format(su))
print('O antecessor dele é {}'.format(ant))
#print('O sucessor é {}, seu antecessor é {}'.format((n+1), (n-1)) |
2ec0e2143340588be3d5e396aed905bf9f8f5125 | sarsh11/property-python | /src/helloWorld.py | 3,037 | 3.8125 | 4 | """
def helloWorld(n):
print "Hello World!\n" * n
n = raw_input("Enter n:")
n = int(n)
helloWorld(n)
"""
import datetime
from datetime import *
import time
import pickle
class propertySale:
propertyID = 0
def __init__(self,reserve):
self.reserve = 0
self.reserve = reserve
self.proper... |
39434d5d717661df7dfe6832b7b5e3660daca83e | tjp77/Sequence-Alignment | /Sequence Alignment.py | 3,346 | 3.859375 | 4 | #!/user/bin/python
import sys;
def ReadInSequences():
sequence1 = " ";
sequence2 = " ";
try:
file = open("sequenceData.txt", "r");
sequence1 = file.readline().strip();
sequence2 = file.readline().strip();
except:
print(... |
66455a8d9035c1cd3c604860f116f727b60092cc | hotsun1508/studywithLikeLion | /Classlion/Python/if문.py | 1,111 | 4.0625 | 4 | #제어문: 코드의 흐름을 위부터 아래로 흐르지 않게 제어하는 것
#if문: 컴퓨터에게 선택의 여지와 조건 부여 = 분기문
#if(조건): 다음줄 indent
#참이면 코드 실행
#예제 1
#85점 이상 PASS, 아니면 FAIL
score = int(input("점수를 입력하시오 : "))
if(score>=85):
print("PASS")
else:
print("FAIL")
#예제 2
activity = input("너 동아리 뭐해? ")
if(activity=="멋쟁이사자처럼"):
print("어, 나도 멋사야!")
else:... |
f569504b056cf1be5a76d88d6331a98618524ede | Temirazim/MyFirstPythonExperience_week-3 | /week3/functions.py | 2,111 | 4.09375 | 4 | # №1
# Создайте функцию которая которая берёт лист делит его пополам и обе стороны разворачивает в противоположную сторону. Пример:
# Оригинальный Лист:
# list_1 = ['name', 'age', '1', '19']
# Изменённый Лист:
# list_1 = ['age', 'name', '19', '1']
# def splitandreserved():
# list1 = ['amerika', 'afrika', 'malas... |
e9b11eb5d1f73a10ee734a8adb8af0adfd3d50a1 | piyuhg/pyfiles | /encap1.py | 284 | 3.65625 | 4 | #!/usr/bin/python3
class Shop:
def __init__(self):
self.__maxprice = 900
def sell(self):
print("Selling Price: {}".format(self.__maxprice))
def setMaxprice(self, price):
self.__maxprice = price
c = Shop()
c.sell()
c.__maxprice = 1000
c.sell()
c.setMaxprice(1050)
c.sell()
|
0241cc9486289a7c9e841c15c07fd67136067562 | prisoneer/SideProjects | /ETC/Python_Algorithms/02_Recursion/product_of_two_numbers.py | 505 | 4.3125 | 4 | # Given two numbers, find their product using recursion
x = 500
y = 200
# What is 5 X 3?
# 5 + 5 + 5
# (x=5, y=3)
# if 5 + (5, 2 <- decreasing by 1)
# if 5 + (5, 1 <- decreasing by 1)
# if 5 + (5, 0 == 0 return 0 and break recursion)
def reccursive_multiply(x, y):
# This cuts down on total number of recursion ... |
e4269ccded824158223c7e8f68f4b200a959ba93 | lxyshuai/target-at-offer | /35.复杂链表的复制.py | 2,174 | 3.703125 | 4 | # coding=utf-8
"""
复杂链表的复制
"""
class ComplexListNode(object):
def __init__(self, value, next=None, sibling=None):
self.value = value
self.next = next
self.sibling = sibling
def clone_nodes(head):
"""
复制原始链表的任意节点N并创建新节点N',再把N'链接到N的后面
"""
current_node = head
while curre... |
0cfc260ed239d891a5d259caa65b722494f6c164 | Feynman27/PythonSandbox | /Exercises/code/advertising.py | 1,630 | 3.734375 | 4 | import pandas as pd
from numpy import nan as NA
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
#pd.set_option('display.mpl_style', 'default') # Make the graphs a bit prettier
#plt.rcParams['figure.figsize'] = (15, 5)
dataset = pd.read_csv('/home/thomas/PythonSandbox/data/Advertisi... |
ae49c80ddfeb5a38bbd1087fa5cfe09fb38b1556 | klknet/geeks4geeks | /algorithm/bitwise/multiple_of_9.py | 555 | 4.5 | 4 | """
Check if a number is multiple of 9 using bitwise operators.
n/9 = n/8 - n/72
n/8 = floor(n/8) + (n%8)/8
n/9 = floor(n/8) + (n%8)/8 - (floor(n/8) + (n%8)/8)/9
= floor(n/8) + (floor(n/8) - n%8)/9
From above equation, n is a multiple of 9 only if the expression (floor(n/8) - n%8)/9 is an integer. The sub-express... |
d3585e4cd9e3cbd30f408f5fbb7605397552f763 | flaviasalisboa/coursera-python-usp-parte1 | /Exercicios-Opcionais/sem7-hipotenusa-soma.py | 477 | 3.578125 | 4 | def Hipotenusa(a, b):
hipotenusa = a*a + b*b
return hipotenusa
def soma_hipotenusas(n):
c = 1
soma = 0
while c <= n:
c2 = c*c
a = 1
b = 1
while (a < n):
while (b < n):
if (c2 == Hipotenusa(a, b)):
soma = soma + c... |
0c3ae6cd59bf57b8c6bb2e13e36951e9e06da9e5 | zoeydao/yendao-fundamental-c4e22 | /session3/homework/Study.py | 242 | 4.15625 | 4 | #1. A nested list is a list that appears as an element in another list, example:
nestedlist = [2,5,'phone',['dog','cat']]
print(nestedlist[3])
print(nestedlist[3][0])
#2. A list can store both integers and string
print(*nestedlist, sep = ',') |
9ee6b7631c5fbe8a124ee2364356d3e5f84faece | maia13/aoc-2020 | /day23a/program_lib.py | 919 | 3.796875 | 4 | import re
def calculate(cups, count):
for _ in range(count):
cups = move(cups)
ix1 = cups.index('1')
result = cups[ix1+1:] + cups[0:ix1]
return ''.join(result)
# (3) [8 9 1] 5 4 6 7 {2}
# (3) [8 9 1] {2} 5 4 6 7
# (3) [8 9 1] 5 4 {2} 6 7
def move(cups):
current_cup_label =... |
24ca847746f01960f2a5bb2e4a5fb521bb0a3ce4 | zhaoxuhui/RANSAC-Demo | /3.ransacForLineFitting.py | 8,097 | 3.53125 | 4 | # coding=utf-8
import numpy as np
import random
from matplotlib import pyplot as plt
import math
def default_function(x):
return 2 * x + 4
def getXData(start=0, end=100, interval=1):
"""
generate x data with no noise
:param start:
:param end:
:param interval:
:return:
"""
print... |
936b44b894f30d0ebd06faa5ccd524960b0ea681 | meddles/Super-Tic-Tac-Toe- | /Tic Tac Toe Matrix | 3,629 | 3.796875 | 4 | """Tic Tac Final Here lies all the shit that works. Amen"""
import random
small0 = [0,1,2,3,4,5,6,7,8]
small1 = [0,1,2,3,4,5,6,7,8]
small2 = [0,1,2,3,4,5,6,7,8]
small3 = [0,1,2,3,4,5,6,7,8]
small4 = [0,1,2,3,4,5,6,7,8]
small5 = [0,1,2,3,4,5,6,7,8]
small6 = [0,1,2,3,4,5,6,7,8]
small7 = [0,1,2,3,4,5,6,7,8]
small... |
73682b504612f276522f625424355102dcb4c847 | RonaldSievers/euler | /euler005.py | 530 | 4.03125 | 4 | if __name__ == '__main__':
"""
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
"""
def test_divisibility(n):
for i in... |
803416ef3a7132ac4bab52f6618cef1949bbe7b9 | vijay2705/vijay | /primeornot.py | 181 | 4.15625 | 4 | num=int(raw_input("Enter the number"))
prime=1
i=2
while(i<n):
if(num%i==0):
prime=0
i=i+1
if(prime==1):
print("It is a prime number")
else:
print("it is not a prime number")
|
efe2ad054d07df2ba256c360b4aa247f4c029b0b | adriabaquero/phyton2018 | /ejercicio-bucle-sumar.py | 266 | 3.671875 | 4 | #coding:utf8
#Adrià Baquero
#08/03/18
#Inicializaciones
salir="N"
contador=1
while(salir=="N"):
#Hace cosas
print contador
#Incremento
contador=contador+1
#Activo indicador de salida si hace falta
if(contador>50):#Condición de salida
salir = "S"
|
4c73e2299f6e5686369eeee2113f3761080ce428 | jobafash/InterviewPrep | /educative.io/patterns/top_k_elements/easy1.py | 4,264 | 3.828125 | 4 | '''
Given an unsorted array of numbers, find the ‘K’ largest numbers in it.
Note: For a detailed discussion about different approaches to solve this problem, take a look at Kth Smallest Number.
Example 1:
Input: [3, 1, 5, 12, 2, 11], K = 3
Output: [5, 12, 11]
Example 2:
Input: [5, 12, 11, -1, 12], K = 3
Output: [1... |
eedfc4e1bf3e693fd31c0362d26bf290d99fc852 | MaciekKrz/CodeWars | /sort.py | 128 | 3.546875 | 4 | def solution(nums):
if nums == None:
return []
else:
return sorted(nums)
print(solution([1,2,3,10,5])) |
0c44d62518f412c008fcddb6fb267bcf025e729e | Gigio212/Tarea-02 | /porcentajes.py | 410 | 3.953125 | 4 | #encoding: UTF-8
# Autor:Rodrigo Rivera Salinas, A01375000
# Descripcion: calcular el porcentaje de hombres y mujeres que estan en una clase
# A partir de aquí escribe tu programa
h=int(input("dar cantidad de hombres"))
m=int(input("dar cantidad de mujeres"))
total=h+m
hombres=(h*100)/total
mujeres=(m*100)/total
... |
c1fc9d8f44da31a0a36c4efa2f30ca9985349346 | OdintsovTim/6_password_strength | /password_strength.py | 1,434 | 3.8125 | 4 | def check_lenth_password(password):
if len(password) > 7:
return True
else:
return False
def check_upper_case_in_password(password):
return not password.islower()
def check_lower_case_in_password(password):
return not password.isupper()
def check_digits_in_password(password):
i... |
19492b3cd8635c22b17de9ccefd1df1c1463493e | RodaRolla/1 | /Scripts/btask.py | 939 | 3.515625 | 4 | m=['вася','петя','женя','коля','саша','жора']
f=['надя','маша','саша','света','женя','настя','гертруда']
l=m+f
def nomatch(list):
for i in list:
while list.count(i) > 1:
list.remove(i)
return list
def Two1():
matchList=[]
for i in f:
if i in m:
matchList.append(i)
else:
continue
r... |
ccddae2b6650436f362a83ab9aa33444e3db6a6b | lizhaney/pyscripts | /march.py | 1,133 | 3.71875 | 4 | ## WLratio
## WLratioconf
## conf
## topg
## rank
## mascot
## top25WL
teams = {
"Duke":{
"WLratio": ".5",
"WLconf":".83",
"rank":"2",
"mascot": "Blue Devils",
},
"Villanova":{
"WLratio": ".93",
"WLconf":".88",
"rank":"2",
"mascot": "Wildcats",
},
}
teams.keys()
for team in teams.keys():
print... |
ffc40aae64afa636e0b3ec28515c40e34dadfba5 | sairam-py/CodeForces-1 | /CaseOfTheZerosAndOnes.py | 641 | 3.765625 | 4 | __author__ = 'Devesh Bajpai'
'''
https://codeforces.com/problemset/problem/556/A
Solution: Count the number of 1s and 0s. The absolute difference is the number of digits that would remain.
Reason for this is, since we are removing 1 and 0 together, only the unpaired 1s or 0s will remain.
Interesting problem. Good ... |
60f7df0d296e7ffa495ef1038849309ac24c6512 | YunsongZhang/lintcode-python | /Amazon 2019秋招面试高频题/3 - Amazon 电面 Follow up/105. Copy List with Random Pointer - 1.py | 829 | 3.640625 | 4 | class RandomListNode:
def __init__(self, x):
self.label = x
self.next = None
self.random = None
class Solution:
# @param head: A RandomListNode
# @return: A RandomListNode
def copyRandomList(self, head):
if head is None:
return head
dummy = RandomLi... |
646ace7255ca8d1802be3e175716b1255f47b255 | sidduGIT/Hacker-Rank- | /my_random.py | 524 | 4.21875 | 4 | '''
This problem was asked by Two Sigma.
Using a function rand7() that returns an integer from 1 to 7 (inclusive) with uniform probability, implement a function rand5() that returns an integer from 1 to 5 (inclusive).
'''
import random
while(True):
def rand7(n):
return (random.choice([i for i in range(1,n... |
a17058d78b8caba2a2a33fbf02ec7f50a3006e50 | wedexyz/LR-ML-iinput-pipe | /PIKLE/train_area_model.py | 651 | 3.953125 | 4 | import pandas as pd
from sklearn import linear_model
# load the dataset into memory
training_dataset = pd.read_csv("areas.csv")
# create a model using the linear regression algorithm
# and train it with the data from our csv
regression_model = linear_model.LinearRegression()
print ("Training model...")
# model ... |
ce7392391c077f58d8dc23bcdef0e19f1b126b9b | whoisbma/python-image-book | /ch1/ch1-03-matplotlib_plotting.py | 1,194 | 4.0625 | 4 | # Matplotlib
# matplotlib is a graphics library with more powerful features than the plotting available in PIL.
# Plotting Images, Points, and Lines
# Only a few commands are needed for most computer vision purposes.
# We want to be able to show things like interest points, correspondences, and detected objects us... |
5b2417bdd6b640b7bebc9a9b091bb9b791cd6fea | ianagpawa/nano | /technical/mock/2elements.py | 972 | 3.671875 | 4 | # def adding_up(array, k):
# done = []
# x = 0
# while x < len(array):
# first = array[x]
# if first not in done:
# y = x + 1
# while y < len(array):
# second = array[y]
# if first + second == k:
# return True
# ... |
afb7e05cf09dc3bf460ba8caad28c2f9cf552276 | dvp-git/Core_Python_Pluralsight | /Airtravel.py | 1,814 | 4.09375 | 4 | """ Model for aircraft flights"""
from pprint import pprint as pp
class Flight:
def __init__(self, number):
# Checking the Class-Invariant : Truth about the object that endure for the life of the object
if not number[:2].isalpha():
raise ValueError(f"No airline code in '{number}'... |
35b8233c035478e326f616d9edba29070029908a | jcmurciap/Hangman | /hangman.py | 3,337 | 3.78125 | 4 | import os
import time
import random
def load_data():
with open('data.txt', 'r+', encoding='utf-8') as df:
words = [word for word in df]
return words
def random_name():
'''Pick up just a single word randomness from a list of words'''
random_word = random.choice(load_data())
return random_word
def no... |
65fdc84db890412603153f464e58ba1499bd551e | gautsi/cRedditscore | /cRedditscore/evaluation.py | 10,693 | 3.75 | 4 | # -*- coding: utf-8 -*-
'''
A module of tools to evaluate predictive models.
'''
import numpy as np
import pandas as pd
from sklearn import cross_validation
from sklearn import metrics as skmetrics
class EvalError(Exception):
'''Errors in evaluating the model, for example
a missing predict function.'''
de... |
b717aac65af352ae79e95e2f441789d418376537 | vinsmokemau/Biorobotic | /practice1.py | 3,428 | 3.890625 | 4 | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
# Points of the polygon
x = (7 - 5) * np.random.random(1000) + 5
y = (4 - 2) * np.random.random(1000) + 2
x2 = (9 - 7) * np.random.random(1000) + 7
y2 = (4 - 2) * np.random.random(1000) + 2
x3 = (9 - 7) * np.random.random... |
a216d98b13216db7247bee45ce94eba5d9f244d9 | peterhogan/jelp-website | /test_code/jelp_login_test.py | 479 | 3.890625 | 4 | from getpass import getpass
passphrase = "jasper"
attempts = int(0)
max_tries = int(3)
while attempts <= max_tries:
attempts += 1
left = max_tries-attempts
login = getpass("Please enter the passphrase (attempt %d of %d): " % (attempts, max_tries))
if login == passphrase:
print("Correct! Please continue.")
... |
c6e6c39e05e1919ff8baf104a83bf0b12dd2fcac | phamous2day/rpg_PythonExercises | /bubblesort.py | 486 | 4.03125 | 4 | def bubbleSort(my_array):
for pass_number in range(len(my_array)-1,0,-1):
print "This is pass_number, round: %r" % pass_number
for i in range(pass_number):
if my_array[i]>my_array[i+1]:
temp = my_array[i]
my_array[i] = my_array[i+1]
print ... |
657bf8e31b8b39ddddcf71be0631bae0f18ec254 | Ivan-loaiza/Python_basico_2_2019 | /semana2/tarea 2.py | 680 | 3.59375 | 4 | mis_valores = [5, 6, 10, 13, 3, 4, 7]
sumatoria = 0
promedio = 0
for mi_valor in mis_valores:
sumatoria += mi_valor
promedio = sumatoria / len(mis_valores)
print("La sumatoria de mis valores es: ", sumatoria)
print("La cantidad de mis valores es: ", len(mis_valores))
print("El promedio de mis valores ... |
e3bea92d3d5e4efc0a4e414f28c4eb823cdba9a9 | RenneSA/Aprendendo-Python | /Atividades Continuas/Ac5 linguagem Ex4.py | 214 | 3.59375 | 4 | num = input()
lista = num.split()
limite = int(lista[0])
escolha = int(lista[1])
nomes = []
for x in range(limite):
n = input()
nomes.append(n)
nomes.sort()
escolhido = nomes[escolha - 1]
print(escolhido)
|
e97dd964690835ec587cec6478f3c89b943bea94 | mfcarrasco/Python_GIS | /AdvGIS_Course/CircleClass.py | 1,044 | 4.03125 | 4 | #Exam 2 - Question 1
#Malle Carrasco-Harris
#3/31/16
class Circle: #Class variable created to calculate area and circumference of a circle of a specified radius.
def __init__(self, radius): #initialize class; user provides radius of circle.
self.radius = radius
def area(self): #area method
... |
0bf987e32f2d6950f195e16590deb97d47a91a8a | Jordan-1234/Wave-1 | /UnitsOfTime2.py | 592 | 4.28125 | 4 | #Convert seconds to days, hours, minutes, seconds
seconds_In_A_Minute = 60
seconds_In_A_Hour = 3600
seconds_In_A_Day = 86400
#User input for the number of seconds
seconds = int(input("What is the total amount of seconds: "))
#Find out the days, hours, minutes, seconds
days = seconds // seconds_In_A_Day
seconds = seco... |
a9f12e45947a337c0f4200adb4ac30332c5fef07 | ashisharora24/python_learning | /chapter17_classes_and_objects/old_class_object3.py | 2,074 | 3.875 | 4 | class Tyres:
# class level variables:
objectCount = 0
def __init__(self):
pass
def setTyreCount(self, tyreCount=4):
self.TyreCount = tyreCount
print("method : setTyreCount")
print("id(self.TyreCount) : ", id(self.TyreCount))
print("value(self.TyreCount) : ", sel... |
66cce12b656f839a687fc52878593d7325048e6b | thiagofb84jp/python-exercises | /pythonBook/generalExercises/basic/exercise26.py | 303 | 4.09375 | 4 | """
26. Write a Python program to create a histogram
from a given list of integers.
"""
def histogram(items):
for n in items:
output = ''
times = n
while times > 0:
output += "@"
times -= 1
print(output)
histogram([10, 15, 25, 100])
|
cf85fd4b84e904886759ebdbf52657372bd2dfde | bhoot929/Python-ELT | /Logest_substring_without_repeat.py | 996 | 4.0625 | 4 | '''
Given a string, find the length of the longest substring without repeating characters.
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", which the length is 3.
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Input: "pwwkew"
Output: 3
Explanation: The answer is "wke", w... |
1b9e6effd428d243ba00d7a5188336d87022f590 | portugol/decode | /Algoritmos Traduzidos/Python/Algoritmos traduzidos[Diogo]/ex3.py | 109 | 3.671875 | 4 | a=input('Digite o numero de três casas:')
d=0
d=int(a)/10%10
print('Algarismo na casa das dezenas:',int(d))
|
1d5d9ce1b2137a8cf7d01d3f5a1b11c9bbdc4b5f | aliimran2000/Chess-Engine-AI | /chess-ai/Piece/King.py | 13,051 | 3.765625 | 4 | from Piece.piece import piece
import numpy as np
from copy import copy
# The King is the most important piece. When it is trapped,
# the whole team loses. The King can move one square in any
# direction - for example, to any of the highlighted squares in
# this diagram. (An exception is castling, which is explained
# ... |
59bc04e608171eac57d4a4c56b74fb94fcc7c1f6 | eginwong/coding-bat-scratch-pad | /python/warmup-2/string_match.py | 541 | 4 | 4 | # Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa", and "az" substrings appear in the same place in both strings.
def string_match(a, b):
counter = 0
string_a = len(a)
string_b = len(b)
maxNum =... |
48d36f79a8d5dbfd956cdc48c68d09a21ff94c19 | simmoncn/ml-class-python | /solutions/ex8/ex8_cofi.py | 7,541 | 3.734375 | 4 | import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from scipy import optimize
from ex8_utility import *
## Machine Learning Online Class - Exercise 8: Anomaly Detection and Collaborative Filtering
# Instructions
# ------------
#
# This file contains code that helps you get started on the
# ... |
c8086638310edd56c0c00ecfe9b297a5b63d38ba | miguelesli/Prueba-Python | /D3/Ej06D3FOR.py | 723 | 3.953125 | 4 | ##range no acepta flotas, solo int
"""
print ("comienzo")
for i in [0.1,2]:
print("hola")
for i in range(5):
print(i)
print("......")
for i in range(4, 10, 2):
print(i)
print ("......")
for i in range(3):
print ("hola")
a =5
for a in range(a):
print ("holll")
for ... |
b80270dc02ba91563f202a698d46dfafa0da4ebf | MuhamadNawzad/Beginner-projects | /Guess a number.py | 508 | 3.765625 | 4 | import random
command = "Y"
secret_number = random.randint(1, 100)
counter = 1
while command == "Y":
guess = int(input("Guess:"))
if guess == secret_number:
print(f"You won in {counter} times.")
command = input("Continue? (Y/N)").upper()
secret_number = random.randint(1, 100)
... |
dfdfa0bf8b62cc2677f5cc50b0b4fd7aafc26519 | SupJani/CRS | /table.py | 986 | 3.625 | 4 | import tkinter as tk
win=tk.Tk()
win.title('Tk GUI')
cols=['GRE score','University rating','university_name']
data = [ ["322", "3", "Carlie melon university"],
["321", "3", "Chicago university"],
["321", "3", "RIT university"],
["321", "3", "North carolina"],
["321", "3", "New york... |
f436a5af4ae71a75074a64974d4794525463d7f0 | balaramkantipudi/InterviewBit-1 | /Two Pointers/REMELM.py | 491 | 3.703125 | 4 | __author__ = 'Vivek'
#Given an array and a value, remove all the instances of that value in the array.
#if array A is [4, 1, 1, 2, 1, 3]
#and value elem is 1,
#then new length is 3, and A is now [4, 2, 3]
def removeElement(A, B):
i = 1
j = 0
if A[0] == B :
j = -1
while i < le... |
90764864ad872f85b6f6c2d789e9b00c560532be | enkumamoto/exercicios-python | /Exercícios - Python.org.br/EstruturaDeDecisao/exercicio 24.py | 1,706 | 4.34375 | 4 |
'''
Faça um Programa que leia 2 números e em seguida pergunte ao usuário qual operação ele deseja realizar. O resultado da
operação deve ser acompanhado de uma frase que diga se o número é:
par ou ímpar;
positivo ou negativo;
inteiro ou decimal.
'''
def decint ():
if num1 == 0:
return 'Oh, ¬¬ ... |
52115afa20fb10d245bef6d3fdd9eb06d7fb8eb1 | khalidprogrammer/python_tuts | /construct_Opp.py | 787 | 4.375 | 4 | # contructor is a magic method whenever we create
# object constructor method is called if you want
# some argument in Class so you can use constructor
class Employee:
no_of_leaves = 8
def __init__(self, name, salary, role):
self.name = name
self.salary = salary
self.role = role
d... |
0e3485d3f5f04e82d2a51e1da74652215d575642 | Bebounet/babel-bebounet | /input2/second.py | 2,947 | 4.1875 | 4 | # Premier traitement
# print(names)
# print(type(names))
# print(len(names))
import re
F_FIRST = "firstname"
F_LAST = "lastname"
F_MIDDLE = "middlename"
F_FULL = "fullname"
F_ERROR = "error"
def manage_input():
in_fullname = input("Quel est votre nom et prénom ? ")
print(in_fullname)
validate_display(in... |
af0f725044f568332269d2e1a9b9f9b500ec02a2 | ivenpoker/Python-Projects | /Projects/Project 0/Lists/Nested-List.py | 1,013 | 3.78125 | 4 | #!/usr/bin/env python3
#: Program Purpose: See https://www.hackerrank.com/challenges/nested-list/submissions/code/94724341
#: Program Author : Happi Yvan <ivenstienpoker@gmail.com>
#: Program Date : 11/04/2019
def score(_stud):
return _stud[-1]
def name(_stud):
return str.lower(_stud[0])
def main... |
f8ca70b49c8f74d05bf437c56c3b32332fd93289 | ajaychacko98/HangMan | /main.py | 1,096 | 3.796875 | 4 | from file import *
#
# x = random.randint(0, 3)
# q = ("apple", "banana", "capsule", "destiny")
# print("*")
# n=input()
# l=len(n)
# s=""
# print(n)
# for i in range(l):
# s=s+str((chr(ord(n[i])+1)))
# print(s)
# print("\n" + str(q[x]))
# print(schan(n,0,"s"))
# print(schan(n,l-1,"s"))
# print(schan(n,2,"s"))... |
29606aeb36fe94bf9bb6d137b5144369bc76960b | d1rtyst4r/archivetempLearningPythonGPDVWA | /Chapter06/Tasks/cities.py | 521 | 3.953125 | 4 | cities = {
'london': {
'country': 'great britain',
'population': 1000000,
'river': 'thames'
},
'riga': {
'country': 'latvia',
'population': 800000,
'river': 'daugava'
},
'moscow': {
'country': 'russia',
'population': 12000000,
'... |
7d5e3d3088db9a0654c339a610fbaf3f3a33e5ff | moon0331/FluentPython | /2장. 데이터 구조체/2.9 리스트가 답이 아닐 때.py | 1,352 | 3.65625 | 4 | # 실수 천만개 -> array
# FIFO나 LIFO - deque
# 'item in my_collection' 많이 쓰고 항목 수가 많다 -> set
# array
from array import array
from random import random
floats = array('d', (random() for i in range(10**7)))
print(floats[-1])
fp=open('floats.bin', 'wb')
floats.tofile(fp)
fp.close()
floats2 = array('d')
fp = open('floats.bin'... |
94cf5c6dd76aba2106948a25d980e1c59ce4fb3f | Dan609/code_learn | /classes.py | 1,739 | 4.21875 | 4 | # -*- coding: utf-8 -*-
# This is a simplest class
class Car:
pass
c = Car()
print(c, type(c))
# Classes can have variables called fields
class Room:
number = 'Room 34'
floor = 4
r = Room()
r1 = Room()
print(r.number, r1.number)
print(r.floor, r1.floor)
# You can modify val... |
62fe572214f83c9c0b44fc067ed400a49da5d946 | dknevermore/-day9---day20 | /5 while .py | 76 | 3.59375 | 4 | n = 0
while n < 10 :
print("我想看看有几行")
n = n + 1
print('END') |
f346059494bc10911b1c075611559b98c13e5a75 | MarcosFantastico/Python | /Exercicios/ex048.py | 445 | 3.625 | 4 | from emoji import emojize
print(emojize('Soma de ímpares multiplos de :three: entre 1_500', use_aliases=True))
s = 0
valores = 0
print('Os ímpares múltiplos de 3 são:')
for c in range(1, 501, 2):
if c % 3 == 0:
s += c
valores += 1
'''for c in range(3, 501, 3):
if c % 2 != 0:
s... |
7c47fbc685e20951a35e185fd4704c323d69cd42 | qwdrg826/Netology_course | /For Dummers/xor_code.py | 1,588 | 3.875 | 4 | '''
Написать функцию XOR_cipher, принимающая 2 аргумента: строку, которую нужно зашифровать, и ключ шифрования, которая
возвращает строку, зашифрованную путем применения функции XOR (^) над символами строки с ключом. Написать также функцию
XOR_uncipher, которая по зашифрованной строке и ключу восстанавливает исходную ... |
47ffd329190b7ac139c6f48ecd3dbde6eb889407 | Royal-Milk-Tea/IntroToProgramming | /w3Resource/22Count4.py | 179 | 3.921875 | 4 | #!/usr/bin/env python
# 22. Write a Python program to count the number 4 in a given list.
#This counts how many times '4' is listed.
#w3resource 22/10/2020
n = (input())
|
54e70cfe281a3727dabfc7a97da7f23aa3739b47 | tomgonzo/Learning-PY | /10-Hangman/hangman.py | 1,950 | 4.1875 | 4 | #Hangman game!
import random
wordlist = ["wakeful", "determined", "cup", \
"camp", "harass", "maddening", "buzz", \
"eminent", "hydrant", "bubble",
"complex", "coach"]
picker = random.randint(0,(len(wordlist) - 1))
chosen = wordlist[picker]
#The hangman function stores the game.
def hangman(word): #It ... |
81db80a57cc962b6fad6d8279effb3fc575c4710 | faille/repo1 | /git21bislistopenfile.py | 224 | 3.703125 | 4 | numbers_file = open("file_2.txt", "r")
numbers_str = numbers_file.readlines()
numbers_file.close()
numbers = []
for number in numbers_str:
numbers.append(int(number))
print(f"Min: {min(numbers)}, Max: {max(numbers)}") |
b3706cdefa526778ffdb88e8a8594ad20b5388c8 | HeimerR/holbertonschool-higher_level_programming | /0x0B-python-input_output/4-append_write.py | 302 | 4.25 | 4 | #!/usr/bin/python3
"""module
append to a text file
"""
def append_write(filename="", text=""):
""" appends a string to a text file (UTF8) and returns
the number of characters added
"""
with open(filename, encoding="utf-8", mode="a") as my_file:
return my_file.write(text)
|
e96b4e75484023aa20998c16a29c81838abec5c8 | Hikareee/Phyton-exercise | /Function assignment/Weight_on_planet.py | 394 | 3.578125 | 4 | #declare a function "calc_weight_on_planet accepting 2 "
def calc_weight_on_planet(woe,sgop = 23.1):
#earth gravity
earthG = 9.8
#find mass through w = m * g
mass = woe / earthG
#find the weight on the plannet
w = mass * sgop
#return the weight
return w
#store the value in a variable "re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.