blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
e4b5f7e681c9d120db28b00022e9a90d36bf3014
ruthiler/Python_Exercicios
/Desafio081.py
778
4.15625
4
# Desafio 081: Crie um programa que vai ler vários números # e colocar em uma lista. Depois disso, mostre: # A) Quantos números foram digitados. # B) A lista de valores, ordenada de forma decrescente. # C) Se o valor 5 foi digitado e está ou não na lista. lista = [] while True: num = int(input('Digite um numero: '...
false
ae1562f866cb8c54589f22867ba55c460fde26b3
keshavsingh4522/Data-Structure-and-Algorithm
/prefix infix postfix/prefix_to_postfix.py
689
4.21875
4
''' Algorith: - Read the Prefix expression in reverse order (from right to left) - If the symbol is an operand, then push it onto the Stack - If the symbol is an operator, then pop two operands from the Stack - Create a string by concatenating the two operands and the operator after them. - string = operand1 + operand2...
true
561ee4fb8b21c6eb2b2a3e0d9faab32145c58318
jain7727/html
/2nd largest.py
278
4.25
4
num1=int(input("enter the first no")) num2=int(input("enter the second no")) num3=int(input("enter the third no")) print(num1,num2,num3) if(num1>num2>num3): print("2nd largest no is ", num2) elif(num2>num3>num1): print("2nd largest no is ", num3) else: print(num1)
true
aeacf45d361391794fdb3966e1a5ee11942601cc
Christasen/CSCI1133_FALL2017
/lab2/olympics.py
598
4.4375
4
import turtle turtle.pensize(10) def drawcircle(radius): turtle.circle(radius) radius1 = int(input("Enter the radius of the circle: ")) turtle.color("black") drawcircle(radius1) turtle.color("red") turtle.penup() turtle.forward(128) turtle.pendown() drawcircle(radius1) turtle.color("blue") turtle.penup() turtl...
false
ce82b959a4c69edd5f154945200738d35e89461f
delroy2826/Programs_MasterBranch
/Iterator.py
419
4.125
4
#1 l=[1,2,3,4,5] a=iter(l) print(next(a)) print(next(a)) #2 l=[1,2,3,4,5] a=iter(l) print(*a) #3 l=[1,2,3,4,5] a=iter(l) for i in range(len(l)): print(next(a)) #4 l=[1,2,3,4,5,6] a=iter(l) while True: try: print(next(a)) except Exception: break #5 l=[1,2,3,4,5,6] a=iter(l) for i in l: ...
false
18d1349155c4a17df235d6ef2a6adbaefd711cf8
delroy2826/Programs_MasterBranch
/regular_expression_excercise.py
2,675
4.59375
5
#1 Write a Python program to check that a string contains only a certain set of characters (in this case a-z, A-Z and 0-9). import re def check(str1): match = pattern.search(str1) return not bool(match) pattern = re.compile(r'[^\w+]') str1 = "delro3y1229" print(check(str1)) str1 = "delro#3y1229" print(check(st...
true
685b6d24ea305987969e83fd0c892c1a4c81c730
delroy2826/Programs_MasterBranch
/pynative10.py
781
4.21875
4
#Question 10: Given a two list of ints create a third list such that should #contain only odd numbers from the first list and even numbers from the second list def merge_even_odd(listOne,listTwo): l=[] for i in listOne: if i%2!=0: l.append(i) for i in listTwo: if i%2==0: ...
false
bb4387856d4d8d6e7d993d228cd87988a69ad828
delroy2826/Programs_MasterBranch
/Encapsulation.py
1,787
4.125
4
#1 class Student(): def __init__(self): self.name=input("Enter The Name:") self.__grade = "A+" def display(self): print("Name: {} ".format(self.name)) print("Grade: {}".format(self.__grade)) s=Student() s.display() #2 class Student(): def __init__(self,__grade): self...
false
d4352cfdd84a15f13d8c17ce5e69d6f20b0d3952
delroy2826/Programs_MasterBranch
/pynativedatastruct5.py
277
4.21875
4
#Given a two list of equal size create a set such that it shows the element from both lists in the pair firstList = [1, 2, 3, 4, 5] secondList = [10, 20, 30, 40, 50] new_list = [] for i in range(len(firstList)): new_list.append((firstList[i],secondList[i])) print(new_list)
true
7df218023262b52b2f34d6fc0700debb4579b7e7
samirdave1992/Learn-Python-3-the-hard-way
/Dictionaries.py
1,073
4.25
4
person={'name':'Noma','Age': 37,'height':5*12+5 } print(person['name']) print(person['Age']) person['city']="DFW" print(person['city']) print(person) ##Lets do some dictionaries for states states={ 'Oregon':'OR', 'Florida':'FL', 'Texas':'TX', 'California':'CA', 'New York':'NY' } #Cities cit...
false
a47908baf91fad4982439dfd1c66059761aa92e4
catliaw/hb_coding_challenges
/concatlists.py
1,054
4.59375
5
"""Given two lists, concatenate the second list at the end of the first. For example, given ``[1, 2]`` and ``[3, 4]``:: >>> concat_lists([1, 2], [3, 4]) [1, 2, 3, 4] It should work if either list is empty:: >>> concat_lists([], [1, 2]) [1, 2] >>> concat_lists([1, 2], []) [1, 2] >>> con...
true
fb218791404f9ab8db796661c91e1ab0097af097
yu-shin/yu-shin.github.io
/downloads/code/LeetCode/Array-Introduction/q977_MergeSort.py
1,533
4.5
4
# Python3 program to Sort square of the numbers of the array # function to sort array after doing squares of elements def sortSquares(arr, n): # first dived array into part negative and positive K = 0 for K in range(n): if (arr[K] >= 0 ): break # Now do the same process ...
true
f063661003366dcd4a6038aecd597fe3376daf88
PrithviSathish/School-Projects
/AscendingOrder.py
745
4.21875
4
num1 = int(input("Enter num1: ")) num2 = int(input("Enter num2: ")) num3 = int(input("Enter num3: ")) if num1 < num2: if num1 < num3: print(num1, end=" << ") if num2 < num3: print(num2, end=" << ") print(num3) else: print(num3, end= " << ") pr...
false
ae8a8fe70d16bd05d33c7f85b399699f737c2cba
PrithviSathish/School-Projects
/LargestNumber.py
292
4.21875
4
x = float(input("Enter the value of x: ")) y = float(input("Enter the value of y: ")) z = float(input("Enter the value of z: ")) if x > y and x > z: print("x is the greatest number") elif y > x and y > z: print("Y is the greatest number") else: print("z is the greatest number")
false
fb9f96fd4b3a3becd84531f4d07748c13bf6706d
kawing-ho/pl2py-ass1
/test01.py
268
4.53125
5
#!/usr/bin/python3 # Use of "#" character in code to mimic comments for x in range(0,5): print("This line does't have any hash characters :)") #for now print("but this one does! #whatcouldgowrong ? ") #what happens here ? print("I love '#'s") and exit(ord('#'))
true
71b552431f56fea84e1062924a6c1782449fe976
PrechyDev/Zuri
/budget.py
1,882
4.1875
4
class Budget: ''' The Budget class creates budget instances for various categories. A user can add funds, withdraw funds and calculate the balance in each category A user can also transfer funds between categories. ''' ##total balance for all categories total_balance = 0 @classmethod ...
true
c6d42c4b71ff23b766ba511a8d808176b33dc442
sebdelas/Alyra-Excercice-1.1.3
/1.1.3.py
570
4.1875
4
#!/usr/bin/env python3 def is_palindrome(mot): inverse = ''; for i in reversed(range(0,len(mot))): if (mot[i] != " "): inverse = inverse + mot[i] saisie_sans_espace = mot.replace(" ", "") if (inverse == saisie_sans_espace): return True else: return False saisie ...
false
d30896b9eb8a8bf8f73d05439906a5fd1a5c1973
Weyinmik/pythonDjangoJourney
/dataTypeNumbers.py
581
4.21875
4
""" We have integers and floats """ a = 14 print(a) b = 4 print(b) print(a + b) # print addition of a and b, 18. print(a - b) # print subtraction of a and b, 10. print(a * b) # print multiplication of a and b, 56. print(a / b) # print division of a and b in the complete decimal format, -...
true
f7e5cd52ac7324617717081db83c6b849f5fab32
katecpp/PythonExercises
/24_tic_tac_toe_1.py
546
4.125
4
#! python3 def readInteger(): value = "" while value.isdigit() == False: value = input("The size of the board: ") if value.isdigit() == False: print("This is not a number!") return int(value) def printHorizontal(size): print(size * " ---") def printVertical(size): prin...
true
c6ff43950f21b27f9c3dd61cf3d6840748ad2864
katecpp/PythonExercises
/11_check_primality.py
515
4.21875
4
#! python3 import math def readInteger(): value = "" while value.isdigit() == False: value = input("Check primality of number: ") if value.isdigit() == False: print("This is not a number!") return int(value) def isPrime(number): upperBound = int(math.sqrt(number)) for ...
true
d849a589929e610b588067d845bfcf182ca5b3b5
Legoota/PythonAlgorithmTraining
/Sorts/mergesort.py
572
4.125
4
def mergesort(array): if len(array) < 2: return array center = len(array)//2 left, right = array[:center], array[center:] left = mergesort(left) right = mergesort(right) return mergelists(left, right) def mergelists(left, right): result = [] while len(left) > 0 and len(right) >...
true
1a76893e4c43f750bc68c1f023c65f013a919035
muslinovsultan/ekzamen
/zadachi.py
2,291
4.21875
4
class CoffeeMachine: def __init__(self, milk,coffee,sugar): self.milk = milk self.coffee = coffee self.sugar = sugar def make_coffee(self,milk,coffee,sugar): if milk > self.milk and coffee > self.coffee and sugar > self.sugar: min = milk - self.milk min2 = coffee - self.coffee min3 = sugar - self...
false
8d42b48047fa49b956547b36a0ac234fe73a79e6
tlima1011/python3-curso-em-video
/ex063.py
624
4.1875
4
from ex063_fibonacci_packages import fibo_while, fibo_for print('-=' * 10) print(' FIBONACCI VS. 1.0') print('-=' * 10) while True: n1 = n3 = 0 n2 = 1 termos = int(input('Quantos termos: ')) op = int(input('''[ 1 ] - FIBONACCI COM FOR [ 2 ] - FIBONACCI COM WHILE [ 3 ] - SAIR Opção.: '''))...
false
58451f498859eb61cd3e28d95915567432396483
avigautam-329/Interview-Preparation
/OS/SemaphoreBasics.py
842
4.15625
4
from threading import Thread, Semaphore import time # creating semaphore instance to define the number of threads that can run at once. obj = Semaphore(3) def display(name): # THis is where the thread acquire's the lock and the value of semaphore will decrease by 1. obj.acquire() for i in range(3): ...
true
839181892842d62b803ab6040c89f29a2718514e
chuducthang77/Summer_code
/front-end/python/project301.py
1,158
4.15625
4
#Project 301: Banking App #Class Based # Withdraw and Deposit # Write the transaction to a python file class Bank: def __init__(self, init=0): self.balance = init def deposit(self, amount): self.balance += amount def withdraw(self, amount): self.balance -= amount account = Bank()...
true
798f3df4e5b30737ace8d3071d048a59745494e8
bjchu5/pythonSort
/insertionsort.py
1,848
4.5
4
def insertionsort_method1(aList): """ This is a Insertion Sort algorithm :param n: size of the list :param temp: temporarily stores value in the list to swap later on :param aList: An unsorted list :return: A sorted ist :precondition: An unsorted list :Co...
true
760aed2a0b0d6f2e8bdbaa3007527905670290f4
erichuang2015/PythonNotes
/code/023_常用模块/作业1.py
1,216
4.21875
4
# -*- coding: utf-8 -*- # @Time : 2020/1/5 15:33 # @Author : 童庆 # @FileName : 作业1.py # @Software : PyCharm import random # 数字验证码 def code(n=6): s = '' for i in range(n): num = random.randint(0,9) s += str(num) return s print(code(4)) print(code()) # 数字和字母验证码 def code(n=6): s =...
false
ed571b223307d9ccf5f43fcc1d1aa0469c213bbf
Dongmo12/full-stack-projects
/Week 5 - OOP/Day 3/exercises.py
666
4.34375
4
''' Exercise 1 : Built-In Functions Python has many built-in functions, and if you do not know how to use it, you can read document online. But Python has a built-in document function for every built-in functions. Write a program to print some Python built-in functions documents, such as abs(), int(), raw_input(). And...
true
fcb2f3f5194583a7162a38322303ab2945c8de79
Dongmo12/full-stack-projects
/Week 4 Python and web programming/Day 2/exercises.py
1,705
4.5
4
''' Exercise 1 : Favorite Numbers Create a set called my_fav_numbers with your favorites numbers. Add two new numbers to it. Remove the last one. Create a set called friend_fav_numbers with your friend’s favorites numbers. Concatenate my_fav_numbers and friend_fav_numbers to our_fav_numbers. # Solution my_fav_numbers...
true
790e8b58ab3d9178d1468041d9f77b17c63fa8c1
Dongmo12/full-stack-projects
/Week 4 Python and web programming/Day 1/exercises.py
2,370
4.5
4
''' Exercise 4 : Your Computer Brand Create a variable called computer_brand that contains the brand of your computer. Insert and print the above variable in a sentence,like "I have a razer computer". # Solution computer_brand = "msi" print('I have a {} computer'.format(computer_brand)) ''' ''' Exercise 5: Your Infor...
true
edfcc0b98db78aa300f6cf4a804757129cf53321
harasees-singh/Notes
/Searching/Binary_Search_Bisect.py
947
4.125
4
import bisect # time complexities of bisect left and right are O(logn) li = [8, 10, 45, 46, 47, 45, 42, 12] index_where_x_should_be_inserted_is = bisect.bisect_right(li, 13) # 2 returned index_where_x_should_be_inserted_is = bisect.bisect_left(li, 46) # 4 returned print(index_where_x_should_be_inserted_is) p...
true
c3231050b14c3767a075b52879b77843b9d4ce93
ericzhai918/Python
/LXF_Python/Function_test/func_positional_para.py
282
4.125
4
# 计算x的平方 def power(x): return x * x print(power(2)) # 如果要计算x的三次方,四次方呢?x*x*x,x*x*x*x这样显然很冗余 def power(x, n): s = 1 while n > 0: n = n - 1 s = s * x return s print(power(5,2)) print(power(5,3))
false
7d19e951c93430142e5c3da607063dc5da602fb3
Deepak3211/python-_refresher
/assignment.py
1,058
4.21875
4
#Question 1 x=['Python','Java','Ruby'] x #Question 2 x=['Python','Java','Ruby'] y=['c++','c','php'] x+y #Question 3 x=['Deepak','Deepak','Rohan','Ayush'] x.count('Deepak') #Question 4 x=['Deepak','Deepak','Rohan','Ayush'] x.sort() x #Question 5 x=['Deepak','Deepak','Rohan','Ayush'] x.sort() x y=['Surya','Rock','Pu...
false
62b6bcd482dd774b75a816056a21247487f32b86
maindolaamit/tutorials
/python/Beginer/higher_lower_guess_game.py
1,519
4.3125
4
""" A sample game to guess a number between 1 and 100 """ import random rules = """ ========================================================================================================= = Hi, Below are the rules of the game !!!! = = 1. At the Start of th...
true
ecf870ac240d1faf8202039bcc235bdb14bb8440
vsandadi/dna_sequence_design
/generating_dna_sequences.py
2,007
4.28125
4
''' Function to generate DNA sequences for each bit string. ''' #initial_sequence = 'ATTCCGAGA' #mutation_list = [(2, 'T', 'C'), (4, 'C', 'A')] #bitstring = ['101', '100'] def generating_sequences(initial_sequence, mutation_list, bitstring): ''' Inputs: initial_sequence as a string of DNA bases ...
true
c94e9353f23c7b746c123d928db75e5474b1ca57
janetschel/exercises
/week_01/01_input-output/04_circle_circumference-and-surface-area.py
356
4.25
4
""" Schreibt ein Programm, welches den Umfang und den Flächeninhalt eines Kreises berechnet. Der Benutzer gibt den Radius an. """ PI = 3.141592653589793 radiusInput = input("Radius: ") radius = float(radiusInput) circumference = 2 * PI * radius surfaceArea = PI * radius ** 2 print(f"Umfang: {circumference}") print...
false
aa4d1e8e167031b5cf5637c76e25cc61e82a5fb0
r0ckyyr0cks/PycharmProjects
/Automation/PythonCode/LoopSyntax1.py
252
4.21875
4
# For loop with final range for i in range(10): print(i) print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") # For loop with user input num = input("Please enter a number => ") for i in range(int(num)): print(i)
false
ac5f3db25ad77c00c62db5f2c7852e08a6f41fee
Tomaltach/Tutorials
/Python/Algorithms/find_peak.py
1,192
4.125
4
#demonstrate how to use a class with Tkinter class Application: """ Algorithms """ def __init__(self): """ Initialize the Program """ self.get_input() def get_input(self): """ Get user input """ input = raw_input('Enter numbers to be put into array using , to seperate numbers: ') self.numbers = map(int, i...
false
7562da63409e44a8a4a77032f0ad5a2bb611b1ca
summitkumarsharma/pythontutorials
/tut21.py
1,003
4.65625
5
# operators in python # 1.Arithmetic operators # 2.Assignment operators # 3.Comparison operators # 4.logical operators # 5.Identity operators # 6.Membership operators # 7.Bitwise operators # 1.Arithmetic operators # print("5 + 6 is =", 5+6) # print("5 - 6 is =", 5-6) # print("5 * 6 is =", 5*6) # print("5 / 6 is =", ...
false
18b3a779a6f144bf679eb47b8438b997e87f04ba
summitkumarsharma/pythontutorials
/tut28.py
752
4.1875
4
# file handling - write operation # f = open("test-write.txt", "w") # content = "To write to an existing file, you must add a parameter to the open()function" \ # "\n1.a - Append - will append to the end of the file \n2.w - Write - will overwrite any existing content" # no_of_chars = f.write(content) # print...
true
f07bddfa311a3cf735afe4d7e7f139a0bbe94c6c
KiikiTinna/Python_programming_exercises
/41to45.py
1,684
4.15625
4
#Question 41: Create a function that takes a word from user and translates it using a dictionary of three words, #returning a message when the word is not in the dict, # considering user may enter different letter cases d = dict(weather = "clima", earth = "terra", rain = "chuva") #Question 42: Print out the ...
true
e33098027d5d81e360ab6bfa59e21518b60fafb5
simarjeetsingh/Python
/Ejercicios Python/ej_06.py
780
4.34375
4
'''Escribe un programa que pida por teclado dos valores de tipo numérico que se han de guardar en sendas variables. ¿Qué instrucciones habría que utilizar para intercambiar su contenido? (es necesario utilizar una variable auxiliar). Para comprobar que el algoritmo ideado es correcto, muestra en pantalla el...
false
b3a98b16474442b4f12dc647514db6fd9b80f63e
1Magnus/pythonProject19_07_2021
/lesson_3/hw_5.py
644
4.25
4
# В массиве найти максимальный отрицательный элемент. Вывести на экран его значение и позицию в массиве. import random def rand_mass(N): a = [0] * N for i in range(N): a[i] = random.randint(-99, 99) return a def main(): N = 10 a = rand_mass(N) print(a) b = [] for i in a: ...
false
b878710a1e80355e01500b6a10601bf03f8c4f8b
LuckyDima/Geekbrains_DB_0607
/GeekBrains_local/Основы языка Python. Интерактивный курс/05 Модули и библиотеки/Lesson2.py
844
4.15625
4
# 2: Создайте модуль. В нем создайте функцию, которая принимает список и возвращает из него случайный элемент. # Если список пустой функция должна вернуть None. Проверьте работу функций в этом же модуле. # Примечание: Список для проверки введите вручную. Или возьмите этот: [1, 2, 3, 4] from random import choice, randi...
false
c65bc508a10563fa6a391cdfdd1997db19569b7a
bsamaha/hackerrank_coding_challenges
/Sock Merchant.py
761
4.125
4
# %% from collections import defaultdict # Complete the sockMerchant function below. def sockMerchant(n, ar): """[Find how many pairs can be made from a list of integers] Args: n ([int]): [nymber of socks] ar ([list of integers]): [inventory of socks] Returns: [type]: [description...
true
e064d9a951cc77879be234b921f3712a4782652e
jz1611/python-codewars
/squareDigits.py
377
4.1875
4
# Welcome. In this kata, you are asked to square every digit of a number. # For example, if we run 9119 through the function, 811181 will come out, # because 92 is 81 and 12 is 1. # Note: The function accepts an integer and returns an integer def square_digits(num): new = [] for num in list(str(num)): new.ap...
true
ed043fea8d74a1f790a593901cc0a3f516935329
cuongnb14/python-design-pattern
/sourcecode/data_structure/queue.py
1,126
4.125
4
class Node: data = None next = None def __init__(self, data=None): self.data = data class Queue: def __init__(self): self.length = 0 self.head = None self.last = None def is_empty(self): return self.length == 0 def push(self, node): if not isi...
false
d75bbaf6a902034ade93a755ce5762091a2f2532
driscolllu17/csf_prog_labs
/hw2.py
2,408
4.375
4
# Name: Joseph Barnes # Evergreen Login: barjos05 # Computer Science Foundations # Homework 2 # You may do your work by editing this file, or by typing code at the # command line and copying it into the appropriate part of this file when # you are done. When you are done, running this file should compute and # print ...
true
498852c54abdaf2be80bfe67dc88c0490f5a8ae1
chrisalexman/google-it-automation-with-python
/Crash Course in Python/Week_2/main.py
2,822
4.1875
4
# Data Types x = 2.5 print(type(x)) print("\n") # Expressions length = 10 width = 5 area = length * width print(area) print("\n") # Expressions, Numbers, and Type Conversions print(7 + 8.5) # implicit conversion print("a" + "b" + "c") print("\n") base = 6 height = 3 area = (base * height) /...
true
d7d25a4d0eed0b020901a5cad860743b4ad24396
sam23456/pythonclassfiles
/list data type.py
856
4.25
4
#!/usr/bin/env python # coding: utf-8 # In[2]: course = ['linux','python','aws','devops','sql'] # In[3]: print(course) # In[ ]: # In[ ]: # In[5]: #indexing # In[6]: print(course[3]) # In[7]: print(course[3].title()) # In[8]: course.append('linux') # In[9]: print(course) # In[10]: ...
false
cf2ed5f62e36f00f2f5dead043ceec03a21a5ab3
AlexFeeley/RummyAIBot
/tests/test_card.py
2,223
4.21875
4
import unittest from src.card import * # Tests the card class using standard unit tests # from src.card import Card class TestCard(unittest.TestCase): # Tests constructor returns valid suit and number of card created def test_constructor(self): card = Card("Hearts", 3) self.assertEqual(card...
true
de7296225ab80c6c325bd91d83eae0610115b263
kvraiden/Simple-Python-Projects
/T3.py
266
4.21875
4
print('This a program to find area of a triangle') #The formulae is 1/2 h*b h = float(input("Enter the height of the triangle: ")) b = float(input("Enter the base of the triangle: ")) area = 1/2*h*b print("The area of given triangle is %0.2f" % (area)+" unit.")
true
b50f2c051b7ae0506cbc6f8a414d943ab3a20c51
tristandaly/CS50
/PSET6/mario/more/mario.py
727
4.1875
4
from cs50 import get_int def main(): # Begin loop - continues until a number from 1-8 is entered while True: Height = get_int("Height: ") if Height >= 1 and Height <= 8: break # Based on height, spaces are added to the equivalent of height - 1, subtracting with each row from t...
true
c8646e494885027bdf3819d0773b1ebb698db0a1
fatih-iver/Daily-Coding-Interview-Solutions
/Question #7 - Facebook.py
951
4.21875
4
""" This problem was asked by Facebook. Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'. You can assume that the messages are decodable. For example, '001' i...
true
3e3f17c7877bf2001a9de9d48ca4b9652648bc1f
natepill/problem-solving
/PracticePython/Fibonacci.py
490
4.25
4
# Write a program that asks the user how many Fibonnaci numbers to generate and then generates them. # Take this opportunity to think about how you can use functions. # Make sure to ask the user to enter the number of numbers in the sequence to generate. # (Hint: The Fibonnaci seqence is a sequence of numbers where the...
true
013df573816baa9cf6c821223de06b773fbe8d1f
ricardosmotta/python_faculdade
/aulapratica4_ex1.py
1,085
4.15625
4
op = input('Qual operação você deseja realizar? + , - , * ou / : ') if (op == '+') or (op == '-') or (op == '*') or (op == '/'): v1 = int(input('Digite um valor inteiro: ')) v2 = int(input('Digite outro valor inteiro: ')) while op != 's': if (op == '+'): res = v1 + v2 print('Resultado da...
false
56b407e19a71898f123b688c28d8e5e85cef69ca
ricardosmotta/python_faculdade
/aula3_exercicio4.py
836
4.125
4
print('[ 1 ] Maçã') print('[ 2 ] Laranja') print('[ 3 ] Banana') prod = int(input('Qual dos produtos acima você deseja? ')) while prod != 1 and prod != 2 and prod != 3: print('Escolha um valor válido!!!') prod = int(input('Qual dos produtos acima você deseja? ')) if prod == 1 or prod == 2 or prod == 3: ...
false
5e37fb9cff13522653e0e9006951e0db5839e259
aarontinn13/Winter-Quarter-History
/Homework2/problem6.py
938
4.3125
4
def palindrome_tester(phrase): #takes raw phrase and removes all spaces phrase_without_spaces = phrase.replace(' ', '') #takes phrase and removes all special characters AND numbers phrase_alpha_numeric = ''.join(i for i in phrase_without_spaces if i.isalpha()) #takes phrase and transforms all upper ...
true
bf26a7742b55fa080d22c1fadffccbf21ae9ce34
aarontinn13/Winter-Quarter-History
/Homework3/problem7.py
1,088
4.28125
4
def centered_average_with_iteration(nums): #sort list first nums = sorted(nums) if len(nums) > 2: #remove last element nums.remove(nums[-1]) #remove first element nums.remove(nums[0]) #create total total = 0.0 #iterate through and add all remaining in ...
true
4d80546ca7dfd20737f12f2dfddf3f9a0b5db00b
nip009/2048
/twentyfortyeight.py
2,776
4.125
4
# Link to the problem: https://open.kattis.com/problems/2048 def printArr(grid): for i in range(len(grid)): row = "" for j in range(len(grid[i])): if(j != 3): row += str(grid[i][j]) + " " else: row += str(grid[i][j]) print(row) def ...
true
00656448d492d437654d9bc7a513a5239b26e04b
vinny0965/phyton
/1P/meuprojeto/Atividades 1VA/Nova Aula/Correção 1VA/resolucao prova - parte 2 - A vigança.py
2,216
4.21875
4
#Q8 #23 lista = [1,2,3,55,66,77,88,-1,-2,-3] #lista = [-1, -2, -3, -4, -5] """ #Retornar o maior elemento maior = lista[0] for numero in lista : if (numero > maior) : maior = numero print (f"Maior número:{maior}") #Forma alternativa de resolução #print (max(lista)) #Retornar a soma soma = 0 for numero...
false
41e11c5c0c449e131862c3ec423137bd9ce619b8
Yun-Su/python
/PythonApplication1/PythonApplication1/匿名函数.py
679
4.1875
4
#python 使用 lambda 来创建匿名函数。 #所谓匿名,意即不再使用 def 语句这样标准的形式定义一个函数。 #lambda的主体是一个表达式,而不是一个代码块。 #仅仅能在lambda表达式中封装有限的逻辑进去。 #lambda 函数拥有自己的命名空间, #不能访问自己参数列表之外或全局命名空间里的参数。 #虽然lambda函数看起来只能写一行,却不等同于C或C++的内联函数, #后者的目的是调用小函数时不占用栈内存从而增加运行效率 sum = lambda a,b: a + b #调用sum() print ("相加后的值为 : ", sum( 10, 20 )) print ("相加后的值为 : ", sum( 2...
false
e3ce4ff4dff53081b377cee46412ea42365651fa
digvijaybhakuni/python-playground
/pyListDictionaries/ch1-list.py
2,221
4.1875
4
numbers = [5, 6, 7, 8] print "Adding the numbers at indices 0 and 2..." print numbers[0] + numbers[2] print "Adding the numbers at indices 1 and 3..." print numbers[1] + numbers[3] """ Replace in Place """ zoo_animals = ["pangolin", "cassowary", "sloth", "tiger"] # Last night our zoo's sloth brutally...
true
52c0773a6f69824b10bfe91e91d21acb1154012b
pmcollins757/check_sudoku
/check_sudoku.py
2,091
4.1875
4
# -*- coding: utf-8 -*- """ Author: Patrick Collins """ # Sudoku puzzle solution checker that takes as input # a square list of lists representing an n x n # sudoku puzzle solution and returns the boolean # True if the input is a valid # sudoku square solution and returns the boolean False # otherwise. # A valid sudo...
true
60950955c5fcd3bc7a7410b78c3be383feb7e9ed
marcotello/PythonPractices
/Recursion/palindrome.py
1,696
4.4375
4
def reverse_string(input): """ Return reversed input string Examples: reverse_string("abc") returns "cba" Args: input(str): string to be reversed Returns: a string that is the reverse of input """ # TODO: Write your recursive string reverser solution here ...
true
a26b16019c44c2ff2ea44916bcc3fa66a62a826e
marcotello/PythonPractices
/P0/Task1.py
2,427
4.3125
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 1: How many different telephone num...
true
2252d7e3ea30fe49636bbeeb50f6c3b3c7fdf80d
marcotello/PythonPractices
/DataStrucutures/Linked_lists/flattening_linked_list.py
1,622
4.125
4
# Use this class as the nodes in your linked list class Node: def __init__(self, value): self.value = value self.next = None def __repr__(self): return str(self.value) class LinkedList: def __init__(self, head): self.head = head def append(self, value):...
true
1543e31bbe36f352dd18b284bd9fc688332e9486
LucasBeeman/Whats-for-dinner
/dinner.py
1,446
4.40625
4
import random ethnicity = [0, 1, 2, 3] type_choice = -1 user_choice = input("Which ethnnic resturaunt would you like to eat at? Italian(1), Indian(2), Chinese(3), Middle Eastern(4), Don't know(5)") #if the user pick I dont know, the code will pick one for them through randomness if user_choice.strip() == "5": ...
true
9f60c2a26e4ea5bf41c310598568ea0b532c167b
Rajeshinu/bitrm11
/4.Stringcount.py
231
4.25
4
"""Write a program that asks the user for a string and returns an estimate of how many words are in the string""" string=input("Please enter the string to count the number of words in the string\n") c=string.count(" ") print(c+1)
true
42bd0e1748a8964afe699112c9d63bc45cd421f3
Rajeshinu/bitrm11
/8.Numbersformat.py
347
4.125
4
"""Write a program that asks the user for a large integer and inserts commas into it according to the standard American convention for commas in large numbers. For instance, if the user enters 1000000, the output should be 1,000,000""" intnum=int(input(print("Please enter the large integer number : "))) fnum=format(...
true
50531ecdd319b058d9c2fe98b17a76a1392f85bf
Aqib04/tathastu_week_of_code
/Day4/p1.py
306
4.21875
4
size = int(input("Enter the size of tuple: ")) print("Enter the elements in tuple one by one") arr = [] for i in range(size): arr.append(input()) arr = tuple(arr) element = input("Enter the element whose occurrences you want to know: ") print("Tuple contains the element", arr.count(element), "times")
true
4d39b4b1e0d28374f5dbdf455db1e223aa48dc3a
petrewoo/Trash
/ex_iterator/p1.py
439
4.125
4
#!/usr/bin/env python # -*- encoding: utf-8 -*- class reverse_iter: def __init__(self, l): self._l = l def __iter__(self): return self def next(self): if len(self._l): return self._l.pop() else: raise StopIteration if __name__ == '__main__': ...
false
058d1ae6fa21662f7bac3d3e05ef0aedfdbe14b2
gneelimavarma/practicepython
/C-1.19.py
340
4.4375
4
##C-1.19 Demonstrate how to use Python’s list comprehension syntax to produce ##the list [ a , b , c , ..., z ], but without having to type all 26 such ##characters literally. ##ascii_value = ord('a') ##print(ascii_value) i=0 start = 97 ##ascii of 'a' result = [] while(i<26): result.append(chr(start+i)) i+=1 p...
true
4195b70fb68c585767702cf31041ee98535aea48
ianbel263/geekbrains_python
/lesson_1/task_5.py
920
4.125
4
company_income = int(input('Введите прибыль фирмы: ')) company_costs = int(input('Введите издержки фирмы: ')) if company_income > company_costs: print('Фирма работает с прибылью') company_profit = company_income - company_costs profitability = round(company_profit / company_income * 100, 2) print(f'Рен...
false
0396e783aca5febe373e32fc544dead5a5817760
marbor92/checkio_python
/index_power.py
367
4.125
4
# Function finds the N-th power of the element in the array with the index N. # If N is outside of the array, then return -1. def index_power(my_list, power) -> int: pos = 0 index = [] for i in my_list: index.append(pos) pos += 1 if power not in index: ans = -1 else: ...
true
2c455ec9c2bbd31d79aa5a3b69c4b9b17c25b7a7
whalenrp/IBM_Challenge
/SimpleLearner.py
1,584
4.125
4
import sys import math import csv from AbstractLearner import AbstractLearner class SimpleLearner(AbstractLearner): """ Derived class implementation of AbstractLearner. This class implements the learn() and classify() functions using a simple approach to classify all as true or false """ def __init__(self, trai...
true
bcda1f6f442b5219ce52c10c0bf51f59122f212c
benjie13/benjie-lattao
/loops_lattao.py
508
4.25
4
print ("2 to 10") for x in range (2,12,2): print(x) print ("3 to 15") for y in range(3,18,3): print(y) print ("4 to 20") for z in range (4,24,4): print(z) print ("12 to 36") for a in range (12,48,12): print(a) #nested loop sample print ("Multiplication") for y in range (1,11): for z ...
false
d272fde739325284f99d1f148d1603d739d24721
ganesh28gorli/Fibonacci-series
/fibonacci series.py
678
4.4375
4
#!/usr/bin/env python # coding: utf-8 # # fibonacci series # In[15]: # n is the number of terms to be printed in fibonacci series # In[16]: n = int(input("enter number of terms: ")) # In[17]: # assigning first two terms of the sequence # In[18]: a=0 b=1 # In[19]: #checking if the number of terms of...
true
aef6477c03006ff40a937946213ea05c1ec11106
ta11ey/algoPractice
/algorithms/linkedList_insertionSort.py
1,088
4.3125
4
# Given the head of a singly linked list, sort the list using insertion sort, and return the sorted list's head. # The steps of the insertion sort algorithm: # Insertion sort iterates, consuming one input element each repetition and growing a sorted output list. # At each iteration, insertion sort removes one element...
true
8b9ac54cf15648e5c5bb315fbd2e2d3bcffb5b9c
howraniheeresj/Programming-for-Everybody-Python-P4E-Coursera-Files
/Básicos/PygLatin.py
775
4.4375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- #o objetivo deste programa é mover a primeira letra da palavra para o final e adicionar ay. #Dessa forma, a palavra Batata vira atatabay pyg = 'ay' #primeiro define-se ay original = raw_input('Escolha uma palavra: ') #deixa um espaço para colocar uma palavra if len(ori...
false
600e7893f4e4f7cb0e6b8819d4e17cc718427ec8
dihogoteixeira/fiap-ctp-exercises
/exercicios-aula-08/AULA_08_Exercicio03.py
443
4.1875
4
contaCliente = input("Digite seu codigo de verificacao de 3 digitos: ") verificadorCliente = contaCliente[::-1] somaNumeroConta = int(contaCliente) + int(verificadorCliente) multiplicaDigito = list(str(somaNumeroConta)) digitoVerificador = int(multiplicaDigito[0]) *1 + int(multiplicaDigito[1]) *2 + int(multiplicaDigito...
false
6185ccae596ac60ad46d2788c30e035eb7153701
AilanPaula/Curso_em_video_Python3
/ex052.py
753
4.28125
4
''' Crie um programa onde o computador vai "pensar" em um número entre 0 e 10. Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer. ''' from random import randint print('Sou seu computador...') print('Acabei de pensar em um número entre 0 e 10.') p...
false
acc830fa259137641c7dcda20abd8b2b1a08a802
AilanPaula/Curso_em_video_Python3
/ex094.py
824
4.15625
4
''' Crie um programa que tenha a função leiaInt(), que vai funcionar de forma semelhante 'a função input() do Python, só que fazendo a validação para aceitar apenas um valor numérico. ''' def LeiaInt(resp): num = str(input(resp)) if num.isnumeric(): num = int(num) return num while not num.is...
false
4cc1e53231d01ca6445afab717339048af2cf378
AilanPaula/Curso_em_video_Python3
/ex053.py
1,214
4.28125
4
''' Crie um programa que leia dois valores e mostre um menu na tela: [ 1 ] somar [ 2 ] multiplicar [ 3 ] maior [ 4 ] novos números [ 5 ] sair do programa Seu programa deverá realizar a operação solicitada em cada caso. ''' n1 = int(input('Primeiro valor: ')) n2 = int(input('Segundo valor: ')) op = 0 while op !=5: ...
false
2a04e50ee49757c2ba2c9ae5ceeb5940e97c482e
AilanPaula/Curso_em_video_Python3
/ex090.py
767
4.125
4
''' um programa que tenha uma lista chamada números e duas funções chamadas sorteia() e somaPar(). A primeira função vai sortear 5 números e vai colocá-los dentro da lista e a segunda função vai mostrar a soma entre todos os valores pares sorteados pela função anterior. ''' from random import randint from time import s...
false
084cb1de7fece4e3f74452233bd61c03af0812b8
amitp-ai/Resources
/leet_code.py
1,353
4.65625
5
#test """ Syntax for decorators with parameters def decorator(p): def inner_func(): #do something return inner_func @decorator(params) def func_name(): ''' Function implementation''' The above code is equivalent to def func_name(): ''' Function implementation''' func_name = (decorator(para...
true
fb55395ee175bdce797e17f48c6c04d7f2c574a2
dukeofdisaster/HackerRank
/TimeConversion.py
2,484
4.21875
4
############################################################################### # TIME CONVERSION # Given a time in 12-hour am/pm format, convert it to military (24-hr) time. # # INPUT FORMAT # A single string containing a time in 12-hour clock format (hh:mm:ssAM or # hh:mm:ssPM) wehre 01 <= hh <= 12 and 00 <= mm, ss <...
true
b500774449d17ede116b123f293a89969d2a01c9
jimbrunop/brunoperotti
/Exercicios-Python/RepeticaoExercicio38.py
1,331
4.21875
4
# Um funcionário de uma empresa recebe aumento salarial anualmente: Sabe-se que: # Esse funcionário foi contratado em 1995, com salário inicial de R$ 1.000,00; # Em 1996 recebeu aumento de 1,5% sobre seu salário inicial; # A partir de 1997 (inclusive), os aumentos salariais sempre correspondem ao dobro do percentual do...
false
7a225d2e1f0ac5450917eb22f8f5537bac4be099
jimbrunop/brunoperotti
/Exercicios-Python/RepeticaoExercicio24.py
735
4.15625
4
# Faça um programa que calcule o mostre a média aritmética de N notas. quantidade_notas = int(input("informe a quantidade de notas do aluno: ")) def calcula_media(quantidade_notas): contador = 0 listagem_notas = [] while contador < quantidade_notas: nota_aluno = float(input("informe a nota: ")) ...
false
a8f8878c553a1ec9da4e70fb13af9223bebdb35d
jimbrunop/brunoperotti
/Exercicios-Python/RepeticaoExercicio1.py
414
4.21875
4
# Faça um programa que peça uma nota, entre zero e dez. Mostre uma mensagem caso o valor seja inválido e continue pedindo até que o usuário informe um valor válido. def valida_numero(): numero = float(input("informe um numero de 0 a 10: ")) while (numero > 10) or (numero < 0): numero = float(input("in...
false
f7c35cd71de55bd957da4338110c3343918c641d
Dr-A-Kale/Python-intro
/str_format.py
669
4.125
4
#https://python.swaroopch.com/basics.html age = 20 name = 'Swaroop' print('{0} was {1} years old when he wrote this book'.format(name, age)) print('Why is {0} playing with that python?'.format(name)) print(f'{name} was {age} years old when he wrote this book') print(f'Why is {name} playing with that python?') print("Wh...
true
03b4609e13f7b1f3bafbdc8c9ffc83e04ca49b04
KartikeyParashar/FunctionalPrograms
/LeapYear.py
322
4.21875
4
year = int(input("Enter the year you want to check that Leap Year or not: ")) if year%4==0: if year%100==0: if year%400==0: print("Yes it is a Leap Year") else: print("Not a Leap Year") else: print("Yes it is a Leap Year") else: print("No its not a Leap Year...
true
914d4fa9aeacfdb617b936cd783f52a0c4687f59
vltian/some_example_repo
/lesson_6_OOP/hw_62.py
1,195
4.53125
5
"""2. Реализовать класс Road (дорога), в котором определить атрибуты: length (длина), width (ширина). Значения данных атрибутов должны передаваться при создании экземпляра класса. Атрибуты сделать защищенными. Определить метод расчета массы асфальта, необходимого для покрытия всего дорожного полотна. Использовать форму...
false
169d013c1c226c53da4c2e5d0fa6444d7f8bb087
natalya-patrikeeva/interview_prep
/binary-search.py
1,672
4.3125
4
"""You're going to write a binary search function. You should use an iterative approach - meaning using loops. Your function should take two inputs: a Python list to search through, and the value you're searching for. Assume the list only has distinct elements, meaning there are no repeated values, and elements are in ...
true
eed9c8739eb2daa6ecbc47e10693e3d9b1970d82
sarthakjain95/UPESx162
/SEM I/CSE/PYTHON CLASS/CLASSx8.py
1,757
4.71875
5
# -*- coding: utf-8 -*- #! /usr/bin/env python3 # Classes and Objects # Suppose there is a class 'Vehicles' # A few of the other objects can be represented as objects/children of this super class # For instance, Car, Scooter, Truck are all vehicles and can be denoted as a derivative # of the class 'Vehicle' # Furthe...
true
f87f1f7c943f2b754de1c35a0f994c18201ca2fe
sarthakjain95/UPESx162
/SEM I/CSE/PYTHON PRACTICALS/PRACTICALx4B.py
2,687
4.125
4
# -*- coding: utf-8 -*- # PRACTICAL 4B # Q1) Find a factorial of given number. def getFacto(num): facto= 1 for i in range(1,num+1): facto*=i return facto n= int( input("Enter a number for factorial:") ) print( "Factorial is", getFacto(n) ) # Q2) To find whether the given number is Armstrong number. def isArms...
false
f0cf8343b7cb9293b5ecea2532953d0ca0b55d49
devaljansari/consultadd
/1.py
1,496
4.59375
5
"""Write a Python program to print the following string in a specific format (see the output). Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what y...
true
2b18385f2dc36a87477c3e7df27ff8bd2a988c33
heet-gorakhiya/Scaler-solutions
/Trees/Trees-1-AS_inorder_traversal.py
1,783
4.125
4
# Inorder Traversal # Problem Description # Given a binary tree, return the inorder traversal of its nodes values. # NOTE: Using recursion is not allowed. # Problem Constraints # 1 <= number of nodes <= 10^5 # Input Format # First and only argument is root node of the binary tree, A. # Output Format # Return an in...
true
459ee1c60423011457183df6e5a897df77b7b62d
ani07/Coding_Problems
/project_euler1.py
491
4.28125
4
""" This solution is based on Project Euler Problem Number 1. If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ class MultiplesThreeFive(): def multiples(self): sum =...
true
5d401b278b9e481bc02bfd5c57cedcbf945b9104
DeepakMe/Excellence-Technologies-
/QONE.py
309
4.15625
4
# Question1 # Q1.Write a function which returns sum of the list of numbers? # Ans: list1 = [1,2,3,4] def Sumlist(list,size): if (size==0): return 0 else: return list[size-1]+Sumlist(list,size-1) total = Sumlist(list1,len(list1)) print("Sum of given elements in List: ",total)
true