blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
991d140f7e4100ae35f740c3b97f1ed62de4e7f9
Krishnaarunangsu/LoggingDemonstration
/python_slice_1.py
1,427
4.5
4
# The slice() constructor creates a slice object representing the set of indices specified by range(start, stop, step). # The slice object is used to slice a given sequence (string, bytes, tuple, list or range) or any object which supports sequence protocol (implements __getitem__() and __len__() method). # Slice obj...
true
92fcb82ffdcd43241e2d84afeb5ca1dcb6d65d23
wangluobing/wa101
/day02/linklist.py
2,690
4.15625
4
""" linklist.py 功能: 实现单链表的构建和功能操作 重点代码 """ #  创建节点类 class Node: """ 思路: 将自定义的类视为节点的生成类,实例对象中     包含数据部分和指向下一个节点的next """ def __init__(self, val, next=None): self.val = val # 有用数据 self.next = next # 循环下一个节点关系 # 做链表操作 class LinkList: """ 思路: 单链表类,生成对象可以进行增删改查操作     具...
false
f718803b224aff52828ca1c194f63fdb8706e64f
yashshah4/python-2
/ex6.py
725
4.375
4
#creating a string x with formatting method %d x = "There are %d types of people." % 10 #creating further strings binary = "binary" do_not = "don't" #creating a second string with string formatting method y = "Those who know %s and those who %s" %(binary, do_not) #printing the first two strings print x print ...
true
8f3477536c169937d8052f3d97e730546aa33420
brgermano/estudo_python
/listas/dicionario3.py
975
4.25
4
#criando um dicionario com dados dicionario = {"Yoda":"Mestre Jedi", "Mace Windu": "Mestre Jedi", "Anakin Skywalker":"Cavaleiro Jedi", "R2-D2":"Dróide", "Dex":"Balconista"} #exibindo o dicionário completo for chave, valor in dicionario.items(): print("O personagem {} é da categoria {}".format(chave, valor)) #remove...
false
566e03d3a6aafdc31f2427f1d04633cdeca96682
brgermano/estudo_python
/listas/tupla.py
363
4.1875
4
categorias = ("youngling", "padawan", "knight", "master") print(categorias) print(categorias[0]) # youngling print(categorias[1]) # padawan #usando um indice negativo para exibir o ultimo item da tupla print(categorias[-1]) # master # Exibindo cada item da tupla usando um loop print("======= LOOP ========") for ca...
false
07cf522b16d5d13d48a8a8422ea10b84a60c81b4
Gladarfin/Practice-Python
/turtle-tasks-master/turtle_11.py
319
4.1875
4
import turtle turtle.shape('turtle') turtle.speed(100) def draw_circle(direction, step): angle=2*direction for i in range(180): turtle.forward(step) turtle.left(angle) step=2.0 turtle.left(90) for i in range(0, 10, 1): draw_circle(1, step) draw_circle(-1, step) step+=0.3
true
e0b4849d6bea59c51b50017d00ba93b5defb7963
johnmarkdaniels/python_practice
/odd_even.py
272
4.125
4
num = int(input('Please input a number: ')) if num % 2 == 0: print(f'Your number ({str(num)}) is an even number.') if num % 4 == 0: print('Incidentally, your number is evenly divisible by 4.') else: print(f'Your number ({str(num)}) is an odd number.')
true
aebf2c565ac04e903da16fe7c96d812824c21d60
HenriqueEichstadt/MeusCursos
/Python/PythonFundamentos/Cap03/DSA-Python-Cap03-05-Metodos.py
482
4.15625
4
# # Métodos # Criando uma lista lst = [100, -2, 12, 65, 0] # Usando um método do objeto lista lst.append(10) # Imprimindo a lista lst # Usando um método do objeto lista lst.count(10) # A função help() explica como utilizar cada método de um objeto help(lst.count) # A função dir() mostra todos os métodos e atr...
false
508e4a3139bca354467178cbc2687416924599ea
Harpreetkaurpanesar25/python.py
/anagram.py
267
4.1875
4
#an anagram of a string is another string that contains same char, only the order of characters are different def anagram(s1,s2): if sorted(s1)==sorted(s2): print("yes") else: print("no") s1=str(input("")) s2=str(input("")) anagram(s1,s2)
true
56c6c4417ca6f8dd1bc1880957484ed343b2a81d
teayes/Python
/Experiments/Exp6.py
731
4.15625
4
class stringValidation: def __init__(self): self.open= ["[", "{", "("] self.close= ["]", "}", ")"] def validate(self,string): stack = [] for char in string: if char in self.open: stack.append(char) elif char in self.close: p...
true
77c6300b4d7a20a073b857c545c8d702eee86595
AlexKasapis/Daily-Coding-Problems
/2019-02-23.py
1,252
4.125
4
# PROBLEM DESCRIPTION # Given a sorted list of integers, square the elements and give the output in sorted order. # For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81]. # # SOLUTION # Lets assume two pointers, pointing to the start and end of the list. The pointer which points to the number with the # highest...
true
12404706673d1dfc33acabc52ba250789909496f
afrahaamer/PPLab
/VI Data Structures, Arrays, Vectors and Data Frames/3 Vectors/2 Basic Arithmetic operation/arithOperations.py
1,094
4.3125
4
# importing numpy import numpy as np # creating a 1-D list (Horizontal) list1 = [5, 6, 9] # creating a 1-D list (Horizontal) list2 = [1, 2, 3] # creating first vector vector1 = np.array(list1) # printing vector1 print("First Vector : " + str(vector1)) # creating secodn vector vector2 = np.array(list2) # printin...
false
527835943216d348696b0ad6ed7f8ba521e5a56d
afrahaamer/PPLab
/III Regular Expressions/1 RegEx Functions/findall/Metacharachters/ends with.py
241
4.21875
4
# $ - Pattern ends with # ^ - Pattern starts with import re t = "Hello, How are you World" # Checks if string ends with World? x = re.findall("World$",t) print(x) # Checks if string starts with Hello x = re.findall("^Hello",t) print(x)
true
312c35e0ee73ce3aa7b0836cf8f594d030ac1054
MostDeadDeveloper/Python_Tutorial_Exercises
/exercise3.py
357
4.21875
4
# Challenge - Functions Exercise # Create a function named tripleprint that takes a string as a parameter # and prints that string 3 times in a row. # So if I passed in the string "hello", # it would print "hellohellohello" def tripleprint(val): print(val*3) return val*3 #tripleprint("hello") # ^ - r...
true
0340d501babc4af06989c1455a8026e0b76c7cc8
bchhun/Codes-Kata
/prime_factors.py
1,509
4.21875
4
#coding: utf-8 """ Compute the prime factors of a given natural number. Bernard says: What is a prime factor ? http://en.wikipedia.org/wiki/Prime_factor Test Cases ([...] denotes a list) primes(1) -> [] primes(2) -> [2] primes(3) -> [3] primes(4) -> [2,2] primes(5) -> [5] primes(6) -> [2,3] primes(7) -> [7] primes(8...
true
c3272a68e7f7705810f956609b24d6a6477d2faa
kimmvsrnglim/DigitalCrafts
/week2/print_triangle.py
222
4.1875
4
def triangle(height): for x in range(0, height, 2): space = " " * ((height - x)/2) print space + "*" * (x + 1) user_input = int(raw_input("What's the height of your triangle?")) triangle (user_input)
true
ee0d216b772925a8a2713e8ed7be384cd2e4f5fd
xandhiller/learningPython
/stringTidbits.py
454
4.40625
4
print('Enter a string: ') n = input() print("\nLength of string is: " + str(len(n))) print() # Starting i at 1 because i determines the non-inclusive upper limit of string # truncation. for i in range(1, len(n)+1): print("string[0:"+str(i)+"]: \t" + n[0:i]) print() # Conclusions: # The operator 'string[0:8]' ...
true
eb7b6302495e29878e2db6ffd4240b8c941a61d0
nasreen94/luminar-python
/flow contols/decisin making/ifelif.py
1,098
4.125
4
# no1=int(input("enter d first no")) # no2=int(input("enter d secnd no")) # no3=int(input("enter d third no")) # if no1>no2: # if no1>no3: # print("largest no is",no1) # else: # print("largest no is",no3) # else: # if no2>no3: # # print("largest no is ",no2) # else: # pri...
false
b1c3fa918bcbc2fa1ac9f877291389d52eaf0278
JuanDAC/holbertonschool-higher_level_programming
/0x06-python-classes/101-square.py
1,910
4.5625
5
#!/usr/bin/python3 """File with class Square""" class Square: """Class use to represent a Square""" def __init__(self, size=0, position=(0, 0)): """__init__ constructor method""" self.size = size self.position = position @property def size(self): return self.__size ...
true
2aac08cdac3ed1a5dc6c875d5ebb9f91e900bb81
daveshanahan/python_challenges
/database_admin_program.py
1,848
4.15625
4
log_on_info = { "davids1":"MahonAbtr!n1", "lydiam2":"Password1234", "carlynnH":"scheduling54321", "maryMcN":"Forecaster123", "colinM":"paymentsG145", "admin00":"administrator5", } print("Welcome to the database admin program") username = input("\nPlease enter your username: ").strip...
true
78fd793c2ca6e3021894ee562e7d7cc5ad32b990
daveshanahan/python_challenges
/Quadratic_Equation_Solver_App.py
1,261
4.375
4
import cmath # print introduction print("Welcome to the Quadratic Equation Solver App") print("\nA Quadratic equation is of the form ax^2 + bx + c = 0.") print("Your solutions can be real or complex numbers.") print("A complex number has two parts: a + bj") print("Where a is the real portion and bj is the imag...
true
c6ab0fa71832cc589f844da6120d509fedd04a15
daveshanahan/python_challenges
/guess_my_number_game.py
893
4.21875
4
import random print("Welcome to the Guess My Number App") # gather user input name = input("\nHello! What is your name: ").title().strip() # generate random number print("Well " + name + ", I am thinking of a number between 1 and 20.") random_num = random.randint(1,20) # initialise guess counter and get ...
true
0deda362dc460620ab43364b17599182f1f12e87
daveshanahan/python_challenges
/grade_point_average_calculator.py
2,658
4.4375
4
print("Welcome to the average calculator app") # gather user input name = input("\nWhat is your name? ").title().strip() num_grades = int(input("How many grades would you like to enter? ")) print("\n") # initialise list and append number of grades depending on user input grades = [] for i in range(num_grades...
true
a85f63d5cfc5b211612bb92d388bbfb9526de482
davidac2007/python_tutorials
/numbers.py
2,448
4.5
4
# Python numbers # There are three numeric types in Pythom: # int x = 1 # float y =2.8 # complex z = 1j print(type(x)) print(type(y)) print(type(z)) # Int # Int or integer, is a whole number, positive or negative, without decimals, # of unlimited length. x = 1 y = 366376429 z = -3255522 print(type(x)) print(t...
true
9dda68c3e93388399b7d1026d82efa2d41ea26a5
GuhanSGCIT/Trees-and-Graphs-problem
/The lost one.py
2,750
4.375
4
""" Shankar the Artist had two lists that were permutations of one another. He was very proud. Unfortunately, while transporting them from one exhibition to another, some numbers were lost out of the first list. Can you find the missing numbers? As an example, the array with some numbers missing, arr=[7,2,5,3,5,3]...
true
60652845c16c2840261f73b47b9225abd39ca9b0
GuhanSGCIT/Trees-and-Graphs-problem
/Spell Bob.py
2,515
4.3125
4
""" Varun likes to play with cards a lot. Today, he's playing a game with three cards. Each card has a letter written on the top face and another (possibly identical) letter written on the bottom face. Varun can arbitrarily reorder the cards and/or flip any of the cards in any way he wishes (in particular, he can le...
true
4472990ca9ef518a8e02dfcd668a19b7fcefd1ab
GuhanSGCIT/Trees-and-Graphs-problem
/snake pattern.py
1,244
4.28125
4
""" Given an M x N matrix .In the given matrix, you have to print the elements of the matrix in the snake pattern. i des First line contains two space separated integers M,N,which denotes the dimensions of matrix. Next for each M lines contains N space separated integers,denotes the values. Odes print the sn...
true
6012371aef940cf255e34f4d6960533564924be4
GuhanSGCIT/Trees-and-Graphs-problem
/Guna and grid.py
1,212
4.125
4
""" Recently, Guna got a grid with n rows and m columns. Rows are indexed from 1 to n and columns are indexed from 1 to m. The cell (i,j) is the cell of intersection of row i and column j. Each cell has a number written on it. The number written on cell (i,j) is equal to (i+j). Now, Guna wants to select some cells f...
true
d0ae84a9f2cb762c24b70b92ea1cab0e3acbe92d
GuhanSGCIT/Trees-and-Graphs-problem
/Egg Dropping Puzzle-Samsung.py
2,110
4.40625
4
""" Suppose you have N eggs and you want to determine from which floor in a K-floor building you can drop an egg such that it doesn't break. You have to determine the minimum number of attempts you need in order find the critical floor in the worst case while using the best strategy.There are few rules given below. ...
true
cbc7d523b97ec18e747d0955b769c475c6935aff
alfonso-torres/eng84_OOP_exercises
/Fizzbuzz.py
1,403
4.4375
4
# Exercise 1 - Fizzbuzz # Write a program that outputs sequentially the integers from 1 to 100, but on some conditions prints a string instead: # when the integer is a multiple of 3 print “Fizz” instead of the number, # when it is a multiple of 5 print “Buzz” instead of the number, # when it is a multiple of both 3 an...
true
6ed4d522eed64bb845676e0b9bcbd24e21ffa1ff
taroserigano/coderbyte
/Arrays/Consecutive.py
737
4.1875
4
''' Consecutive Have the function Consecutive(arr) take the array of integers stored in arr and return the minimum number of integers needed to make the contents of arr consecutive from the lowest number to the highest number. For example: If arr contains [4, 8, 6] then the output should be 2 because two numbers ne...
true
4d03565e948a1b5f093d0ff0cb589ead794f8d21
taroserigano/coderbyte
/Trees & Graphs/SymmetricTree.py
1,203
4.5
4
''' Symmetric Tree HIDE QUESTION Have the function SymmetricTree(strArr) take the array of strings stored in strArr, which will represent a binary tree, and determine if the tree is symmetric (a mirror image of itself). The array will be implemented similar to how a binary heap is implemented, except the tree ...
true
75bb3cbcba0b24a5487276691650603e261e416d
mgomez9638/CIS-106-Mario-Gomez
/Assignment 8/Activity 1.py
668
4.40625
4
# Activity 1 # This program gives the user access to create a multiplication table. # You simply begin with entering a value, entering a starting point, and the size of the table. def getExpressions(): print("Enter the number of expressions") expressions = int(input()) return expressions def getValue...
true
bf3a761daa923e3fc486c37ed4a522d4cbb57d45
mgomez9638/CIS-106-Mario-Gomez
/Assignment 5/Activity 6.py
2,061
4.34375
4
# Activity 6 # This program is intended to determine how much paint is required to paint a room. # It, also, expresses how much the gallons of paint cost. def get_length(): length = float(input("Enter the length of the room(in feet): ")) return length def get_width(): width = float(input("Enter the...
true
3031e95c3286a9b596e179e6e08b8903b99625ba
mgomez9638/CIS-106-Mario-Gomez
/Assignment 4/Activity 3.py
439
4.15625
4
# Assignment Three # This program gives the user access to calculate the distance in U.S. standard lengths. # It converts miles into yards, feet, and inches. print("Enter distance in miles: ") miles = float(input()) yards = 1760 * miles feet = 5280 * miles inches = 63360 * miles print("The distance in yards is " +...
true
1c132cd8d307833a17f4860c3d0267c89e0f83c6
Sridevi333/Python-Deep-Learning-Programming
/ICP2/wordsperline.py
355
4.125
4
fileName = input("Enter file name: ") f = open(fileName, "r") # Open file for input lines=0 mostWordsInLine = 0 for lineOfText in f.readlines(): wordCount = 0 lines += 1 f1=lineOfText.split() wordCount=wordCount+len(f1) if len(f1) > mostWordsInLine: mostWordsInLine = len(f1) print ...
true
ec79fbf6c6334667e4604b67cf4718304c5be637
mrzhang638993/python-basis
/object_excercise.py
1,525
4.1875
4
# python 对象的课后习题的训练 import math class Point: def __init__(self, x, y): self.x = x self.y = y class Line: def __init__(self, z, r): self.z = z self.r = r def getLen(self): return math.sqrt(math.pow((self.z.x - self.r.x), 2) + math.pow((self.z.y - self.r.y), 2)) ...
false
d1f6b7f2192bbd7c650dca043c403264af0fdce4
mrzhang638993/python-basis
/module_exercise.py
1,485
4.40625
4
# python中的模块对应的是一个python文件 """ 1.我们现在有一个 hello.py 的文件,里边有一个 hi() 函数:.&ymiM?t def hi(): print("Hi everyone, I love FishC.com!") 复制代码 请问我如何在另外一个源文件 test.py 里边使用 hello.py 的 hi() 函数呢? 答案:对应的引用方式是如下的: import hello_1 as hello hello.hi() 2.模块对应的引入方式主要包括如下的3中引入方式的: 导入方式之一:import 模块导入操作 导入方式之二:from 模块名称 import 函数名称 可以只引...
false
98f2a515844083826503ee03d9420d36aa90ca19
mrzhang638993/python-basis
/game.py
447
4.28125
4
"""使用python 设计第一个游戏""" temp=input("不妨猜猜小甲鱼现在心里想的是那个数字: ") #接收用户的输入,赋值给temp guess=int(temp); if guess==8: #注意缩进的位置的,python非常注重缩进操作的 print("你是小甲鱼心里的蛔虫嘛?!") print("哼,猜中了也没有奖励!") else: print("猜错了,小甲鱼现在心里想的是8!") print("游戏结束,不玩了")
false
7af3b6b3a8cf63f64ad0527790de8e75d4ae9c1c
thaiscardia/ex-python
/project-euler/problem1-multiples3and5.py.py
310
4.125
4
"""definir o limite para 1000 %5 == 0 -> uma função or %3 == 0 se o num for divisivel, lista; soma a lista """ def calculo(): lista = [] for num in range(1, 1000): if num %5 == 0 or num %3 == 0: lista.append(num) soma = sum(lista) print(soma) calculo()
false
3fe3c7b31f3dd81cc5d45896ae728f7a05f524ed
thaiscardia/ex-python
/Guanabara/Mundo1/ex26-ocorrenciaString.py
417
4.1875
4
"""Faça um programa que leia uma frase pelo teclado e mostre: - quantas vezes aparece a letra "A"; - em que posição ela aparece a primeira vez; - em que posição ela aparece a última vez;""" f = input("Digite a frase aqui: ") f = f.upper() print("Esta frase possui {} letra(s) A".format(f.count("A"))) print("O primeiro ...
false
1a0e41d3b08f4c98db46d0f7e01e7ae247b21298
Chuukwudi/Think-python
/chapter8_exercise8_5.py
2,544
4.28125
4
''' str.islower() Return True if all cased characters in the string are lowercase and there is at least one cased character, False otherwise. ''' def any_lowercase1(s): for c in s: if c.islower(): return True else: return False '''Here, the funtion takes th...
true
7783f793664c77640e328a30721a8c28b06e7a07
anandaviamianni/Pengkondisian-Modul-2-
/Studi Kasus.py
717
4.1875
4
# Kiki dan Titis adalah seorang programmer di PT Daspro, kemudian mereka diminta oleh atasannya # untuk membuat sebuah program untuk menentukkan kategori umur, dengan ketentuan umur seperti di bawah. print("==== KATEGORI UMUR ====") umur = int(input("Masukkan umur anda = ")) print("\nAnda Berada pada : ") pri...
false
a12543e90095726b5bd8a96463da4311462fb58e
LeeGing/Python_Exercises
/8_ball.py
835
4.3125
4
#Magic 8 Ball def shake(): import random print ("======================================================") print ("==================== MAGIC 8 BALL ====================") print ("======================================================") user_input = input("ASK THE 8 BALL YOUR QUESTION: ") ans = random.randint(1,5...
false
7b659166ca9845366521da6132889c30e7de2849
makaiolam/final-day-1
/main.py
1,796
4.21875
4
import turtle # turtle = turtle.Turtle() # shape = input("choose shape triangle square or circle") # if shape == ("triangle"): # def triangle(length,color): # turtle.speed(1) # turtle.color(color) # turtle.forward(length) # turtle.left(120) # turtle.forward(length) # turtle.left(120) # t...
false
a1af47bd51c847b5ec8815835a24f13e89aa3053
ckaydevs/learning_python
/class/draw art/squre.py
924
4.3125
4
import turtle def draw_square(some_turtle): for i in range(1,5): some_turtle.forward(100) some_turtle.right(90) def draw_art(): window=turtle.Screen() window.bgcolor("red") #Create the turtle brad- Draws a square brad=turtle.Turtle() brad.shape("turtle") brad.color("yellow"...
true
7a4f8c8d68bd58f1cd327f3e41bc09329a5c3e6a
joelgarzatx/portfolio
/python/Python3_Homework03/src/decoder.py
752
4.125
4
""" Decoder provided function alphabator(list) accepts an integer list, which returns the list of integers, substituting letters of the alphabet for integer values from 1 through 26 """ def alphabator(object_list): """ Accepts a list of objects and returns the objects from the list, replacing inte...
true
bb47cb2a447892832f217c28d2570902d1c9709e
AdamBorg/PracCP1404
/Prac03/asciiTable.py
774
4.21875
4
def main(): lower = 33 upper = 127 num_entered = get_number(lower,upper) print("{:>3} {:>6} \n".format(num_entered, chr(num_entered))) print_ascii_table(lower, upper) def get_number(lower,upper): num_entered = 0 exit_character = 'e' while num_entered < 33 or num_entered > 127 or exi...
true
ae2357e9ae0dc6da9f2aef9c4bd6897259cf9018
sstoudenmier/CSCI-280
/Assignment5/PathNode.py
1,798
4.15625
4
''' Class representing a map location being searched. A map location is defined by its (row, column) coordinates and the previous PathNode. ''' class PathNode: def __init__(self, row=0, col=0, previous=None): self.row = row self.col = col self.previous = previous ''' Gets the row...
true
b8e0e7bb09098d3470458211331885555a417662
russian-droid/100DoC_D03
/main.py
2,717
4.25
4
#following Udemy course: 100 days of code by Angela Yu number = int(input ('Please enter an intger?\n')) x=number%2 if x==0: print ('that is an even nunber') else: print ('that is an odd number') print(x) #----------------------------------- print ('\n\n-------WELCOME TO THE BMI CALCULATOR-------') weight =...
false
3a41918c0f0137427561146e947191acd06963a5
akash639743/Python_Assignment
/Dictionary.py
912
4.5
4
# Dictionary #1. Create a Dictionary with at least 5 key value pairs of the Student students={1:"akash",2:"rohit",3:"simran",4:"mohit",5:"sonam"} print(students) # 1.1. Adding the values in dictionary students[6]="soni" print(students) # 1.2. Updating the values in dictionary students.update({7: "mukesh"}) print(...
true
b983ae86176ffd7877a2e0b6351249487a5215cd
akash639743/Python_Assignment
/Access_Modifiers.py
2,223
4.125
4
# Access Modeifiers # 1. Create a class with PRIVATE fields class Geek: # private members __name = None __roll = None __branch = None # constructor def __init__(self, name, roll, branch): self.__name = name self.__roll = roll self.__branch = branch # private member function def __displayDetails(sel...
true
eaf51afa470cdb8bb97633aa5d624075d47ba331
dieg0varela/holbertonschool-higher_level_programming
/0x06-python-classes/5-square.py
1,044
4.3125
4
#!/usr/bin/python3 """Define class Square""" class Square: """Class Square""" def __init__(self, new_size=0): """Init Method load size""" if (isinstance(new_size, int) is False): raise TypeError("size must be an integer") if (new_size < 0): raise ValueError("siz...
true
3c8374bfdcac02646aa651cb2eca1f4b79f0dbb9
thorenscientific/py
/TypeTrip/TypeTrip.py
422
4.15625
4
# A simple script demonstrating duck typing... print "How trippy are Python Types??" print "Let's start with x=1...." x = 1 print "x's value:" print x print "x's type:" print type(x) print "Now do this: x = x * 1.01" x = x * 1.01 print "x's value:" print x print "x's type:" print type(x) print "...
true
51c28572bb0431407138dab7f4a21f68db4de271
luizfpq/PythonDjango
/Exercicios IFSP/ex3.py
824
4.15625
4
# -*- coding:utf-8 -*- ''' @author: LuizQuirino @contact: luizfpq@gmail.com Exercício 3 Escreva um programa que leia do usuário o nome e RA de 3 alunos e armazene essa informação em um dicionário, relacionando o RA ao nome do aluno Peça ao usuário para informar um RA e exiba o nome do aluno associado ''' from soups...
false
c1ad2b3ac87e01b9a230b71b9aca5af6bb34d9ed
flora5/py_simple
/map_reduce_filter.py
1,062
4.21875
4
""" filter(function or None, sequence) -> list, tuple, or string Return those items of sequence for which function(item) is true. If function is None, return the items that are true. If sequence is a tuple or string, return the same type, else return a list. """ str = ['a','b','c','d'] def func(s): if ...
true
c12bf91981fc6c3da928419f0db163662eea1798
Riverfount/pacote-desafios-pythonicos
/14_mimic.py
1,888
4.25
4
""" Leia o arquivo especificado via linha de comando. Faça um split() no espaço em branco para obter todas as palavras no arquivo, em vez de ler o arquivo linha a linha, é mais facil obter uma string gigante e fazer o split uma vez. Crie um dicionario "imitador" que mapeia cada palavra que aparece no arquivo com a lis...
false
f5df8af88f3449e2124e9cc0899300bc2eff9fb7
mzanzilla/Python-For-Programmers
/Files/ex3.py
1,239
4.5
4
#Updating records in a text file #We want to update the name for record number 300 - change name from White to Williams #Updating textfiles can affect formattting because texts may have varrying length. #To address this a temporary file will be created import os tempFile = open("tempFile.txt", "w") accounts = open("acc...
true
17ee83f78ffc75ddc60789152a67d32531fff727
mzanzilla/Python-For-Programmers
/Exceptions/ex1.py
656
4.375
4
#demonstrating how to handle a division by zero exception while True: #attempt to convert and divide values try: number1 = int(input("Enter numerator: ")) number2 = int(input("Enter denuminator: ")) result = number1 / number2 except ValueError: #Tried to convert non-numeric value to ...
true
4461ea009cb18cfc2b7167372e5d31c1a8e35c2f
tmemud/Python-Projects
/ex72.py
1,110
4.40625
4
# Use the file name mbox-short.txt as the file name #7.2 Write a program that prompts for a file name, then opens that file and reads through the file, #looking for lines of the form: X-DSPAM-Confidence: 0.8475 #Count these lines and extract the floating point values from each of the lines and #compute the av...
true
a7351fb387a69885aad636368da7e110c0ec1696
crossihuy/MyRepo
/idk_with_loops.py
353
4.15625
4
my_list = [] while True: question = input("Do you want to add a name: \ny|n: ").lower() if question == "y" or question == "": my_list.append(input("Give me a friend's name: ")) continue elif question == "n": break else: print("You did not select y or n") for i in my_list:...
false
21e4f6682d558e19baf340cf753df5d1f9516f45
harushimo/python_programs
/month_validator.py
304
4.125
4
#!/usr/bin/python months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] def valid_month: for i in months: if(i.lower() == months.lower()): return i print valid_month("January") print valid_month("january")
false
230305855dd6284c061fc408a7805931cb0cb7c8
juanall/Informatica
/TP2.py/2.14.py
703
4.125
4
#Ejercicio 14 #Creá una función que calcule la temperatura media de un día a partir de la # temperatura máxima y mínima. Escribí un programa principal, que utilizando # la función anterior, vaya pidiendo la temperatura máxima y mínima de cada # día y vaya mostrando la media. El programa tiene que pedir el número de dí...
false
b527e70db8dd5f3cf9afa0047c9a4140cbb94e82
bkoehler2016/python_projects
/forloop.py
458
4.28125
4
""" a way to print objects in a list """ a = ["Jared", 13, "Rebecca", 14, "Brigham", 12, "Jenn", 3, "Ben", 4] # printing the list using * operator separated # by space print("printing the list using * operator separated by space") print(*a) # printing the list using * and sep operator print("printing list...
true
9257561acddd02bd56de08bd1122f91c14000de5
yuanchangwang/cheshi
/L04(下)迭代器、map、reduce、sorted、filter、列表、字典、集合推导式、生成器函数/课件/8.生成器.py
1,018
4.25
4
# ### 生成器 元组推导式是生成器(generator) ''' 定义:生成器可以实现自定义,迭代器是系统内置的,不能够更改 生成器的本质就是迭代器,只不过可以自定义. 生成器有两种定义的方式: (1) 生成器表达式 (里面是推导式,外面用圆括号) (2) 生成器函数 ''' # (1) 元组推导式的形式来写生成器 gen = (i * 2 for i in range(5)) print(gen) from collections import Iterator print(isinstance(gen,Iterator)) # (2)使用for循环进行调用 for i in gen: print(i) # ...
false
3725f3519dcaaa993db6aabb5eb7f225798e2b09
yuanchangwang/cheshi
/L04(下)迭代器、map、reduce、sorted、filter、列表、字典、集合推导式、生成器函数/课件/4.sorted.py
1,112
4.25
4
# ### sorted ''' sorted(iterable,reverse=False,key=函数) 功能:排序 参数: iterable:可迭代性数据(常用:容器类型数据,range对象,迭代器) reverse : 是否倒序 默认正序reverse= False(从小到大) 如果reverse=True 代表倒序 (从大到小) key = 自定义函数 或者 内置函数 返回值: 排序的序列 ''' listvar = [1,2,-88,-4,5] # 按照从小到大默认排序 res = sorted(listvar) print(res) # 从大到小排序 res = sorted(listvar,revers...
false
946013b211c5d2f35e399817d567c3bd267006a0
johnnyshi1225/leetcode
/problems/21_Merge_Two_Sorted_Lists.py
2,069
4.125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################### # Author: Johnny Shi # Created Time: 2018-09-14 13:17:08 # File Name: 21_Merge_Two_Sorted_Lists.py # Description: ######################################################################### from simple_...
false
091ad70053e25fc51ac502a53946d36d96219715
OctaveC/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/5-text_indentation.py
566
4.375
4
#!/usr/bin/python3 """ This is a module that prints a text with 2 new lines after each of these characters: ., ? and : """ def text_indentation(text): """ This function indents text based on special characters """ if type(text) is not str: raise TypeError("text must be a string") leap = T...
true
183e49a5349c95ef8196ad65754fec65fedf3a35
Invecklad-py/New_start
/What_is_your_name_input.py
295
4.125
4
first_name = input("What's your first name?") last_name = input("What's your last name?") answer = input("So your name is " + first_name + " " + last_name + "?") if answer == "yes": print("Great!") if answer == "no": print("I'm sorry we got that wrong, please try again")
true
104df48126c81aaade444844a5c67c501a98126a
Lumiras/Treehouse-Python-Scripts
/Beginning_python/general_exercises/shopping_list_4.py
2,236
4.125
4
shopping_list = [] def clear_list(): confirm = input("Are you sure you want to completely clear the list?\nThere is no way to undo this!\nType YES to confirm ") if confirm == 'YES': del shopping_list[:] def move_item(idx, mov): index = idx - 1 item = shopping_list.pop(index - 1) shopping_l...
true
04f1caf80aaf3699dfe4e525c7f69909c5a33476
clarencekwong/CSCA20-B20
/e4.py
1,672
4.15625
4
import doctest def average_list(M): '''(list of list of int) -> list of float Return a list of floats where each float is the average of the corresponding list in the given list of lists. >>> M = [[0,2,1],[4,4],[10,20,40,50]] >>> average_list(M) [1.0, 4.0, 30.0] >>> M = [] >>> average_...
true
27ff7f866f125b4930facd5f7f28d04e151b0f79
pinardy/Digital-World
/Week 3/wk3_hw4.py
622
4.21875
4
def isPrime(x): if x==2: return True elif x<2 or x % 2 == 0: return False elif x==2: return True else: return all(x % i for i in xrange(2, x)) #all function: Return True if all elements of the iterable are true #(or if the iterable is empty). #range returns a Python li...
true
6435a57030eda2023e17f57b4c127cce9c45163c
TheManTheLegend1/python_Projects
/updateHand.py
2,062
4.1875
4
import random import string VOWELS = 'aeiou' CONSONANTS = 'bcdfghjklmnpqrstvwxyz' HAND_SIZE = 7 def getFrequencyDict(sequence): """ Returns a dictionary where the keys are elements of the sequence and the values are integer counts, for the number of times that an element is repeated in the sequence. ...
true
890f47b04fe5db62dcdc5a6bc571c343c7ea75a9
TheManTheLegend1/python_Projects
/Silly.py
255
4.1875
4
#Silly Strings #Deonstrates string concatenation and repetition print("You can concatenate two " + "stringswith the '+' operator.") print("\nThis string" + "may not " + "seemterr" + "ibly impressive. " \ + "But what " + "you dont know" + " is that\n ")
false
534022b24a83574867a9ff27f6b88e9a5fde56a3
SUNIL-KUDUPUDI-1644/sunil1
/ck3.py
248
4.21875
4
char=input("enter a char=\n") if (char>='a' and char <='z') or (char>'A' and char<'Z'): if char=='a' or char=='e' or char=='i' or char=='o' or char=='u': print("vowel") else: print("const") else: print("invalid syntax")
false
d1dbff287e9541cab7ec2f46958e0990ccc73eb6
Arya16ap/moneyuyyyyyof.py
/countingWords.py
403
4.125
4
introString = input("enter your introduction: ") characterCount = 0 wordCount = 1 for i in introString: characterCount=characterCount+1 if(i==' '): wordCount = wordCount+1 characterCount = characterCount-1 if(wordCount<5): print("invalid intro") print("no. of words in the string: "...
true
99355b9314b27ebb7d7ec5a4c523cdeaaf3e97fd
NAMELEZS/Python_Programs
/length_function.py
248
4.15625
4
### 03/28/2021 ### Norman Lowery II ### How to find the length of a list # We can use the len() fucntion to find out how long a list is birthday_days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] print(len(birthday_days))
true
4f247571b9e29902cdfab301b0b2039e6c0e3d3b
lebronjames2008/python-invent
/w3schools/Scopes.py
799
4.375
4
# A variable is only available from inside the region it is created. This is called scope. def myfunc(): x = 300 print(x) myfunc() # A variable created inside a function is available inside that function x = 300 def myfunc(): print(x) myfunc() print(x) # Printing 2 300's x = 300 def myfunc(): x = 200 p...
true
469cf9247ced31818e7060426dfb7f1f67d91ad6
lebronjames2008/python-invent
/w3schools/Inheritance.py
1,945
4.34375
4
class Person: def __init__(self, fname, lname): self.firstname = fname self.lastname = lname def printname(self): print(self.firstname, self.lastname) # Use the Person class to create an object, and then execute the printname method: x = Person("John", "Doe") x.printname() #Use the pass keyword when...
true
a5a700f7fa77777ea9a3c65669d67f0fd4313dd0
lebronjames2008/python-invent
/chapter9/testlist1.py
706
4.34375
4
names_list = ['sibi', 'rahul', 'santha', 'scott', 'james'] # print all the elements in the list print(names_list) # print the 4th index of the list print(names_list[4]) print(names_list[-5]) thislist = ["apple", "banana", "cherry"] print(thislist) thislist[1] = "blackcurrant" print(thislist) thislist = ["apple", ...
true
7da6111a2ac0a3d281c0e615e69683aebcf6cae2
AlbertoLG1992/AprendiendoPython
/Ejemplos/3-TiposDeDatosNumericos/TipoDatosBooleanos.py
622
4.25
4
# Los operadores booleanos son: # or : || # and : && # not : para negar x = True y = False if(x and not y): print("ok") else: print("no") # Para comparar listas tenemos all y any # all(iterador) : Recibe un iterador, por ejemplo una lista, # y devuelve True si todos los elementos son verdaderos o el iterador e...
false
27e08ae25f106d0179bff869f02855717cd417dd
AlbertoLG1992/AprendiendoPython
/Ejemplos/5-TipoDatosSecuencia/Listas.py
1,152
4.4375
4
# Las listas ( list ) me permiten guardar un conjunto de datos que se pueden repetir y # que pueden ser de distintos tipos. Es un tipo mutable. ''' SLICE Para optener un rango dentro de una lista: lista[start:end] # Elementos desde la posición start hasta end-1 lista[start:] # Elementos desde la posición start hasta ...
false
71039d8b5847e341112b2194918eebe219589a40
vlad-zankevich/LearningPython
/album.py
1,222
4.1875
4
def run(): # Theme with function def make_album(singer_name, album_name, track_number=''): """This function will make the dictionary with your album""" # Album dictionary, empty in default album = {} # You can enter quantity of tracks in album if you want if track_numb...
true
a900892c18dfd7679221269c3a7d8cfe3a1586a7
mblahay/blahay_standard_library
/regexp_tools.py
1,129
4.25
4
import re import itertools import blahay_standard_library as bsl def regexp_like(args, argp): ''' A simple wrapper around the re.search function. The result of that function will be converted to a binary True/False. This function will return a simple True or False, no match object. Parameters...
true
322747201ef9fe9aa660c5a8831e396266789520
Santhosh-27/Practice-Programs
/N_day_profit_sell_k_times.py
1,317
4.34375
4
''' Stock Buy Sell to Maximize Profit The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can earned by buying on day 0, selling on day 3. Again buy on...
true
095cf2d2b9c6d71f606901fc6c3aef5ab75b0ac7
bc-townsend/aco_example
/aco_example/path.py
2,145
4.40625
4
import pygame from math import sqrt class Path: """Represents a path object. These are connections between nodes. """ def __init__(self, color, node1, node2): """Initialization method for a path object. Args: color: The color of this path. node1: One of the nodes ...
true
9163e5b356aa777c64151d0cb77dd76e464ba1a7
robertpvk/phyton-base
/lesson1/task1.py
1,958
4.15625
4
""" ЗАДАНИЕ 1 Человеко-ориентированное представление интервала времени Спросить у пользователя размер интервала (в секундах). Вывести на экран строку в зависимости от размера интервала: 1) до минуты: <s> сек; 2) до часа: <m> мин <s> сек; 3) до суток: <h> час <m> мин <s> сек; 4) сутки или больше: <d> дн <h> час <m> мин...
false
8fd16d1053d689bd3068035610b8250213ee3c45
robertpvk/phyton-base
/lesson3/task1.py
974
4.28125
4
""" 1. Написать функцию num_translate(), переводящую числительные от 0 до 10 c английского на русский язык. Например: >>> >>> num_translate("one") "один" >>> num_translate("eight") "восемь" Если перевод сделать невозможно, вернуть None. Подумайте, как и где лучше хранить информацию, необходимую для перевода: какой тип...
false
33901933c76acda3b74577e52e989c1e4d4e34a8
NiteshKumar14/MCA_SEM_1
/Assignments/OOPs pythonn/synonym_using_existing_dict.py
1,495
4.46875
4
# create an empty my_dictionary my_my_dict={ "sad":"sure", "depressed":"Sad", "Dejected":"Sad", "Heavy":"Sad", "Amused":"Happy", "Delighted":"Happy", "Pleased":"Happy", "Annoyed":"Angry", "Agitated":"Angry", "Mad":"Angry", "Determined":"Energized", "Creative":"Energized",...
true
b08167b84bd467cc501f5b59165ca3ef8c100f38
NiteshKumar14/MCA_SEM_1
/Assignments/OOPs pythonn/happy_sum_of_squares.py
2,261
4.125
4
def sum_of_squares(sqdnumber): #defining a function that take a string and return its elements sum sqdNumber_result=0 #initializing sum array for storing sum iteratator=len(sqdnumber)-1 #iterating till the length of string in desce...
true
4eaf701470c01077f14e5491eecd6282bb0e61c8
freebrains/Python_basics
/Lesson_5.1.py
563
4.4375
4
""" Создать программно файл в текстовом формате, записать в него построчно данные, вводимые пользователем. Об окончании ввода данных свидетельствует пустая строка. Create with a program file in text format and write the data entered by the user line by line. An empty string indicates the end of data entry. """ fi...
false
5f5df0b3966bb1a5c613d0c4f6e4f524cee0c742
freebrains/Python_basics
/Lesson_3.3.py
580
4.3125
4
""" Реализовать функцию my_func(), которая принимает три позиционных аргумента, и возвращает сумму наибольших двух аргументов. Implement the my_func () function, which takes three positional arguments, and returns the sum of the largest two arguments. """ def my_func(var_1=int(input("Enter first number - ")), var_2=i...
true
a3b0f1df4ea0fefeba0f39fd5669d5a364d508da
freebrains/Python_basics
/Lesson_8.4.py
2,319
4.34375
4
""" Начните работу над проектом «Склад оргтехники». Создайте класс, описывающий склад. А также класс «Оргтехника», который будет базовым для классов-наследников. Эти классы — конкретные типы оргтехники (принтер, сканер, ксерокс). В базовом классе определить параметры, общие для приведенных типов. В классах-наследниках ...
false
9dec69e9d104c4011702af47bd2cc816109852ff
freebrains/Python_basics
/Lesson1.4.py
664
4.21875
4
''' Пользователь вводит целое положительное число. Найдите самую большую цифру в числе. Для решения используйте цикл while и арифметические операции. The user enters integer. Find the largest digit in the number. Use while cycle and arithmetic operations. ''' number = int(input("Enter the number - ")) a = number % 10...
false
1d40d049794faa916c6f4a845d138e1b02ae8ef7
jamilcse13/python-and-flask-udemy
/16. whileLoop.py
598
4.1875
4
count = 0 while count<10: count += 1 print("count=", count) print("good bye!") ## while loop else statement count = 0 while count<10: print(count, "is less than 10") count += 1 else: print(count, "is not less than 10") print("good bye!") # single statement suits flag = 1 #it eill be an in...
true
70d8a528a99c1599b955146f76a6c9db09b9f3e8
TarunVenkataRamesh-0515/19A91A0515_IICSEA_IVSEM_PYTHONLAB_1_TO_3
/distance.py
368
4.125
4
""" Implement a python script to compute distance between two points taking inp from the user (Pythagorean Theorem) """ x1=int(input("enter x1 : ")) x2=int(input("enter x2 : ")) y1=int(input("enter y1 : ")) y2=int(input("enter y2 : ")) result= ((((x2 - x1 )**2) + ((y2-y1)**2) )**0.5) print("distance ...
false
54b8b9b9be1d12692909024eeb63535055a70268
piotrpasich/python_exercises
/zestaw8.py
2,152
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Piotr Pasich, Łukasz Wycisło WSB, Informatyka, Niestacjonarne, Programowanie w jezyku Python Zestaw 8 """ """ Zadanie 1. Napisz program zawierający instrukcję rysowania trójkąta równobocznego . """ import turtle def zadanie1(): t = turtle.Turtle() for i...
false
de7ba808f6b8b5e1296dfa2ab02918ba520b8b0f
vandecloud/python
/10-set-diccionarios/diccionarios.py
836
4.3125
4
""" DICCIONARIOS Un diccionario es un tipo de dato que almacena un conunto de datos. en formato clave > valor es parcecido a un array asociativo o un objeto json. """ """ persona = { "nombre": "Pablo", "apellido": "Vande", "Web": "a definir" } print(type(persona)) print(persona["apellido"]) # Acceder ...
false
6a40da9daeb7b5c96488dd8552caafac2f0e0044
tedgey/while_loop_exercises
/p_a_s_II.py
346
4.15625
4
# print a square II - user chooses square size square_size_input = input("How long should the square's sides be? ") square_size_length = int(square_size_input) symbol_count = square_size_length * ("*") counter = 0 while counter < square_size_length: counter = counter + 1 if counter <= square_size_length: ...
true
22f7df39cb5e448034c348c6b3587138de937361
MTDahmer/Portfolio
/hw2.py
2,972
4.28125
4
# File: hw2.py # Author: Mitchell Dahmer # Date: 9/18/17 # Section: 503 # E-mail: mtdahmer@tamu.edu # Description: a program that takes two operands from a user and then modifies them based on the operation given by the user in the form of a string import math def main(): firstInteger = int(input("Please...
true