blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
a7745492208033ac49f8d0285ff7c141eed19a70
gatherworkshops/programming
/_courses/tkinter2/assets/zip/pythonchallenges-solutions/eventsdemo.py
2,908
4.21875
4
import tkinter import random FRUIT_OPTIONS = ["Orange", "Apple", "Banana", "Pear", "Jalapeno"] window = tkinter.Tk() # prints "hello" in the developer console def say_hello(event): name = name_entry.get() if len(name) > 0: print("Hello, " + name + "!") else: print("Hello random stranger...
true
d6eb76e86a7c77ce7f875289e87562990ed2bd58
karramsos/CipherPython
/caesarCipher.py
1,799
4.46875
4
#!/usr/bin/env python3 # The Caesar Cipher # Note that first you will need to download the pyperclip.py module and # place this file in the same directory (that is, folder) as the caesarCipher.py file. # http://inventwithpython.com/hacking (BSD Licensed) # Sukhvinder Singh | karramsos@gmail.com | @karramsos import py...
true
2ea42b749ee8320df5a7eda34a07e3bc683101b3
40168316/PythonTicketApplication
/TicketApplication.py
2,257
4.375
4
TICKET_PRICE = 10 SERVICE_CHARGE = 2 tickets_remaining = 100 # Create a function that calculates the cost of tickets def calculate_cost_of_tickets(num_tickets): # Add the service charge return (num_tickets * TICKET_PRICE) + SERVICE_CHARGE # Run this code continuously until we run out of tickets wh...
true
b49ea3e976180eecf26802fe0a6a198ce6e914fb
aabidshaikh86/Python
/Day3 B32.py
1,119
4.125
4
#!/usr/bin/env python # coding: utf-8 # In[2]: fullname = 'abid sheikh' print(fullname ) # In[ ]: # Req: correct the name format above by using the string method. # In[3]: print(fullname.title()) # Titlecase ---> first Letter of the word will be capital # In[ ]: # In[ ]: # Req: I want all the name ...
true
626aea1dbd007cc33e1c79e6fa7a35848f313cc5
aabidshaikh86/Python
/Day7 B32.py
1,888
4.375
4
#!/usr/bin/env python # coding: utf-8 # In[ ]: list Continuation : # In[ ]: # In[1]: cars = ['benz','toyota','maruti','audi','bnw'] # In[ ]: ## Organising the list datatype # In[ ]: req : i want to organise the data in the alphabetical order !!! A to Z # In[ ]: Two different approcahes : 1...
true
cba0e3df6ccef062a345234650ddb61b3e54a96a
ShahzaibSE/Python-Babysteps
/marksheet_maker.py
1,136
4.25
4
marks = [] eng_marks = int(input("Enter marks for English:")) marks.append(eng_marks) # chemistry_marks = int(input("Enter marks for Chemistry:")) marks.append(chemistry_marks) # computer_marks = int(input("Enter marks for Computer:")) marks.append(computer_marks) # physics_marks = int(input("Enter marks for Physics:")...
false
8d778b4cf8872d0c928d6a55933fcdfa86d0847d
Jasmine582/guess_number
/main.py
468
4.125
4
import random random_number = random.randrange(100) correct_guess = False while not correct_guess: user_input = input("Guess a number between 0 and 100:") try: number = int(user_input) if number == random_number: correct_guess = True elif number > random_number: print("You guessed too hig...
true
686d03d60a541f88178f065fb15790c836507c19
ringotian/LP14_homework
/additional_homework/string_challenges.py
951
4.1875
4
# Вывести последнюю букву в слове word = 'Архангельск' print(word[-1]) # Вывести количество букв "а" в слове word = 'Архангельск' print(word.lower().count('а')) # Вывести количество гласных букв в слове word = 'Архангельск' print(len([x for x in word.lower() if x in 'ауоыэяюёе'])) # Вывести количество слов в предл...
false
e00da369443f92f2e42d580635302cdf96ffa59b
Goku-kun/1000-ways-to-print-hello-world-in-python
/using-user-input.py
272
4.4375
4
# A program to print 'Hello, World!' by force typing it by the user himself def hello_world(): str = input("Enter 'Hello, World!' exactly: ") if str == 'Hello, World!': print(str) else: print('Try Again!') hello_world() hello_world()
false
f8390e1a672802dd30b581fb71a50b1a2d3fbcd5
kristopher-merolla/Dojo-Week-3
/python_stack/python_fundamentals/type_list.py
1,418
4.46875
4
# Write a program that takes a list and prints a message for each element in the list, based on that element's data type. # Your program input will always be a list. For each item in the list, test its data type. If the item is a string, concatenate it onto a new string. If it is a number, add it to a running sum. At ...
true
3caf05cc3eb9cee2e9e0d7ad2ef9882a32a8668d
niteeshmittal/Training
/python/basic/Directory.py
1,490
4.125
4
#Directory try: fo = open("phonenum.txt") #print("phonenum.txt exists. We are good to go.") except IOError as e: if (e.args[1] == "No such file or directory"): #print("File doesn't exists. Creating a phonenum.txt.") fo = open("phonenum.txt", "w") finally: fo.close() opt = input("1 for store and 2 for read: ")...
true
3dde22d71aab3f343ef9f0aa6707e7b6a9220a61
rjcmarkelz/python_the_hard_way
/functional_python/chp1_1.py
1,619
4.15625
4
# chapter 1 of functional python book def sum(seq): if len(seq) == 0: return 0 return seq[0] + sum(seq[1:]) sum([1, 2, 3, 4, 1]) sum([1]) # recursive def until(n, filter_func, v): if v == n: return [] if filter_func(v): return [v] + until(n, filter_func, v+1) else: ...
true
40f54f4122729cba200e3ede71fcbab9ad4481f3
alexspring123/machine-leaning-study
/scikit-lean/linear-models/Ordinary-Least-Squares/OrdinaryLeastSquares.py
1,076
4.1875
4
''' 普通最小二乘法 根据商品历史销量预测未来销量 ''' import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model def get_data(file_name): "获取训练数据" # https://chrisalbon.com/python/pandas_dataframe_importing_csv.html data = pd.read_csv(file_name) x = np.array(data[['week']]...
false
b9b22be77a2ec061bba9dea6a8967e6f18e1da3c
cumtqiangqiang/leetcode
/top100LinkedQuestions/5_longest_palindromic_sub.py
783
4.125
4
''' Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd" Output: "bb" ''' def longestPalindrome(s: str) -> str: start = 0 end = 0 for i in range(len(s...
true
560f616083f33b95ba075a311d5c0a799f7c466b
Afraysse/practice_problems_II
/HB_warm_ups.py
1,889
4.28125
4
""" REVERSE A STRING RECURSIVELY """ def reverse_string(string): output = "" if len(string) == 0: return output output += string[-1] return output + reverse_string(string[:-1]) """ REVERSE STRING WITH INDEXES """ def reverse_string_indexes(string): return string[::-1] """ SUM ITEMS IN...
false
f1386a1b5ff8705938dbdd96f11c954fdf1dfd3c
diceitoga/regularW3PythonExercise
/Exercise8.py
339
4.125
4
#Exerciese 8: 8. Write a Python program to display the first and last colors from the following list. Go to the editor #color_list = ["Red","Green","White" ,"Black"] color_list = ["Red","Green","White" ,"Black"] lengthof=len(color_list) print("First Item: {}".format(color_list[0])) print("Last Item: {}".format(color_...
true
cf2a4e7217f251ae3b854f5c5c44eaa3ea3f140b
diceitoga/regularW3PythonExercise
/Ex19_is.py
413
4.21875
4
#Ex 19: Write a Python program to get a new string from a given string where "Is" has been added to the front. #If the given string already begins with "Is" then return the string unchanged print("test") sentence_string = input("Please enter a short sentence and I will add something: ") first_l = sentence_string.spli...
true
84fee185f3fbf9a59cf1efe89ca7ff5472e97691
diceitoga/regularW3PythonExercise
/Ex21even_odd.py
388
4.46875
4
#Ex21. Write a Python program to find whether a given number (accept from the user) is even or odd, #print out an appropriate message to the user. def even_odd(num): even_odd = '' if num%2==0: even_odd = 'even' else: even_odd = 'odd' return even_odd what_isit =even_odd(int(input("Please enter an integer betw...
true
d83882634e4db5e59edfbb1c760ef0483010fd3b
joqhuang/si
/lecture_exercises/gradepredict.py
2,003
4.40625
4
# discussion sections: 13, drop 2 # homeworks: 14, drop 2 # lecture exercise: 26, drop 4 # midterms: 2 # projects: 3 # final project: 1 # get the data into program # extract information from a CSV file with all the assignment types and scores # return a data dictionary, where the keys are assignment groups and values ...
true
0abe0e63e9cd588267c456a87ea6ce6068e3da15
Tonyqu123/data-structure-algorithm
/Valid Palindrome.py
720
4.3125
4
# Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. # # For example, # "A man, a plan, a canal: Panama" is a palindrome. # "race a car" is not a palindrome. # # Note: # Have you consider that the string might be empty? This is a good question to ask dur...
true
8c7569bf644859b9a51d0a6b06935c0dcbbfd509
chococigar/Cracking_the_code_interview
/3_Stacks_and_Queues/queue.py
598
4.1875
4
#alternative method : use lists as stack class Queue(object) : def __init__(self): self.items = [] def isEmpty(self): return (self.items==[]) def enqueue(self, item): self.items.insert(0, item) def dequeue(self): self.items.pop() #first in first out. last item is first. ...
true
93b706571c7b3451f5c677cc7d9ddb1dffa67f13
blkbrd/python_practice
/helloWorld.py
2,330
4.15625
4
print ("hello World") ''' #print('Yay! Printing.') #print("I'd much rather you 'not'.") #print('I "said" do not touch this.') print ( "counting is fun") print ("hens", 25 + 30 / 6) print ("Is it greater?", 5 > -2) #variables cars = 100 space_in_a_car = 4 drivers = 30 passengers = 90 cars_not_driven = c...
true
64f31b62c4a464b495cf051d73c26b67b37cc8bb
padma67/guvi
/looping/sum_of_first_and_last_digit_of_number.py
342
4.15625
4
# Program to find First Digit and last digit of a Number def fldigit(): number = int(input("Enter the Number: ")) firstdigit = number while (firstdigit >= 10): firstdigit = firstdigit // 10 lastdigit = number % 10 print("sum of first and last digit of number is {0}".format(firstdigit+l...
true
df2c4134cb5454aac257dcb270cc651595b3a8c4
padma67/guvi
/looping/Calculator.py
865
4.1875
4
#Calculator #get the input value from user num1=float(input("Enter the number 1:")) num2=float(input("Enter the number 2:")) print("1.Add") print("2.Sub") print("3.Div") print("4.Mod") print("5.Mul") print("6.Expo") #get the function operator from uuer ch=float(input("Enter your choice:")) c=round(ch) if(c==1): pr...
true
451744ff93bd4ee503af5d2f28e1bf8d89f16517
padma67/guvi
/looping/Print_even_numbers_from_1_to_100.py
264
4.1875
4
#To print all even numbers between 1 to 100 def Even(): #declare the list for collect even numbers even=[] i=1 while(i<=100): if(i%2==0): even.append(i) i=i+1 print("even numbers between 1 to n",even) Even()
true
6e135b53bbde0cd65bdf7c36815195dd29e6ec66
Nitin26-ck/Scripting-Languages-Lab
/Part B/Lab 5/Prg5_file_listcomprehension.py
2,064
4.1875
4
""" Python File Handling & List Comprehension Write a python program to read contents of a file (filename as argument) and store the number of occurrences of each word in a dictionary. Display the top 10 words with the most number of occurrences in descending order. Store the length of each of these words...
true
221fdeb75e2f6db401901b5755e991bdffdcee75
Nitin26-ck/Scripting-Languages-Lab
/Part B/Lab 1/Prg1c_recursion_max.py
809
4.15625
4
""" Introduction to Python : Classes & Objects, Functions c) Write a recursive python function that has a parameter representing a list of integers #and returns the maximum stored in the list. """ #Hint: The maximum is either the first value in the list or the maximum of the rest of #the list whichever is larger. If th...
true
901e5ae13f821c2e3da9df9b46d9a1d7e7cc003c
KodingKurriculum/learn-to-code
/beginner/beginner_3.py
1,789
4.78125
5
# -*- coding: utf-8 -*- """ Beginner Script 3 - Lists, and Dictionaries Functions allow you to group blocks of code and assign it a name. Functions can be called over and over again to perform specific tasks and return values back to the calling program. """ """ 1.) Lists (also known as an Array) are great for storin...
true
0f882e8b74773b888de20be38564c13642cd306a
ijuarezb/InterviewBit
/04_LinkedList/K_reverse_linked_list.py
2,527
4.125
4
#!/usr/bin/env python3 import sys #import LinkedList # K reverse linked list # https://www.interviewbit.com/problems/k-reverse-linked-list/ # # Given a singly linked list and an integer K, reverses the nodes of the # # list K at a time and returns modified linked list. # # NOTE : The length of the list is divisibl...
true
0e8330781cac465d3bae07379fa9d2435940d03e
Ekimkuznetsov/Lists_operations
/List_split.py
309
4.25
4
# LIsts operations # For each line, split the line into a list of words using the split() method fname = input("Enter file name: ") fh = open(fname) fst = list() for line in fh: x = line.split() for word in x: if word not in fst: fst.append(word) fst.sort() print(fst)
true
e6ecd5211b15b6cb201bdd2e716a7b4fec2db726
markcurtis1970/education_etc
/timestable.py
1,693
4.5
4
# Simple example to show how to calculate a times table grid # for a given times table for a given length. # # Note there's no input validation to check for valid numbers or # data types etc, just to keep the example as simple. Plus I'm not # a python developer :-) # Ask user for multiplier and max range of times tab...
true
1a024d3e345afbcc0b8cfa354e14416401f9c565
dogac00/Python-General
/generators.py
1,253
4.46875
4
def square_numbers(nums): result = [] for i in nums: result.append(i*i) return result my_nums = square_numbers([1,2,3,4,5]) print(my_nums) # will print the list # to convert it to a generator def square_numbers_generator(nums): for i in nums: yield i*i my_nums_generator = square_numbers_gener...
true
f7eaadb3ee801b8011e2fddd03a055902f2da614
sohanjs111/Python
/Week 3/For loop/Practice Quiz/question_2.py
608
4.375
4
# Question 2 # Fill in the blanks to make the factorial function return the factorial of n. Then, print the first 10 factorials (from 0 to 9) with # the corresponding number. Remember that the factorial of a number is defined as the product of an integer and all # integers before it. For example, the fac...
true
7a22126b7d66730558314ad8295c087559ee4b41
sohanjs111/Python
/Week 4/Graded Assessment/question_1.py
1,463
4.5
4
# Question 1 # The format_address function separates out parts of the address string into new strings: house_number and street_name, # and returns: "house number X on street named Y". The format of the input string is: numeric house number, followed by the # street name which may contain numbers, but never by themse...
true
6adef0926886b9f6406f056fb9faef6640068338
sohanjs111/Python
/Week 4/Lists/Practice Quiz/question_6.py
957
4.40625
4
# Question 6 # The guest_list function reads in a list of tuples with the name, age, and profession of each party guest, and prints the # sentence "Guest is X years old and works as __." for each one. For example, guest_list(('Ken', 30, "Chef"), ("Pat", 35, 'Lawyer'), # ('Amanda', 25, "Engineer")) should...
true
3918f8ff48585ae65b1949cc709a8da345d26b93
sohanjs111/Python
/Week 4/Strings/Practice Quiz/question_2.py
593
4.3125
4
# Question 2 # Using the format method, fill in the gaps in the convert_distance function so that it returns the phrase "X miles equals Y # km", with Y having only 1 decimal place. For example, convert_distance(12) should return "12 miles equals 19.2km". def convert_distance(miles): km = miles * 1.6 ...
true
615c579433bd2c31eacc75412eafb19a325f0306
AlinesantosCS/vamosAi
/Módulo - 1/Módulo 1-7 - Mamma Mia!/stem_comparacao.py
1,356
4.28125
4
# Se não me engano .title() retorna a string como se fosse um título, ou seja, a primeira letra maiuscula def sobre_marie(): print("{0:^60}".format('Marie Curie')) print('Cientista responsável por descrever os elementos químicos Polônio e o Rádio e primeira mulher a ganhar um Prêmio Nobel — Física (1903) e Quí...
false
11e2d96faa001bcceb225b58f1121b8b4e2cd4ed
AlinesantosCS/vamosAi
/Módulo - 1/Módulo 1-5 - Sem condições!/stem.py
1,672
4.125
4
acertou = 0 print(' JOGO DE ADIVINHAÇÃO DA MARIE CURIE') print('Digite qual alternativa é verdadeira A, B ou C.') pergunta_1 = input(' Pergunta 1 - Qual área ela trabalhou ?\n A - Engenharia\n B - Ciência\n C - Tecnologia\n Escolha uma alternativa: ') pergunta_2 = input(' Pergunta 1 - A causa da morte de Marie Currie ...
false
e34200e7aa655e007745ff77b1c58c6ce62b525d
AlinesantosCS/vamosAi
/Módulo - 1/Módulo 1-14- Listas pra que te quero!/reverse-string.py
536
4.1875
4
def reverse_string(str): str = str[::-1] return (str) str = ["1", "2", "3", "4"] reverse_string (str) '''O reverse de listas em Python reverte a lista in place, alterando os valores da lista ao invés de criar uma lista nova escrita ao avesso. Como strings em Python são imutáveis, não faz muito sentido qu...
false
838632c00192ddd52a00f2f5cfb1794e57cd1424
AlinesantosCS/vamosAi
/Módulo - 2/Módulo 2-8 - Cada um no seu quadrado!/modulo.py
805
4.1875
4
import math from math import sqrt,floor # Biblioteca random da classe random - # Numéros aleátorios de 0 a 1 em float import random import emoji num = int(input("Digite um numero: ")) """ floor - arrendona para baixo """ # Raiz quadrada - Arrendona pra cima raiz = math.sqrt(num) print('A raiz de {} é igual a {}'...
false
8a99ecb567725253701a8f4f53a11452d0087e87
AlinesantosCS/vamosAi
/Módulo - 2/Módulo 2-1 - Qual é o significado/ordena_dicionario.py
590
4.15625
4
# dicionario = {"a": 2, "b": 3, "c": 1} # # O método items() dos dicionários retorna o par (chave, valor) # # como tuplas de tamanho 2 # print (dicionario.items()) # print(sorted(dicionario.items(), key=lambda x: x[1])) # def ordena_dicionario(dicionario): # # Implemente a lógica da função aqui # ordena = (sort...
false
beb66ab0fd7d03e14479037c4634da4e96a6ffb8
vitorhenriquesilva/python-introduction
/zip.py
357
4.25
4
#Funo .zip #Essa funo utilizada para a concatenao de duas ou mais listas lista1 = [1, 2, 3, 4 ,5] lista2 = ["abacate", "bola", "cachorro", "dinheiro", "elefante"] lista3 = ["R$2,00", "R$5,00", "No tem preo", "No tem preo", "No tem preo"] for numero, nome, valor in zip(lista1, lista2, lista3): print(numero, n...
false
69fd417b735877ae844880c2f8ed10f80d33413a
khayes25/recursive_card_sorter
/merge_sort.py
1,634
4.125
4
""" Merge Sort Algorithm """ #Class Header class Merge_Sort : def merge_sort(list, left, right) : if(left < right) : middle = (left + right) / 2 merge_sort(list, left, middle) merge_sort(list, middle + 1, right) merge(list, left, middle, right) de...
true
b16802cea3e32892e7953167eb4932457c6e41bb
mr-akashjain/Basic-Python-Stuff-For-Fun
/pigLatin.py
2,301
4.125
4
from time import sleep sentence = input("Hi, They call me latin pig translator. Enter a sentence to have fun with me:") sleep(4) print("Thanks for the input!! Fasten your seatbelt as you are about to enter into my world") sleep(3) print("I know my world is small, but it is mine!") sleep(2) say_something = inpu...
true
2bc6e15c932be59832de9e40960dc14c4de17c4f
AidaQ27/python_katas_training
/loops/vowel_count.py
777
4.21875
4
""" Return the number (count) of vowels in the given string. We will consider a, e, i, o, and u as vowels for this Kata. The input string will only consist of lower case letters and/or spaces. --- We are starting with exercises that require iteration through the elements of a structure, so it will be good to dedica...
true
42b2eac7097ededd9d87d2746afaeb5f8fc9b240
Nalinswarup123/python
/class 6/bio.py
658
4.125
4
'''biologists use seq of letter ACTC to model a genome. A gene is a substring of gnome that starts after triplet ATG and ends before triplet TAG , TAA and TGA. the length of Gene string is mul of 3 and Gene doesnot contain any of the triple TAG , TAA and TGA. wap to ask user to enter a genone and display all genes...
true
470cd5e72d7a9147a6d2fc4835040fb3446f1dcc
Nalinswarup123/python
/calss 1/distance between two points.py
275
4.125
4
#distance between two points print('enter first point') x,y=int(input()),int(input()) print('enter second point') a,b=int(input()),int(input()) x=((x-a)**2+(y-b)**2)**0.5 print('distance between the given points=',x) #print('{} is the required distance'.format(x))
true
fd60a484b60b1f34dc3e5e2893b2a8ca5102688b
chandan-singh-007/Demo
/second.py
504
4.15625
4
#write a program to check whether a number is prime or not def prime(n): if (n>1): for i in range(2,n): if(n%i)==0: print(n ,"is not prime") break else: print(n,"is prime") # def prime(n): # if n>1: # for i in ran5ge(2,n): # ...
false
6692daa627b01842e018d078fac7b64354d9a968
smritta10/PythonTraining_Smritta
/Task3/Task3_all_answers.py
1,906
4.125
4
Task -3 #Question 1 diff_list= [10,'Smritta', 10.5,'1+2j', 20,'Singh', 113.0, '3+4j', 100, 'Python_learning'] print(diff_list) ----------------------------------------------------- #Question 2 list1= [10,20,30,40,50] s1= list1[ :5] #actual list s2= list1[ : :-1] # lists items in reverse order s3= list1[1:5:2] # lis...
true
c91f0044d88593f20382a5dd1122504d9fbf8c1d
sindhupaluri/Python
/count_string_characters.py
425
4.34375
4
# Please write a program which counts and returns the numbers of each character in a string input. # count_characters( "abcdegabc" ) # { 'a':2, 'c':2, 'b':2, 'e':1, 'd':1, 'g':1 } def count_characters(string): char_count = {} for char in string: if char in char_count: char_count[char] +=...
true
cc9f5557da6e2a296a670be87749e2cb7ac3c7b3
Jasjot784/Python
/for.py
348
4.21875
4
primes=[2,3,5,7] for num in primes: print(num) print("Outside the for loop") list1 = ["Apple","Bananas","Cherries"] tup1 = (13,12,15) for item in list1: print(item) for item in tup1: print(item) for i in range(1,11): print(i) for i in range(0,11,2): print(i) for i in range(0,5): for j in ran...
false
8481e9764f727ca62824cd86691a537d71c38d3d
Xpf123131123/python_study_demo
/pak/io_input.py
447
4.15625
4
def reverse(text): return text[::-1] def isHuiWen(text): text1 = '' for item in text: if item >= 'a' and item <= 'z': text1 += item if item >= 'A' and item <= 'Z': text1 += item print(text1) return text1 == reverse(text1) text = input('输入内容,判断是否回文:') if i...
false
05b0deda5e25686a6082b289b46594a1b57e7ea3
RAmruthaVignesh/PythonHacks
/Foundation/example_*args_**kwargs.py
845
4.53125
5
#When the number of arguments is unknown while defining the functions *args and **kwargs are used import numpy as np def mean_of_numbers(*args): '''This function takes any number of numerical inputs and returns the mean''' args = np.array(args) mean = np.mean(args) return mean print "The mean of the n...
true
f24bcde3c27bf62a63df4e2e2d6d76925ac51352
RAmruthaVignesh/PythonHacks
/Foundation/example_list_comprehension.py
651
4.71875
5
#Example 1 : To make a list of letters in the string print "This example makes a list of letters in a string" print [letter for letter in "hello , _world!"] #Example 2: Add an exclamation point to every letter print "\nExample 2: Add an exclamation point to every letter" print [letter+"!" for letter in "hello , world...
true
9d4b2995f00b605030a1d763f133a01c83965681
RAmruthaVignesh/PythonHacks
/MITCourse/MITcourse_hw1.py
938
4.1875
4
# Name: Amrutha # Date:12.17.2016 # hw1.py ##### Template for Homework 1, exercises 1.2-1.5 ###### print "Hello , World!" # Do your work for Exercise 1.2 and 1.3 here tictac = " | |" toe = "--------" print "Printing tictactoe board" print tictac + '\n'+ toe + '\n' + tictac + '\n' + toe + '\n' + tictac print "***...
false
9095e434cabe1afd4d287c4db9885bbf0d7b4515
RAmruthaVignesh/PythonHacks
/OOPS/class_inheritance_super()_polygons.py
1,891
4.78125
5
#This example explains the super method and inheritance concept class polygons(object): '''This class has functions that has the functionalities of a polygon''' def __init__(self,number_of_sides):#constructor self.n = number_of_sides print "The total number of sides is" , self.n def interi...
true
7e06219cc161ddfb37e3f72d261c9c256ea20414
RAmruthaVignesh/PythonHacks
/MiscPrograms/number_of_letters_in_word.py
354
4.3125
4
#get the word to be counted word_to_count = 'hello_world!' print ("the word is" , word_to_count) # iniliatize the letter count letter_count = 0 #loop through the word for letter in word_to_count: print("the letter", letter, "#number" , letter_count) letter_count = letter_count+1 print ("there are", letter_co...
true
0fff4ced9ebbb6852543fb009386e49bee3c352a
AlanDTD/Programming-Statistics
/Week 2/Week 2 exercises - 2.py
909
4.125
4
# -*- coding: utf-8 -*- """ Created on Thu Jul 29 20:05:57 2021 @author: aland """ #Loops and input Processing nums = tuple(input("Enter at least 5 numbers separated by commas!")) print(len(nums)) print(nums) sum_num = 0 count = 0 if type(nums) == tuple: #Checks if ithe value is a tuple while len(nums) < 5: ...
true
ed04c33b0bd58feb0e53c7970ee6ec5de1511481
mvessey/comp110-21f-workspace
/lessons/for_in.py
382
4.46875
4
"""An example of for in syntax.""" names: list[str] = ["Madeline", "Emma", "Nia", "Ahmad"] # example of iterating through names using a while loop print("While output:") i: int = 0 while i < len(names): name: str = names[i] print(name) i += 1 print("for ... in output") # the following for ... in loops is...
true
e5f1266fb875f2d61be8ef72c382cf8cfa10b5de
Sam-Coon/Chapter_8
/challenge2.py
2,575
4.1875
4
#Colaboration on Chapter 8 with Sam Coon and Tyler Kapusniak #2/10/15 class TV(object): def __init__(self, channel = 0, volume = 0): self.__channel = channel self.__volume = volume def choose_channel(self): print( """ Channels: 1. Action 2. Comedy 3....
false
78f53c4a130daf34adc2ef48ec7e37be90c0a3b1
klcysn/free_time
/climb_staircase.py
452
4.3125
4
# There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. # For example, if N is 4, then there are 5 unique ways: # 1, 1, 1, 1 # 2, 1, 1 # 1, 2, 1 # 1, 1, 2 # ...
true
94ebe7be385aa68e463c7cdc89bd1e257b9ecdbe
klcysn/free_time
/fizzbuzz.py
799
4.71875
5
# Create a function that takes a number as an argument and returns "Fizz", "Buzz" or "FizzBuzz". # If the number is a multiple of 3 the output should be "Fizz". # If the number given is a multiple of 5, the output should be "Buzz". # If the number given is a multiple of both 3 and 5, the output should be "FizzBuzz". #...
true
f82a0f9537ee9ec944bdf9e95ea691a5f06e1bf3
Chetancv19/Python-code-Exp1-55
/Lab2_5.py
701
4.125
4
#Python Program to Check Prime Number #chetan velonde 3019155 a = int(input("Enter the number for checking whether it is prime or not:")) if a > 1: for x in range(2, a): if a % x == 0: print(str(a) + " is not a prime number.") break else: print(str(a) + " is a ...
true
db68815532b75593db14d95d1cc5bfda962102da
jessemcastro/respostas_estrutura_de_decisao
/05.py
798
4.21875
4
#Faça um programa para a leitura de duas notas parciais de um aluno. # O programa deve calcular a média alcançada por aluno e apresentar: #A mensagem "Aprovado", se a média alcançada for maior ou igual a sete; #A mensagem "Reprovado", se a média for menor do que sete; #A mensagem "Aprovado com Distinção", se a médi...
false
56987b36b796816bbf61315b11be60fc6bed2aee
ljkhpiou/test_2
/ee202/draw.py
642
4.1875
4
import turtle myPen = turtle.Turtle() myPen.shape("arrow") myPen.color("red") #myPen.delay(5) #Set the speed of the turtle #A Procedue to draw any regular polygon with 3 or more sides. def drawPolygon(numberOfsides): exteriorAngle=360/numberOfsides length=2400/numberOfsides myPen.penup() m...
true
08435281ef189434c121be0f66540830b0e2f006
NectariosK/email-sender
/email_sender.py
2,438
4.375
4
#This piece of code enables one to send emails with python #Useful links below ''' https://www.geeksforgeeks.org/simple-mail-transfer-protocol-smtp/ https://docs.python.org/3/library/email.html#module-email https://docs.python.org/3/library/email.examples.html ''' ''' import smtplib #simple mail transfe...
true
e0d3302b71739f6e5210d6c0e377afe0ecb27329
raviMukti/training-python-basic
/src/Dictionary.py
290
4.3125
4
customer = {"name":"Ravi", "umur":25, "pekerjaan":"Programmer"} name = customer["name"] age = customer["umur"] job = customer["pekerjaan"] print(f"Hello My Name is {name} i am {age} years old, and im a {job}") for key in customer: value = customer[key] print(f"{key} : {value}")
false
8d64c60833a9b781e2b4e1243e1e987f08030c41
dwbelliston/python_structures
/generators/example.py
683
4.4375
4
# Remember, an Iterable is just an object capable of returning its members one at a time. # generators are used to generate a series of values # yield is like the return of generator functions # The only other thing yield does is save the "state" of a generator function # A generator is just a special type of iterator...
true
24d69d7df270af8673070ef7079cbcd3254d9bd7
valakkapeddi/enough_python
/comprehensions_and_generators.py
1,353
4.6875
5
# Comprehension syntax is a readable way of applying transforms to collection - i.e., creating new collections # that are modified versions of the original. This doesn't change the original collection. # For instance, given an original list like the below that contains both ints and strings: a_list = [1, 2, 3, 4, 'a',...
true
861db59c044985dc0b8e4d71dbff92d480b40ef1
Jones-Nick-93/Class-Work
/Binary Search Python.py
1,284
4.25
4
#Nick Jones #DSC 430 Assignment 7 Time Complexity/Binary Search #I have not given or received any unauthorized assistance on this assignment #YouTube Link import random '''function to do a binary search to see if 2 #s from a given list sum to n''' def binary_search(array, to_search, left, right): # termina...
true
e41b72f54d45718b0680fbbb7f61a3d0761f527f
Ameen-Samad/number_guesser
/number_ guesser.py
1,426
4.15625
4
import random while True: secret_number = random.randrange(1, 10, 1) limit = 3 tries = 0 has_guessed_correctly = False while not has_guessed_correctly: user_guess = int(input("Guess a number: ")) print(f"You have guessed {user_guess}") limit = limit - 1 tries = trie...
true
307e85576dc78d29ecf9077c70776c3498e1a60c
LizaPersonal/personal_exercises
/Programiz/sumOfNaturalNumbers.py
684
4.3125
4
# Python program to find the sum of natural numbers up to n where n is provided by user def loop_2_find_sum(): num = int(input("Enter a number: ")) if num < 0: num = int(input("Enter a positive number")) else: sum = 0 # use while loop to iterate until zero while num > 0: ...
true
c2c6f67a9b28aed58419e949dd1071d714a4ec92
LizaPersonal/personal_exercises
/Programiz/celsiusFahrenheit.py
512
4.125
4
def celsius2fahrenheit(): celsius = float(input("Enter value in celsius: ")) fahrenheit = (celsius * 1.8) + 32 print('%0.1f degree Celsius is equal to %0.1f degree Fahrenheit' %(celsius, fahrenheit)) def fahrenheit2celsius(): fahrenheit = float(input("Enter value in fahrenheit: ")) celsius = (fa...
false
35ab0ae28ae798f5fd4317432d082e164b5815ef
zenthiccc/CS5-ELECTIVE
/coding-activities/2ndQ/2.5-recursive-binary-search.py
1,311
4.15625
4
# needle - the item to search for in the collection # haystack - the collection of items # NOTE: assume the haystack is ALWAYS sorted, no need to sort it yourself # the binary search function to be exposed publicly # returns the index if needle is found, returns None if not found def binary_search(needle, haystack): ...
true
e3b267c428b62ae5e579a8d9b2446a85443ba889
hyerynn0521/CodePath-SE101
/Week 1/fizzbuzz.py
683
4.46875
4
# # Complete the 'FizzBuzz' function below. # # This function takes in integer n as a parameter # and prints out its value, fizz if n is divisible # by 3, buzz if n divisible by 5, and fizzbuzz # if n is divisible by 3 and 5. # """ Given an input, print all numbers up to and including that input, unless they are divisi...
true
52673f2e5435fb7d724b5028a3f64c61398d3c47
hyerynn0521/CodePath-SE101
/Week 5/longest_word.py
816
4.4375
4
#!/bin/python3 import math import os import random import re import sys # # Complete the 'longestWord' function below. # # The function is expected to return a STRING. # The function accepts STRING_ARRAY words as parameter. # This function will go through an array of strings, # identify the largest word, and retur...
true
1f4d1b56a04d8189a8d62af0775eb55e6d1195dc
wangdan377/Test_01
/智神/UI自动化/py/py01/Test_setttle3/lizhi/1_内建函数.py
1,792
4.25
4
''' #内建函数 print('abc'.capitalize()) #把字符串得第一个字母大写 str1= "abc" print(str1.center(6,"1")) #str.center(width,fillchar) fillchar为填充字符,只能一个字符 str2 = "hello python world" print(str2.count("o",5,30)) #"str.count(sub, start=0,end=len(string) ) str3 = 'name.py' suffix = '.py' print(str3.endswith(str3, 0, 20)) # True s...
false
48108b1d24bc92d1d52af57f50fed1f7e06b45a9
brivalmar/Project_Euler
/Python/Euler1.py
202
4.125
4
total = 0 endRange = 1000 for x in range(0, endRange): if x % 3 == 0 or x % 5 == 0: total = total + x print "The sum of numbers divisible by 3 and 5 that are less than 1000 is: %d " % total
true
96d1013baf191fdc17c8e134d7e68886803aa689
Vagelis-Prokopiou/python-challenges
/codingbat.com/String-2/end_other.py
719
4.125
4
#!/usr/bin/python3 # @Author: Vagelis Prokopiou # @Email: drz4007@gmail.com # @Date: 2016-04-02 17:33:14 # @Last Modified time: 2016-04-02 17:55:41 # Given two strings, return True if either of the strings appears at the very end of the other string, ignoring upper/lower case differences (in other words, the comput...
true
cd30d28c86f297f670283b00daefe319032a2e61
Haowen-Zhong/Python-Learning
/May/Tkinter/11.py
685
4.125
4
from tkinter import * root = Tk() Label(root,text="作品:").grid(row = 0, column = 0) Label(root,text="作者:").grid(row = 1, column = 0) e1 = Entry(root) e2 = Entry(root) e1.grid(row = 0,column = 1, padx = 10, pady = 5) e2.grid(row = 1,column = 1, padx = 10, pady=5) def show(): print("作品:《%s》"%e1.get()) print("作者: %s"%...
false
dc0aaec53f5565f1396c8cb1907070f4b1f9527d
divyaprakashdp/DSA-with-Python
/merge_sort.py
1,422
4.3125
4
def merge_sort(listToSort): """ sorts a list in descending order Returns a new sordted list """ if len(listToSort) <= 1: return listToSort leftHalf, rightHalf = split(listToSort) left = merge_sort(leftHalf) right = merge_sort(rightHalf) return merge(left, right) def split...
true
27e6c78de9ae2f6ff0c91d470bbf175bd9b7e7cc
mashpolo/leetcode_ans
/700/leetcode706/ans.py
1,235
4.125
4
#!/usr/bin/env python # coding=utf-8 """ @desc: @author: Luo.lu @date: 2019-01-09 """ class MyHashMap: def __init__(self): """ Initialize your data structure here. """ self.key = [] self.value = [] def put(self, key, value): """ value will always be...
true
36a29f204892487912c3e60c6766a68a3a23a7b5
iQaiserAbbas/artificial-intelligence
/Lab-01/Lab-01.py
921
4.125
4
__author__ = "Qaiser Abbas" __copyright__ = "Copyright 2020, Artificial Intelligence lab-01" __email__ = "qaiserabbas889@yahoo.com" # Python Program - Calculate Grade of Student print("Please enter 'x' for exit."); print("Enter marks obtained in 5 subjects: "); subject1 = input(); if subject1 == 'x': exit(); else...
true
f2c41e4f2cbef4b9d331b423a27dd93e259b0329
cardigansquare/codecademy
/learning_python/reverse.py
221
4.1875
4
#codeacademy create function the returns reversed string without using reversed or [::-1] def reverse(text): new_text = "" for c in text: new_text = c + new_text return new_text print reverse("abcd!")
true
556e83e3f35ac103b07d064083e1288293ebc1f9
roseORG/GirlsWhoCode2017
/GWC 2017/story.py
1,154
4.25
4
start = ''' Rihanna is in town for her concert. Help her get to her concert... ''' print(start) done = False left= False right= False while not done: print("She's walking out of the building. Should she take a left or right?") print("Type 'left' to go left or 'right' to go right.") use...
true
17dccb7a8621b306bbae0dd58f64c23e17c746c8
shamramchandani/Code
/Python/chapter 3.py
410
4.15625
4
def collatz(num): if num%2 == 0: print(num / 2) return (num / 2) else: print((num *3) +1) return (num *3) +1 try: number = int(input("Please enter a number")) print(number) if number <= 1: print('Please input a number greater than 1') else: while number > 1: number...
true
a4630580b5fa0a5bc3f480cd7d4ff6ef63ee9640
GajananThenge/Assignment1
/Assignment1.8.py
759
4.375
4
''' Write a Python Program to print the given string in the format specified in the sample output. WE, THE PEOPLE OF INDIA, having solemnly resolved to constitute India into a SOVEREIGN, SOCIALIST, SECULAR, DEMOCRATIC REPUBLIC and to secure to all its citizens Sample Output: WE, THE PEOPLE OF INDIA, having ...
false
771aafb570437f9bdbd5bc60ea6b4106b22c2541
hperry711/dev-challenge
/chapter2_exercises.py
1,534
4.21875
4
# Exercises for chapter 2: # Name: Hunter Perry # Exercise 2.1. # zipcode = 02492 generates a SyntaxError message because "9" is not within the octal number system. When an integer is lead with a zero in Python it generates the Octal representation for that number. >>> zipcode = 02132 only contains numbers between 0...
true
1435bd56f23473cad0d00c81ce9434afd56f945a
mylin95/learnpython
/demo/basic/DictAndSet.py
1,494
4.28125
4
# dict # dict全称dictionary,在其他语言中也称为map. # 使用键-值(key-value)存储,具有极快的查找速度。 # dict的键值对存放是 无序的 # dict初始化,取值 dict1 = {'Michael': 95, 'Bob': 75, 'Tracy': 85} print(dict1['Michael']) print(dict1) # 增、替换 dict1['Amy'] = 100 print(dict1['Amy']) # 删 delEle = dict1.pop('Amy') print(delEle) print(dict1) # 取值1:不存在key,报错 # print(dic...
false
d18655221e7642cc632f6875310fd3bbd85ae270
Vivek24-learner/Vivekfolder
/Factorial no.py
217
4.125
4
# -*- coding: utf-8 -*- """ Created on Fri Jul 23 07:51:08 2021 @author: HP """ def factorilal(n): return 1 if(n==1 or n==0) else n*factorilal(n-1) n=5 print("The factorial of ",n,"is",factorilal(n))
false
b98fb37acb9ed1b4cbf2d57f516cf650bc515332
Airbomb707/StructuredProgramming2A
/UNIT1/Evaluacion/eval02.py
304
4.15625
4
#Evaluation - Question 7 #Empty array #A length variable could be added for flexible user inputs lst=[] #Storing Values for n in range(3): print("Enter value number ", n+1) num=int(input("> ")) lst.append(num) #Built-in Max() Function in Python print("The largest number was: ", max(lst))
true
d9fad0b9f0dda940f073f6f461fd01c145eb5ba1
ZammadGill/python-practice-tasks
/task8.py
319
4.21875
4
""" Use a list comprehension to square each odd number in a list. The list is input by a sequence of comma-separated numbers """ def squareOddNumber(numbers_list): odd_numbers_square = [n * n for n in numbers_list if n % 2 != 0] print(odd_numbers_square) numbers = [1,2,3,4,5,6,7,8,9] squareOddNumber(numbers)
true
cb611e5efb7fe55ca6e79a43a2eccfffd86b4834
Hrishikeshbele/Competitive-Programming_Python
/minimum swaps 2.py
1,891
4.34375
4
''' You are given an unordered array consisting of consecutive integers [1, 2, 3, ..., n] without any duplicates. You are allowed to swap any two elements. You need to find the minimum number of swaps required to sort the array in ascending order. Sample Input 0 4 4 3 1 2 Sample Output 0 3 Explanation 0 Given arra...
true
2e3998204f8cf62aeb969ff28cd45b217b480bf0
Hrishikeshbele/Competitive-Programming_Python
/merge2binarytree.py
1,623
4.125
4
''' Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise...
true
224e2c2e3835534e75d9816249aaf06625e70ada
Hrishikeshbele/Competitive-Programming_Python
/Letter Case Permutation.py
1,326
4.1875
4
''' Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create. You can return the output in any order. Example 1: Input: S = "a1b2" Output: ["a1b2","a1B2","A1b2","A1B2"] approach: let's see recursion ...
true
afab2fe8f815cda591267691c0667a75a6182296
Hrishikeshbele/Competitive-Programming_Python
/Leaf-Similar Trees.py
767
4.25
4
''' Two binary trees are considered leaf-similar if their leaf value sequence is the same. Return true if and only if the two given trees with head nodes root1 and root2 are leaf-similar. Input: root1 = [1,2], root2 = [2,2] Output: true approach : we find root nodes of both tree and compare them ''' class Solutio...
true
34b090968b06ee05bd9ebfb94547b9ba63e32b2b
Hrishikeshbele/Competitive-Programming_Python
/Invert the Binary Tree.py
1,079
4.3125
4
''' Given a binary tree, invert the binary tree and return it. Look at the example for more details. Example : Given binary tree 1 / \ 2 3 / \ / \ 4 5 6 7 invert and return 1 / \ 3 2 / \ / \ 7 6 5 4 ''' ### we exchange the left and right child recursively # Definition f...
true
9af9bc53e43238029d5c791bbc1cd37d26920e7a
Hrishikeshbele/Competitive-Programming_Python
/Jewels and Stones.py
1,027
4.125
4
''' You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. ...
true
23275fede27675ba37f35a8e9117af1395c3aa72
nirajkvinit/pyprac
/recursiveBinarySearch.py
472
4.15625
4
# Binary search using recursion def binarySearchRecursive(arr, low, high, value): mid = low + int((high + low) / 2) if arr[mid] == value: return mid elif arr[mid] < value: return binarySearchRecursive(arr, mid + 1, high, value) else: return binarySearchRecursive(arr, low, mid - 1, value) def binarySearch(...
true
a4c94ed077075a01ef12f176fbccff19ef24a0fc
nirajkvinit/pyprac
/100skills/dictgen.py
386
4.3125
4
''' With a given number n, write a program to generate a dictionary that contains (i, i*i) such that i is an number between 1 and n (both included). and then the program should print the dictionary. ''' def dictgen(): n = int(input("Enter a number: ")) d = dict() for i in range(1, n+1): d[i] = i**...
true