blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
2c449fb5a086b32711f6ad4d74c23549191222e6 | LQR471814/Curve-Tortoise | /renderer.py | 460 | 3.75 | 4 | import turtle
from bezier import *
from common.types import *
def draw(t: turtle.Turtle, scale: int, bezier_points: List[Line], steps: int = 20, closed: bool = False):
# ? Go to starting position
t.penup()
t.goto(bezier_points[0].p1.x * scale, bezier_points[0].p1.y * scale)
t.pendown()
points = ... |
42f37b58b8e3b4583208ea054d30bef34040a6ed | inshaal/cbse_cs-ch2 | /lastquest_funcoverload_Q18_ncert.py | 1,152 | 4.1875 | 4 | """FUNCTION OVERLOADING IS NOT POSSIBLE IN PYTHON"""
"""However, if it was possible, the following code would work."""
def volume(a): #For volume of cube
vol=a**3
print vol, "is volume of cube"
def volume(a,b,c): #volume of cuboid |b-height
vol=a*b*c
print vol, "is volume of cuboid"
def volume(... |
51a882936fb34b9cb740408a72a6d64ce910a796 | Leonardo612/leonardo_entra21 | /exercicio_01/listar_pessoas.py | 654 | 3.84375 | 4 | """
--- Exercício 3 - Funções
--- Escreva uma função para listar pessoas cadastradas:
--- a função deve retornar todas as pessoas cadastradas na função do ex1
--- Escreva uma função para exibi uma pessoa específica:
a função deve retornar uma pessoa cadastrada na função do ex1 filtrando por id
"""
from c... |
6335c93ef76e37891cee92c97be29814aa91eb21 | Leonardo612/leonardo_entra21 | /exercicio_01/cadastrando_pessoas.py | 992 | 4.125 | 4 | """
--- Exercício 1 - Funções
--- Escreva uma função para cadastro de pessoa:
--- a função deve receber três parâmetros, nome, sobrenome e idade
--- a função deve salvar os dados da pessoa em uma lista com escopo global
--- a função deve permitir o cadastro apenas de pessoas com idade igual ou super... |
4208552adfa03bd0d8486192ed9d3206162d64e2 | David-Roy-JCU/prac_04 | /lists_warmup.py | 434 | 3.6875 | 4 | """
prac 04 - Lists
"""
numbers = [3, 1, 4, 1, 5, 9, 2]
# 3 /
# 2 /
# 1 /
# ? x slices the last value off and returns the list
# ? x andswer is 1. it defines a range? look this up!
# True /
# False /
# False /
# [3, 1, 4, 1, 5, 9, 2, 6, 5, 3] /
numbers[0]
numbers[-1]
numbers[3]
numbers[:-1]
numbers[3:4]
5 in numb... |
32ca4261b3d5c5e48e802957f0a6931b3d9d60d0 | luodonghua/PythonProgrammingLanguage | /6.2_reader.py | 1,207 | 3.765625 | 4 | # reader.py
import csv
def read_csv(filename, types, *, errors='warn'):
'''
Read the CSV with type conversion into a list of dictionary
'''
if errors not in {'warn', 'silent', 'raise'}:
raise ValueError("errors must be in one of 'warn', 'silent', 'raise'")
records = [] # list of reco... |
569cbdc1106f4f881cd492749f3d3b8042d3782d | tgtiweird/KTaNE-TASer | /Python/Sorting.py | 38,040 | 3.9375 | 4 | sort=input("what sort (use full caps)\n")
if sort!="BOGO":
first,second,third,fourth,fifth=int(input("what number in pos 1 (either 1/2 digits) \n")),int(input("what number in pos 2\n")),int(input("what number in pos 3\n")),int(input("what number in pos 4\n")),int(input("what number in pos 5\n"))
tens1,tens2,tens3,t... |
3b9e9d2cf8d4818b101268e4c3953e72d2cc1030 | gabrielfrimodig/Python-2--Add-view | /dictionaries.py | 714 | 3.765625 | 4 | # -*- coding: utf-8 -*-
"""
@author: gabriel
"""
users = {"nisse":"apa", "bosse":"ko", "stina":"t-rex"}
data = {"nisse":["luva", "vante"], "bosse":["spik", "skruv", "hammare"], "stina":["tidsmaskin"]}
print("Användare:")
for (x, y) in users.items():
print(x)
print("\nAnvändare och Lösenord:")... |
b497a67b0a0a3a0e145d12a40fe35bbd3fb05e62 | megrao/DP-1 | /HouseRobber.py | 1,797 | 3.671875 | 4 | """
Problem2 (https://leetcode.com/problems/house-robber/)
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically co... |
4cdf3ebc7fec6a40476b2ca90e5a94c35965c398 | ALTI-PRO/Tic-Tac-Toe | /Tic_Tac_Toe.py | 4,872 | 4 | 4 | #Combining Everything
from IPython.display import clear_output
import random
def display_board(board):
'''
Display the board
'''
clear_output()
print(' | |')
print(board[7]+' | '+board[8]+' | '+board[9])
print(' | |')
print ('----... |
2e93a17e1a4dd98601a86e43c69478b15ad3a15a | vijiang/507_collab_test | /prog.py | 142 | 3.5625 | 4 | import random
def num_vowels(s):
vowels=0
for letter in s:
if letter in [a,e,i,o,u]:
vowels+=1
print(vowels)
|
0d6c7873bebb2346661f55584ee6d735e34b4f82 | eunnah/fizzbuzz | /fizzbuzz.py | 513 | 3.890625 | 4 | import sys
try:
n = sys.argv[1]
except IndexError:
n = input("Enter something, yo! ")
while type(n) != int:
try:
n = int(n)
except ValueError:
n = input("Enter something, yo! ")
print("Fizz buzz counting up to " + str(n))
counter = 0
for counter in range(1,n+1):
if counter % 3 =... |
ac82eae64050ab1efbac63f893a9744502851967 | GanMan78/MachineLearning | /Matplotlib/Students Data/Matplot.py | 1,552 | 3.96875 | 4 |
import pandas as pd
import matplotlib.pyplot as plt
def main():
Line="*"*60
excel='StudentData.xlsx'
data=pd.read_excel(excel)
print(Line)
print("Size of the data is: ",data.shape)
print("All data of excel sheet")
print(Line)
print(data)
print(Line)
print("F... |
b3cfb72146e76d321d5cbe2c90dd6367eb3b2c76 | AfSIS-at-CIESIN/RemoteSensing | /meters-degrees-conversion/meters-degree.py | 251 | 4.0625 | 4 | ##meters-degree.py
##written by Kimberly Peng
##date: 2015
##this script converts meters to decimal degrees
met=input("What is the meter resolution? Enter>>")
meters=float(met)
sec=meters*(1/30.87)
deg=sec/3600
print("Approximate decimal degrees is", deg)
|
198c9bb65c0464de64709d56dd2ca14e837c0ca7 | captainamerica23/6.00.1x | /w4.ps.q9.py | 986 | 3.84375 | 4 | hand_choice = ''
hand = ''
while True:
hand_choice = raw_input('Enter n to deal a new hand, r to replay the last hand, or e to end game: ')
if hand_choice == 'e':
break
elif hand_choice != 'n' and hand_choice != 'r':
print "Invalid command."
contin... |
c2242fd5c052f01c624059e87c5dd795b935e6d0 | Palash144/60-LED-Build-Light-Board | /showBuild.py | 2,702 | 3.609375 | 4 | # NeoPixel build board control
# Author Ben Janos (bjanos@gmail.com)
#
# Uses the rpi_ws281x library to control the LEDs
# Get it here - https://github.com/jgarff/rpi_ws281x
#
# This program assumes you have a file (status.txt) that contains
# the color of each pixel row by row. 6 colors in each row with
# 10 rows tot... |
a51dbfde20535bf25df91451cbb7d02731c865c7 | gibson20g/faculdade_exercicios | /moda_2.py | 190 | 3.546875 | 4 | import statistics
amostra = []
while True:
n = int(input('Digite Valores de 0 a 10 varias vezes: '))
amostra += [n]
if n == 0:
break
moda = statistics.mode(amostra)
print('Moda', moda)
|
e4e48753c17246d173832d2d5f5bb352cb901301 | gibson20g/faculdade_exercicios | /venda_de_combustivel_ex03.py | 1,482 | 4 | 4 | print('''Escolha o Tipo de Combustivel\nD - Diesel\nE - Etanol\nG - Gasolina''')
combustivel = str(input('Escolha: '))
litros = float(input('Quantos Litros: '))
diesel = 4.486
etanol = 4.719
gasolina = 5.793
if combustivel == 'D' and 20 >= litros:
tot = diesel * litros
desc = tot - (tot * 0.02)
print('O total de con... |
7a7c57df27e9ebe41ca43971eb19227ff9cec091 | gibson20g/faculdade_exercicios | /NotasBimestrais.py | 310 | 3.921875 | 4 | print("Você devera fornecer suas notas"),
nota1b = float(input("Insira nota do 1 Bimestre: "))
nota2b = float(input("Insira nota do 2 Bimestre: "))
nota3b = float(input("Insira nota do 3 Bimestre: "))
media = nota1b + nota2b + nota3b / 3
print("Sua média é: {} Aprovado".format(media)),
print("Nota: {} ")
|
6fbc27a3112849fca46676213facbd3d6edaff29 | ejrach/my-python-utilities | /ResistorConverter/resistor-converter.py | 6,426 | 3.75 | 4 | # This script will allow you to:
# 1. Choose by 4 color bands (tell me a value)
# 2. Choose by value (tell me colors)
# TODO:
# make it easier to read the ohm value. for example:
# 300000000 --> 300,000,000 ohms.
# or 300000000 --> 300M ohms
# currently the value is printed as: 300000000.0
from os import system
i... |
4b276fb67a33eeb3940e9dc510fb7ac004b3d0e0 | SaimonFury/lesson1 | /numbers.py | 83 | 3.5 | 4 | v = int(input('Введите число от 1 до 10: '))
x = 10 + v
print(x)
|
054305fbabef5221e1ad0f1a3139941c748e6945 | boopalanjayaraman/DataStructures_Algorithms | /Big O Analysis - Project 01/Task2.py | 1,549 | 4.09375 | 4 | """
Read file into texts and calls.
It's ok if you don't understand how to read files
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
TASK 2: Which telephone number spent the ... |
794ec7622144b5ae53726ece289440cb4ff9599a | boopalanjayaraman/DataStructures_Algorithms | /Data Structure Scenarios/LRUCache.py | 2,425 | 4 | 4 | # ordered dictionary preserves the order of items in which they were inserted
# To know the least accessed item, we can remove the item and re-add it whenever it is accessed
# In that way, even unaccessed items will be ordered in the least-used fashion
from collections import OrderedDict
class LRU_cache(object):
... |
50c9f9833fa4cc542158bc31e1fef57033cbeb30 | samhaug/Linux_class | /pandas_intro/pandas_demo.py | 3,138 | 3.65625 | 4 | #!/home/samhaug/anaconda2/bin/python
'''
==============================================================================
File Name : pandas_demo.py
Purpose : Introduce some basic pandas functionalities
Creation Date : 14-02-2018
Last Modified : Wed 14 Feb 2018 01:00:08 PM EST
Created By : Samuel M. Haugland
==========... |
109d7adc06ec9c8d52fde5743dbea7ffb262ab33 | edenizk/python_ex | /dict.py | 1,321 | 4.21875 | 4 | def main():
elements = {"hydrogen": 1, "helium": 2, "carbon": 6}
print("print the value mapped to 'helium'",elements["helium"]) # print the value mapped to "helium"
elements["lithium"] = 3 # insert "lithium" with a value of 3 into the dictionary
print("elements = ",elements)
print("is there carb... |
2d534e5720d00c8c0f3e80d308844c65f2f5c15c | edenizk/python_ex | /gandalf exercises/4.1 guessing game.py | 463 | 3.90625 | 4 | import random
def game():
i=0
n=int(input('n='))
rand=random.randrange(1,n)
while True:
a=int(input('guess the num: '))
if a==rand:
print('number was:',rand ,'\nYou guess correctly in ',i,'times')
break;
elif a>rand:
print('guess again it ... |
579a2fbc1f237e1207be37752963d17f2011b629 | edenizk/python_ex | /ifstatement.py | 866 | 4.15625 | 4 | def main():
phone_balance = 10
bank_balance = 50
if phone_balance < 10:
phone_balance += 10
bank_balance -= 10
print(phone_balance)
print(bank_balance)
number = 145
if number % 2 == 0:
print("Number " + str(number) + " is even.")
else:
print("Number "... |
ddfe6ed0932774f70f31c50121a5334d6e8f16bb | edenizk/python_ex | /hackerrank exercises/Nested Lists.py | 702 | 3.515625 | 4 | students = []
for _ in range(int(input())):
name = input()
score = float(input())
students.append([name,score])
#studets.sort()
#print(students[0][1])
tmp1 = students[0][1]
#tmp2 = students[0][0]
for i in range(1, len(students)):
if tmp1 > students[i][1]:
tmp1 = students[i][1]
... |
44c7a70129b725ee4e9d18cf3d4b46e510d32360 | edenizk/python_ex | /gandalf exercises/3.5.1 - 3.5.2 - 3.5.3 dictionary database with zip.py | 691 | 3.625 | 4 | def zipdic(sentence,a,b,c,d,e):
print(sentence['what'][a%2],sentence['who'][b%3],
sentence['how'][c%2],sentence['do'][d%2],
sentence['where'][e%3])
def main():
sentence=dict(zip(['what','who','how','do','where'],[
['What what','Stray'],
... |
85e4355c82cb4f32f161d66b0222c379629f84cb | edenizk/python_ex | /gandalf exercises/4.3 random matrix generetor2.py | 257 | 3.875 | 4 | import random
Matrix = lambda r,c,k: [[ random.randrange(1,k) for x in range(c)] for y in range(r)]
def main():
c=int(input('choose columns= '))
r=int(input('choose rows= '))
k=int(input('range of k= '))
print(Matrix(r, c, k))
main()
|
020ce80ddb7b5e8a2d8df3bb3550202502b9ba53 | vani33/PycharmProjects | /DuckTyping.py | 1,495 | 3.515625 | 4 | # class Duck:
# def quack(self):
# print('Quack, Quack....')
#
#
# class Monkey:
# def talk(self):
# print('monkey talking like a duck: Quack,Quack...')
#
#
# def invoke_quack(object):
# #Non-Pythonic code
# if hasattr(object,'quack'):
# if callable(object.quack()):
... |
711a105d564748f35250b9a02b4e8dae71c45f82 | MaiadeOlive/Curso-Python3 | /desafios-1mundo-01-35/D004 ANALISE VARIAVEL.py | 500 | 3.671875 | 4 | t = input('\033[;31mDigite algo: \033[m')
print('\033[0;34mO tipo primitivo deste valor é \033[m', type(t))
print('\033[32mSó tem espaços?\033[m', t.isspace())
print('\033[33mÉ numérico? \033[m', t.isnumeric())
print('\033[35mÉ Alphabético? \033[m', t.isalpha())
print('\033[36mÉ Alphanumérico? \033[m', t.isalnum())
pri... |
5f73caf286d67b1b6f2085ab7a74769cf22ce6b4 | MaiadeOlive/Curso-Python3 | /desafios-2mundo-36-71/D058 ADIVINHANDO WHILE.py | 329 | 3.8125 | 4 | import random
cont = 0
print('---JOGO DA ADIVINHAÇÃO---')
num = int(input('Digite seu palpite de 1 a 10: '))
a = (1, 11)
l = random.choice(a)
while a != l:
cont = cont + 1
a = int(input('Tente novamente: '))
print('Bingo" \nO número {} que você escolheu esta correto!\nVocê levou {} tentativas!'.format(a,cont... |
2b4684ed6de37e89afacdac8c2c4061b57061706 | MaiadeOlive/Curso-Python3 | /desafios-1mundo-01-35/D008 CONVERSÃO METROS EM CM,MM.py | 176 | 3.65625 | 4 | a = int(input('\033[1;4;34mQuantos metros tem sua rua? \033[m'))
a1 = a
a2 = a
print('\033[1;4;35mSua rua tem {} metros, são {:.3f} cm e {:.4f} mm\033[m'.format(a, a1, a2))
|
627141b086b05f0738ad0821f1c7765ed47c5953 | MaiadeOlive/Curso-Python3 | /desafios-2mundo-36-71/D056 NOME, IDADE E SEXO.py | 1,132 | 3.65625 | 4 | somaidade = 0
mediaidade = 0
nomehomem = 0
idadehomem = 0
mulhermenos20 = 0
for c in range(1, 5):
print('-----{}° PESSOA -----'.format(c))
nome = str(input('Digite seu nome: ').strip())
idade = int(input('Digite sua idade: '))
generosex = str(input('Digite seu sexo [M/F]: ').strip())
somaidade += ... |
9f7254b1bfca544762ff533cc4f2bc179b2aa65a | MaiadeOlive/Curso-Python3 | /desafios-1mundo-01-35/D028 ADIVINHANDO NUMEROS.py | 191 | 3.671875 | 4 | import random
a = (0,1,2,3,4,5)
l = random.choice(a)
m = int(input("De 0 a 5 qual seria sua aposta? "))
if l == m:
print("Caramba acertou!!!")
else:
print('Não foi dessa vez!')
|
39737ae12d5bdc8fc518727dd45b25f207bb49c9 | katherinelamb/data | /scripts/us_cdc/environmental_health_toxicology/parse_precipitation_index.py | 3,427 | 3.6875 | 4 | # Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
6e192fdced74582346095cf118bf5a33f3bea869 | davidnuna/Manga-Reminder | /domain.py | 1,040 | 3.671875 | 4 | class Manga(object):
def __init__(self, name, chapter, website):
self.name = name
self.chapter = int(chapter)
self.website = website
def __str__(self):
return str(self.name + ", " + str(self.chapter) + ", " + self.website + "\n")
@staticmethod
def read_from_file(line):
... |
ef951139419318682deb52d24fdfd10979eb1fe9 | Conorrific/DC-python-3 | /assignments/Fizz.py | 273 | 4 | 4 | num = int(input("Enter a number: "))
def game():
if num % 3 == 0 and num % 5 == 0:
print("Fizz Buzz")
elif num % 3 == 0:
print(f"Fizz")
elif num % 5 == 0:
print(f"Buzz")
else:
print("Invalid number, sorry!")
game() |
df91ffbf1bb904cdfeb319a9c104f3f243affd27 | arvindsaripalli/regret-coin | /regret-coin.py | 2,592 | 3.546875 | 4 | import requests
import json
import datetime
import sys
def get_current_rate():
current_price = 'https://api.coindesk.com/v1/bpi/currentprice.json'
response = requests.get(current_price)
data = json.loads(response.content)
# Clean returned rate of comma
rate = data['bpi']['USD']['rate'].split(",")
if(len(rate... |
af6678ae4824f149d21d7f3aa3e2ff2abc581102 | jimmahoney/umber | /src/model.py | 72,913 | 3.578125 | 4 | """
model.py
The data class definitons and methods,
built on the pewee ORM with a sqlite3 database.
The following tests assumes that the database has been created
and that populate_database() has been run; see ../database/init_db.
The script ../bin/umber_test runs these and other tests.
# Find the people ... |
955eaaa6b0dbfe5c45a89a75963e50124e75d634 | MrrRaph/BMP-Processing | /processors/printers/printHistogram.py | 1,286 | 3.75 | 4 | from matplotlib import pyplot as plt
import numpy as np
def printHistogram(bmp):
"""
Print the histogram of colors of the bmp file using Matplotlib
Parameters
----------
bmp: BMP
"""
flattenedImage = bmp.imageData[:, :, :].flatten()
blueFlattened = bmp.imageData[:, :, 0... |
503c4e19158dde13eb6294e781fa4d63e5799ee1 | MrrRaph/BMP-Processing | /processors/transformers/imageScale.py | 629 | 3.5625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from utils import helpers as hp
import numpy as np
def scale(image, nR, nC):
nR0 = len(image)
nC0 = len(image[0])
return [
[
image[int(nR0 * r / nR)][int(nC0 * c / nC)] for c in range(nC)
] for r in range(nR)
]
def imageScale(... |
c38d238de26c17699a4c27e7ae0458e5f9accb89 | vatsaashwin/Trees-3 | /symmetricTree.py | 1,469 | 4 | 4 | # // Time Complexity : O(n), n = number of elements
# // Space Complexity : O(maxdepth)
# // Did this code successfully run on Leetcode : Yes
# // Any problem you faced while coding this : No
# // Your code here along with comments explaining your approach
# Definition for a binary tree node.
# class TreeNode:
# ... |
7e232ffae79030cc86662e4ca6b5b8fc40d494d2 | uni4/research | /shading2.py | 590 | 3.6875 | 4 | #画像にガウシアンフィルターを適用させるプログラム
#https://algorithm.joho.info/programming/python/opencv-gaussian-filter-py/
import cv2
import numpy as np
#def main():
# 入力画像を読み込み
img = cv2.imread("org.jpg")
# グレースケール変換
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
# 方法3
dst3 = cv2.GaussianBlur(gray, ksize=(3,3), sigmaX=1.3)
#画像を表... |
2f58dc3a9b0dbb2f2d8a5ad63fe3aef2ce421e12 | Safe-Shammout/Python_Assesment | /main.py | 15,445 | 3.515625 | 4 | #Story line game
#Safe Shammout 2021
from tkinter import * # for GUI and widgets
from PIL import ImageTk, Image # for Images
from tkinter import messagebox # for error messages (diagnose and recover)
# variables
names_list = [] # list to store names for leader board
# Componenet 1 (Game Starter Window object) ... |
b404e386aa86f7e7a8abfdbbfb1a7e678920e420 | sn-lvpthe/CirquePy | /02-loops/fizzbuzz.py | 680 | 4.15625 | 4 |
print ("Dit is het FIZZBUZZ spel!")
end = input("""\nWe gaan even na of een getal deelbaar is door 3 OF 5 .\nOf door 3 EN 5.\n
Geef een geheel getal in tussen 1 en 100: """)
# try-except statement:
# if the code inside try fails, the program automatically goes to the except part.
try:
end = int(end) # convert ... |
1fb7b06f3ed69f53268c4b1f6fc0a39702f8274c | mishra-atul5001/Python-Exercises | /Search.py | 574 | 4.15625 | 4 | Stringy = '''
Suyash: Why are you wearing your pajamas?
Atul: [chuckles] These aren't pajamas! It's a warm-up suit.
Suyash: What are you warming up for Bro..!!?
Atul: Stuff.
Suyash: What sort of stuff?
Atul: Super-cool stuff you wouldn't understand.
Suyash: Like sleeping?
Atul: THEY ARE NOT PAJAMAS!
'''
print(Stringy)
... |
4271d1c657889264d3238286f3cbaa2a128eedef | laxminagln/Neural-Networks-and-Deep-Learning | /Logistic Regression with a Neural Network mindset.py | 24,127 | 4.34375 | 4 | Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning.
Instructions:
Do not use loops (for/while) in y... |
91512810a131c61f9d4013e6915ca8acb84591aa | thorsteinn17/Assignment-5 | /assigment5-2.py | 379 | 3.96875 | 4 |
n = int(input("Enter the length of the sequence: ")) # Do not change this line
number_1 = 1
number_2 = 2
number_3 = 3
next_number = 0
n=n-2
print(number_1)
print(number_2)
print(number_3)
for i in range(1,n):
next_number = number_1+number_2+number_3
print (next_number)
number_1 = number_2
numbe... |
3e1ea1e71e55e5c1f8b7b5e5b338c07773ae4b2e | vnegs14/CS104-02 | /ForLoop.py | 310 | 3.90625 | 4 | x = 1
print("The program will start counting up from 0 and finish at 9.")
print("You will recieve a nice message after the program has ended.")
response=(input("Are you ready to proceed? "))
for x in range(0,10):
print ("total= ",x)
print("Program has ended folks! Take care and Stay Frosty - Vinnie")
|
cc8e5d5db27730063c43f01ef610dcea40ec77df | lacra-oloeriu/learn-python | /ex15.py | 552 | 4.125 | 4 | from sys import argv# That is a pakege from argv
script, filename = argv#This is define the pakege
txt= open(filename)#that line told at computer ...open the file
print(f"Here's your file {filename}:")#print the text...and in {the name of file to open in extension txt}
print ( txt.read())
print("Type the filename ... |
cb5a49c4bbe6781796a6f7450910653aedc649fd | FranFer03/Practica | /Nate/list_2.py | 410 | 3.890625 | 4 | number_usuary = []
number_of_usuary = ""
while len(number_usuary) < 6:
while not number_of_usuary.isdigit():
number_of_usuary = input("Dime un numero : ")
number_usuary.append(int(number_of_usuary))
number_of_usuary = ""
print("Numero añadido!!")
lower = number_usuary[0]
for number in number_... |
1efd2759844f0c7de6a216896ba32ac44577c62a | FranFer03/Practica | /Nate/list_1.py | 415 | 3.890625 | 4 | number_usuary = []
number_of_usuary = ""
while len(number_usuary) < 10:
while not number_of_usuary.isdigit():
number_of_usuary = input("Dime un numero : ")
number_usuary.append(int(number_of_usuary))
number_of_usuary = ""
print("Numero añadido!!")
higher = number_usuary[0]
for number in numbe... |
4bdfc19951f63f544becb5bc083dc08817208005 | FranFer03/Practica | /Curso/Class_2/practice_class_2.8.py | 415 | 3.921875 | 4 | day = input("Ingrese el dia de la semana : ").title()
if day == "Lunes":
print("Con la profesora Bety")
elif day == "Viernes":
print("Hoy la Motok")
elif day == "Sabado":
print("A salir de peda")
elif day == "Domingo":
print("Sale asaduki")
elif day == "Martes" or day == "Miercoles" or day == "Jueves":... |
a4ff8ec5d15ecc726f96046dd90c73cdeb3b06bf | FranFer03/Practica | /Curso/Class_2/practice_class_2.1.py | 244 | 3.890625 | 4 | radio = float(input("Ingrese la radio : "))
height = float(input("ingrese la altura : "))
volumen = float(radio * radio * 3.14 * height)
if (volumen >300):
print("Su volumen es mayor a 300 ")
else:
print("El volumen es menor a 300")
|
a108262b02134c6029de3a1ffa6ea0d68120b475 | FranFer03/Practica | /Curso/Class_3/practice_class_3.1.py | 430 | 3.59375 | 4 | import random
def age():
mayor, menor = 0, 0
for i in range(0, 50):
edad = random.randrange(1, 75)
print("", edad ,end="")
if edad > 21:
mayor += 1
elif edad < 21:
menor += 1
print("\nMayores a 21 : ", end="")
for i in range(mayor):
print("... |
51829ff07ed19d9d2f6bda8bc2208046c6d0b0d4 | FranFer03/Practica | /Nate/multi_2.py | 270 | 4 | 4 | input_numero = int(input("¿Que numero quieres introducir en la tabla? "))
numeros = []
for numero in range(1, 11):
numeros.append(numero)
revnumeros = reversed(numeros)
for num in revnumeros:
print("{} x {} = {}".format(input_numero, num, input_numero * num)) |
f90d8cb6734aa2489ee0a039d47005896f16bff0 | josh231101/RGBColorPicker | /ProjectCalc.py | 3,717 | 3.5625 | 4 | import PySimpleGUI as sg
def calcularConversion(magnitud, u1, u2, entrada):
if magnitud == "LONGITUD":
# In case we convert Meters to Yd we use the formula, else means it's inverted so we use the inverted formula
return entrada * 0.914 if u1 == "Metros" and u2 == "Yardas" else entrada / 0.914
e... |
77ea1796467ad100aaa69be0453c61242a6f55d8 | Etoakor/love | /scr/create_sample.py | 1,018 | 3.703125 | 4 | import pandas as pd
import random
from configuration import MAN_NUM,WOMAN_NUM
def create_sample():
man_num = MAN_NUM
women_num = WOMAN_NUM
#设置男女生喜好样本
print('==============================生成样本数据==============================')
man = pd.DataFrame( [['w'+str(i) for i in random.sample(range(1,women_... |
2310553f84b88bd7512ab59201c991de11e1a7bc | Echo226/LeetCode | /229_majorityElementII.py | 1,437 | 3.765625 | 4 | '''
Method1: Brute Force
Method2: Boyer-Moore Algorithm
Author: Xinting
Date : 2019-11-04
'''
# Brute Force
class Solution:
def majorityElement(self, nums: List[int]) -> List[int]:
res = []
for num1 in nums:
if num1 not in res and sum(1 for num2 in nums if num2 ==... |
e07d650b50884b7955478b2cbd4c704e56c3e56e | ssupasanya/Coursework | /Mary_hw1.py | 6,439 | 4.125 | 4 |
# File: hw1.py
# Authors: [give the names of all Homework 1 team members here]
# Date: [submission date]
# Part 0
# Define your mean_of_3 function here
def mean_of_3(i, j, k):
return (i + j + k) / 3
#'''Comment this and the following triple-quoted line to test your function
print('mean_of_3(1,... |
ce02e4503266e12a185c6f7e1e7f4a5690e55193 | karthik-dasari/Guessing-Number-in-Tkinter | /Guessing Number(SYSTEM).py | 1,652 | 4.0625 | 4 | from tkinter import *
from random import *
from tkinter.font import *
root=Tk()
root.title('Guessing Number by System')
def start():
correct="n"
a,b=1,100
counter=1
while correct!="y":
my_guess=(a+b)//2
label_result1=Label(root,text="My guess is ")
label_result1.g... |
af1191998cf3f8d5916e22b8b55da7766bead003 | huynhirene/ICTPRG-Python | /q1.py | 241 | 4.28125 | 4 | # Write a program that counts from 0 to 25, outputting each number on a new line.
num = 0
while num <= 26:
print(num)
num = num + 1
if num == 26:
break
# OR
for numbers in range(0,26):
print(numbers) |
2beabe313feafd85369975df2289d0fb4787e6d3 | Sarthak-Rijal/Pong | /pong/ball.py | 1,548 | 3.90625 | 4 | import pygame
import math
pygame.init()
#screen window
WIDTH = 1000
HEIGHT = 600
class Ball(object):
def __init__(self, velocityX, velocityY, size, angle, speed, color):
self._posX = WIDTH/2 - size/2
self._posY = HEIGHT/2 - size/2
self._velocityX = velocityX
... |
5eb56b2325519c91a5a55ceba4bf0f4a4efe8c37 | AlexDanvers18/isklucheniya | /2_zad | 3,257 | 3.671875 | 4 | documents = [
{"type": "passport", "number": "2207 876234", "name": "Василий Гупкин"},
{"type": "invoice", "number": "11-2", "name": "Геннадий Покемонов"},
{"type": "insurance", "number": "10006", "name": "Аристарх Павлов"}
]
directories = {
'1': ['2207 876234', '11-2', '5455 028765'],
... |
8f2acf8371583b570c717a97047d0a44df46ee01 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch08/prime.py | 384 | 3.875 | 4 | def is_prime(n):
if n < 2: return False #如果n小于2,返回False
i = 2
while i*i <= n:
#一旦n能够被2~ 中的任意整数整除,n就不是素数,返回False
if n % i == 0: return False
i += 1
return True
#测试代码
for i in range(100): #判断并输出1~99中的素数,以空格分隔
if is_prime(i):print(i, end=' ')
|
94ca45cec436db0dea3679ebce948e6649768a4b | TingliangZhang/VR_Robot | /Python/Pythonpa/ch12/MyDialog.py | 1,655 | 3.6875 | 4 | import tkinter as tk #导入tkinter模块
class MyDialog: #自定义对话框
def __init__(self, master): #构造函数
self.top = tk.Toplevel(master) #生成Toplevel组件
self.label1 = tk.Label(self.top, text='版权所有') #创建标签组件
self.label1.pack()
self.label2 = tk.Label(self.to... |
87e56a662466fdd7ee4b279597d2da0e716bea3b | TingliangZhang/VR_Robot | /Python/Pythonpa/ch12/text.py | 349 | 3.6875 | 4 | from tkinter import * #导入tkinter模块所有内容
root = Tk(); root.title("Text") #窗口标题
w = Text(root, width=20, height=5) #创建文本框,宽20,高5
w.pack()
w.insert(1.0, '生,还是死,这是一个问题!\n ')
w.get(1.0) #'生'
w.get(1.0, END) #'生,还是死,这是一个问题!\n'
root.mainloop()
|
ad191ab445912a17fd5c8070dc001e7d4face132 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch06/io_test2.py | 253 | 3.984375 | 4 | import datetime
sName = input("请输入您的姓名:")
birthyear = int(input("请输入您的出生年份:"))#把输入值通过int转换为整型
age = datetime.date.today().year - birthyear
print("您好!{0}。您{1}岁。".format(sName, age))
|
3111014da165081bdfa4becfc96879e497b2d013 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch03/continue_div3.py | 318 | 3.625 | 4 | #chapter03\continue_div3.py
j = 0 #控制一行显示的数字个数
print('100~200之间不能被3整除的数为:')
for i in range(100, 200 + 1):
if (i % 3 == 0): continue #跳过被3整除的数
print(str.format("{0:<5}",i), end="")
j += 1
if (j % 10 == 0): print() #一行显示10个数后换行
|
74d5902adfc195a9d2132f61862ceae39f65a640 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch12/event.py | 240 | 3.6875 | 4 | from tkinter import * #导入tkinter模块所有内容
root = Tk()
def printEvent(event): #事件处理函数
print('当前坐标位置:',event.x, event.y)
root.bind('<Button-1>',printEvent) #单击鼠标左键
root.mainloop()
|
d3ad476b63a77a71c9a2a80ebf4b316031dbf68b | TingliangZhang/VR_Robot | /Python/Practice/leapyear2.py | 191 | 3.8125 | 4 | y=int(input("请输入"))
if(y%400==0):print("Y")
else:
if(y%4==0):
if(y%100==0):
print("N")
else:
print("Y")
else:
print("N")
input()
|
bbab62d4f28b4123f293a82ae0174bd543c7ec82 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch13/polygon.py | 450 | 3.9375 | 4 | import turtle
def draw_polygon(sides, side_len): #绘制指定边长度的多边行
for i in range(sides):
turtle.forward(side_len) #绘制边长
turtle.left(360.0/sides) #旋转角度
def main():
for i in range(3,11): #绘制三角形、正方形、正五边形、……、正十边形
step = 50 #边长(海龟步长)为50
draw_polygon(i, step) #绘制多边形
if __name__ ==... |
0fe4c04ad7c282d076b2bef426f0ef99cc188286 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch13/sin.py | 899 | 3.859375 | 4 | from tkinter import *
import math
WIDTH = 510; HEIGHT = 210 #画布宽度、高度
ORIGIN_X = 2; ORIGIN_Y = HEIGHT / 2 #原点(X=2、Y=窗体左边中心)
SCALE_X = 40; SCALE_Y = 100 #X轴、Y轴的缩放倍数
END_ARC = 360 * 2 #函数图形画多长
ox = 0; oy = 0; x = 0; y = 0 #坐标初始值
arc = 0 #弧度
root = Tk()... |
bb39f54d87ab1524753d465b1e1a1aae090ce949 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch12/grid2.py | 748 | 4.03125 | 4 | from tkinter import * #导入tkinter模块所有内容
root = Tk();root.title("登录") #窗口标题
root['width']=200; root['height']=80 #窗口宽度、高度
Label(root, text="用户名", width=6).place(x=1, y=1) #用户名标签,绝对坐标(1,1)
Entry(root, width=20).place(x=45, y=1) #用户名文本框,绝对坐标(45,1)
Label(root, text="密 码",width=6).place(x... |
9514adfe728160abecf0fe6730c780eae12e6f63 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch03/if_coordinate.py | 416 | 3.8125 | 4 | #chapter03\ifMul_test.py
x = int(input("请输入x坐标:"))
y = int(input("请输入y坐标:"))
if (x == 0 and y == 0): print("位于原点")
elif (x == 0): print("位于y轴")
elif (y == 0): print("位于x轴")
elif (x > 0 and y > 0): print("位于第一象限")
elif (x < 0 and y > 0): print("位于第二象限")
elif (x < 0 and y < 0): print("位于第三象限")
else: print("位于第四象限")
inpu... |
0bf64907b4c9e2a4cc7a3260605db42f2ab5ca79 | TingliangZhang/VR_Robot | /Python/Pythonpa/ch03/for_sum1_100.py | 316 | 3.765625 | 4 | #chapter03\for_sum1_100.py
sum_odd = 0; sum_even = 0
for i in range(1, 101):
if i % 2 != 0: #奇数
sum_odd += i #奇数和
else: #偶数
sum_even += i #偶数和
print("1~100中所有奇数的和:", sum_odd)
print("1~100中所有偶数的和:", sum_even)
input()
|
113cddca4472e40432caf9672fdc4ce22f25fb86 | fjctp/find_prime_numbers | /python/libs/mylib.py | 542 | 4.15625 | 4 |
def is_prime(value, know_primes=[]):
'''
Given a list of prime numbers, check if a number is a prime number
'''
if (max(know_primes)**2) > value:
for prime in know_primes:
if (value % prime) == 0:
return False
return True
else:
raise ValueError('List of known primes is too short for the given value'... |
907b14b99728a643a050cdb1c258ea022074834a | maribeltg/shogi | /pieces/lance.py | 708 | 3.984375 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .piece import Piece
# This class represent a Lance
class Lance(Piece):
piece_type = "L"
""" Object constructor """
def __init__(self, color):
super().__init__(color)
""" A lance (L) moves one or more squares straight forward. It cannot moves ... |
7d13afaa76e2de5ffb17f9df6cec33014f14a781 | cs-c92/python-fundamentals | /magic_answers.py | 930 | 3.875 | 4 | import random
name = ""
question = "Will it rain?"
answer = ""
random_number = random.randint(1, 10)
if random_number == 1:
answer = "Oh yeah, for sure."
elif random_number == 2:
answer = "If I told you, I'd have to kill you."
elif random_number == 3:
answer = "Signs point to groovy."
elif random_number == 4... |
7e7a821d20fd2a94807b18a6bea4795d0d094bfa | Nick12321/udemy | /lesson2-set.py | 292 | 4.03125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 12 10:46:34 2021
@author: nick
"""
#lists contain duplicates, sets do not hold duplicates
list_1 = [222, 333, 444, 333]
list_1 = set(list_1)
print(list_1)
print('\n')
s_1= {1,2,3,4,4,5,5,6,6}
print(type(s_1))
print(s_1) |
77f47d8da94d71e0e7337cf8dc9e4f3faa65c31a | orozcosomozamarcela/Paradigmas_de_Programacion | /recursividad.py | 1,132 | 4.125 | 4 |
# 5! = 5 * 4! = 120
# 4! = 4 * 3! = 24
# 3! = 3 * 2! = 6
# 2! = 2 * 1! = 2
# 1! = 1 * 0! = 1
# 0! = 1 = 1
#% * 4 * 3 * 2 * 1
def factorial (numero):
if numero == 0 :
return 1
else:
print ( f "soy el { numero } " )
#recur = factorial(numero -1)
#da = recur * numero
... |
5d7ce72a6c6f1131ad65147d0f2b61c5ef978f72 | orozcosomozamarcela/Paradigmas_de_Programacion | /ejercicio9.py | 1,213 | 3.59375 | 4 | import csv
def prestamos_dnis__prestamo(archivo_prestamos):
""" Recorre un archivo csv, con la información almacenada en el
formato: dni,año,_prestamo,venta """
# Inicialización
prestamos = open(archivo_prestamos)
prestamos_csv = csv.reader(prestamos)
# Saltea los encabezados
next(prest... |
a3c2ac4234daefa2a07898aa9cce8890ca177500 | orozcosomozamarcela/Paradigmas_de_Programacion | /quick_sort.py | 1,025 | 4.15625 | 4 |
def quick_sort ( lista ):
"""Ordena la lista de forma recursiva.
Pre: los elementos de la lista deben ser comparables.
Devuelve: una nueva lista con los elementos ordenados. """
print ( "entra una clasificación rápida" )
if len ( lista ) < 2 :
print ( "devuelve lista con 1 elemento" )
... |
818aa68874d794f6da6fc14bad58ef545a11258a | wangyiyao2016/Mypystudy | /tool_modules/Functional_Programming/collection.py | 281 | 3.71875 | 4 | #!/usr/bin/env python
# encoding: utf-8
'''
Created on Sep 5, 2017
@author: Jack
'''
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y', 'x'], rename=True)
p = Point(11, 1, 22)
print(p)
if __name__ == '__main__':
for i in p:
print(i)
pass
|
2b9317cf91e059122957a18ce201020e80bb9334 | wangyiyao2016/Mypystudy | /tool_modules/thread/main.py | 2,278 | 3.828125 | 4 | '''
Created on Nov 13, 2017
@copied_by: Jack
'''
import threading
from time import sleep
import time
import _thread
def function(i):
sleep(3)
print ("function called by thread %i\n" % i)
return
def main():
threads = []
for i in range(5):
t = threading.Thread(target=function, args=(i, ))... |
58915af3377ddd9b81f75413b261755ce1d28b2f | yaoshengzhe/project-euler | /problems/python/069.py | 1,259 | 3.671875 | 4 | #! /usr/bin/python
from util.prime import is_prime
# phi(p_0^q0p_1^q_1...) = phi(p_0^q0) * phi(p_1^q_1) * ...
# here p_n is prime number, q_n is positive integer
# so, for given number n, factorize n and we get n = p_0^q_0 * p_1^q_1 * ..
# therefore n / phi(n) = p_0^q_0 * p_1^q_1 / (phi(p0^q0) * phi(p1^q1) * ...)
# w... |
1cc95b9ca1081ff06891fc3ed7c6eddd1d618bbf | yaoshengzhe/project-euler | /problems/python/083.py | 1,341 | 3.703125 | 4 | #! /usr/bin/python
import sys
import heapq
def is_in_matrix(matrix, i, j):
return i > -1 and j > -1 and i < len(matrix) and j < len(matrix[0])
def add_node_if_exist(search_tree, matrix, i, j, score, used_node_set):
if is_in_matrix(matrix, i, j) and not (i, j) in used_node_set:
heapq.heappush(search_t... |
bc33fa88880906f8870fc38b0eff49b3d11151a8 | yaoshengzhe/project-euler | /problems/python/065.py | 564 | 3.90625 | 4 | #! /usr/bin/python
from util.prime import is_prime
import itertools
import fractions
import math
def get_convergent_at(n):
if n % 3 == 1:
return 2 * (n / 3 + 1)
else:
return 1
def foo():
val = -1
n = 100
for n in reversed(range(n-1)):
if val == -1:
val = fract... |
661818fc3e4e76a44fd431728f7d716c5c2714bf | yaoshengzhe/project-euler | /problems/python/030.py | 398 | 3.828125 | 4 | #! /usr/bin/python
import math
def sum_of_digit(num, base):
return sum([ int(i)**base for i in str(num)])
def find_upper_bound():
n = 1
while True:
if 10**n > 9**5*n:
return 9**5*n
n += 1
def foo():
return sum([i for i in range(2, find_upper_bound()+1) if sum_of_digit(i, ... |
7c81c0e3533219ecee73a35e427036fb264929a9 | yaoshengzhe/project-euler | /problems/python/009.py | 384 | 3.9375 | 4 | #! /usr/bin/python
def is_pythagorean(a, b, c):
arr = sorted([a, b, c])
return arr[0]**2 + arr[1] **2 == arr[2]**2
def foo():
for a in range(1, int(1000/3)):
for b in range(a, int(1000-a)/2):
c = 1000 - a -b
if is_pythagorean(a, b, c):
return a * b * c
def... |
75a44928da5a4fc39a18b771fd201135d51abe82 | yaoshengzhe/project-euler | /problems/python/038.py | 1,215 | 3.5 | 4 | #! /usr/bin/python
import itertools
def is_pandigital(s):
return len(s) == 9 and ''.join(sorted(s)) == '123456789'
def test_n(num, n_upper_bound):
candidate = []
length = 0
n_val = 0
for n in range(1, n_upper_bound+1):
if length >= 9:
break
val = str(num * n)
l... |
6451dcca1b269108e48e2f855658fda4f082b275 | yaoshengzhe/project-euler | /problems/python/045.py | 942 | 3.625 | 4 | #! /usr/bin/python
import math
def h(x):
return x*(2*x-1)
# Suppose we have x(x+1)/2 = y(3y-1)/2 = z(2z-1)
# Then we can search solution by let z from 1 to inf
# Let C = z(2z-1)
# then x = (-1 sqrt(1+8C)) / 2
# and y = (1 + sqrt(1+24C)) / 6
# find the solution that let x and y be positive integer
# the one afte... |
20ea54b9807e934eb863f057c180d63a534f51ee | MicheleMorelli/inverted_index_test | /inv_index.py | 770 | 3.6875 | 4 | def retrieve(d):
print_d(d)
print("INVERTED INDEX:")
b = inv_index(d)
print_inv_d(b)
def inv_index(d):
idx = {}
for k,v in d.items():
for element in v:
idx[element] = idx.get(element, []) + [k]
return idx
def intersect(d):
pass
def print_d(d):
for k,v in d.item... |
83875eff99de925da3f4ecc87671753a32656067 | janhavik/my_projects | /Course 1/week2_inversions.py | 2,193 | 3.8125 | 4 | import os
import time
inversions = 0
def sort_array(ip1, ip2):
sort_ip = list()
len_ip1 = len(ip1)
len_ip2 = len(ip2)
i = 0
j = 0
inversions = 0
while (i < len_ip1 and j < len_ip2):
if ip1[i] <= ip2[j]:
sort_ip.append(ip1[i])
i = i + 1
else:
... |
e3096ed5aaed8dce71cb125440dd586fefce02f9 | janhavik/my_projects | /Course 1/fastpower.py | 246 | 3.71875 | 4 |
def fastpower(a, b):
print a, b
if b == 1:
return a
else:
c = a * a
ans = fastpower(c, b / 2)
if b % 2 == 1:
return a * ans
else:
return ans
a, b = 5, 9
print fastpower(a, b), a**b
|
0deba5438d954e637a71ef6c9f62dc067f58d664 | taroukuma/w18 | /mnist_cnn.py | 2,650 | 3.65625 | 4 | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist=input_data.read_data_sets("MNIST_data/",one_hot=True)
#helper functions
#initialize weights
def init_weights(shape):
init_random_dist=tf.truncated_normal(shape,stddev=0.1)
return tf.Variable(init_random_dist)
#initialize ... |
2b8c15c7cd57ee9dcdb90d0c9ab2aa545f8d0052 | Bynaryman/SR_GAMES | /src/player.py | 1,069 | 3.546875 | 4 | import pygame
from common.common import *
class Player:
"""
"""
def __init__(self, x, y, name, conn, world_ref):
self.name = name
self.score = 0
self.conn = conn
self.pict = pict_player
self.case_x = x
self.case_y = y
self.world = world_ref
'''... |
4f6047d91e8b99e652508a7ec7537c681e40bb66 | Ktsunezawa/Python-practice | /complete/practice/trapezoid.py | 157 | 3.515625 | 4 | def get_trapezoid(upper=10, lower=10, height=10):
return (upper + lower) * height / 2
print('台形の面積は', get_trapezoid(upper=2, height=3))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.