blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
af103d58cbf6743160c45164920ce36ad68146c2
felipeonf/Exercises_Python
/exercícios_fixação/062.py
911
4.125
4
''' Faça um programa usando a estrutura “faça enquanto” que leia a idade de várias pessoas. A cada laço, você deverá perguntar para o usuário se ele quer ou não continuar a digitar dados. No final, quando o usuário decidir parar, mostre na tela: a) Quantas idades foram digitadas b) Qual é a média entre as idades d...
false
7bc09ed3640e3f0e32e2ea12725a65cb87d6d39f
SavinaRoja/challenges
/Rosalind/String_Algorithms/RNA.py
2,275
4.1875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """Transcribing DNA into RNA Usage: RNA.py <input> [--compare] RNA.py (--help | --version) Options: --compare run a speed comparison of various methods -h --help show this help message and exit -v --version show version and exit """ problem_desc...
true
d122d93baa813af861b12346e82003bdc91e7d47
Jessica-Luis001/shapes.py
/shapes.py
1,042
4.46875
4
from turtle import * import math # Name your Turtle. marie = Turtle() color = input("What color would you like?") sides = input("How many sides would you like?") steps = input("How many steps would you like?") # Set Up your screen and starting position. marie.penup() setup(500,300) x_pos = -250 y_pos = -150 marie.set...
true
14f15835a90bc85b84528f40622ee216d4bfd2a4
GaloisGroupie/Nifty-Things
/custom_sort.py
1,247
4.28125
4
def merge_sort(inputList): """If the input list is length 1 or 0, just return the list because it is already sorted""" inputListLength = len(inputList) if inputListLength == 0 or inputListLength == 1: return inputList """If the list size is greater than 1, recursively break it into 2 pieces and we...
true
7fd5693cd6e035bb230eb535f4d9b0b0a5ce23bf
israel-dryer/Just-for-Fun
/mad_libs.py
2,489
4.125
4
# create a mad-libs | random story generator # randomly select words to create a unique mad-libs story from random import randint import copy # create a dictionary of the words of the type you will use in the story word_dict = { 'adjective':['greedy','abrasive','grubby','groovy','rich','harsh','tasty','slow'], ...
true
37ae8644ebe355a829433e96a4b5cba4fa1e45af
realRichard/-offer
/chapterThree/robust/reverseLinkList/reverse_linkList.py
1,847
4.28125
4
''' 题目: 定义一个函数,输入一个链表的头节点,反转该链表并输出反转后链表的头节点。 ''' class Node(object): def __init__(self, value=None, next=None): self.value = value self.next = next def __str__(self): return str(self.value) class LinkedList(object): def __init__(self): self.header = None def ins...
false
a40082b1f88aab52a9b47c2bf79fa85aafddce0e
ciceropzr/DesafiosPython
/numeros.py
317
4.25
4
x = int(input('Insira um número => ')) if x < 0 and x % -2 == -1: print('Número negativo impar') elif x < 0 and x % -2 == 0: print(' Número negativo par') elif x % 2 == 0 and x != 0: print(' Número positivo par') elif x == 0: print('Zero é NULOOOOOOOO....') else: print('Número positivo impar')
false
3dd09e91200b964ae1114bf6d655fcb9776816fd
EnricoFiasche/assignment1
/scripts/target_server.py
1,276
4.125
4
#!/usr/bin/env python import rospy import random from assignment1.srv import Target, TargetResponse def random_target(request): """ Function that generates two random coordinates (x,y) given the range (min,max) Args: request: The request of Target.srv - minimum value of the random coordinate - maximum va...
true
a3af77c55562a3c70c9b1ee570086bc941b9bbee
Sidhved/Data-Structures-And-Algorithms
/Python/DS/Trees.py
1,731
4.375
4
#Program to traverse given tree in pre-order, in-order and post-order fashion class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None class Tree: def __init__(self, root): self.root = TreeNode(root) def inorderTraversal(self, node, path):...
true
c6899d11bbf0892f42b3b877bbe5f9a2a66bf757
ben-coxon/cs01
/sudoku_solver.py
2,916
4.28125
4
#!/usr/bin/python # THREE GOLD STARS # Sudoku [http://en.wikipedia.org/wiki/Sudoku] # is a logic puzzle where a game # is defined by a partially filled # 9 x 9 square of digits where each square # contains one of the digits 1,2,3,4,5,6,7,8,9. # For this question we will generalize # and simplify the game. # Define a...
true
5421ce966d6b60ec40f9e43ece33809fe9576c84
Ricky842/Shorts
/Movies.py
1,404
4.40625
4
#Empty list and dictionaries to store data for the movies and their ratings movies = [] movie_dict = {'movie': '', 'rating': 0} #Check validity of movie rating def check_entry(rating): while rating.isnumeric() is True: movie_rating = int(rating) if(movie_rating > 10 or movie_rating < 1): ...
true
5ed55cdbe3082ebcd87c8cc5ab40defff9542932
anandavelum/RestApiCourse
/RestfulFlaskSection5/createdb.py
605
4.125
4
import sqlite3 connection = sqlite3.connect("data.db") cursor = connection.cursor() cursor.execute("create table if not exists users (id INTEGER PRIMARY KEY,name text,password text)") users = [(1, "Anand", "Anand"), (2, "Ramya", "Ramya")] cursor.executemany("insert into users values (?,?,?)", users) rows = list(c...
true
72994802e57e471f8cc14515072749eb35d79037
LadyKerr/cs-guided-project-array-string-manipulation
/src/class.py
657
4.21875
4
# Immutable variables: ints; O(1) [to find new location for them is cheap]; string # num = 1 # print(id(num)) # num = 100 # print(id(num)) # num2 = num # print(num2 is num) # num2 = 2 # print(num) # print(num2 is num) # Mutable Variables: arrays, dictionaries, class instances arr = [1,2,3] #arrays are mutable print...
true
8c902651f21a4c5d25b384a3f73922c06eba74aa
gabefreedman/music-rec
/dates.py
2,624
4.4375
4
#!/usr/bin/env python """This module defines functions for manipulating and formatting date and datetime objects. """ from datetime import timedelta def get_month(today): """Format datetime to string variable of month name. Takes in `today` and extracts the full month name. The name is returned in all...
true
3b2d9f12bcfee600b30eeb27e34788ae5c8ed4f9
jc345932/sp53
/workshopP1/shippingCalculator.py
368
4.1875
4
item =int(input("How many items:")) while item < 0: print("Invalid number of items!") item = int(input("How many items:")) cost =int(input("How much for item:")) while cost < 0: print("Invalid prices") cost = int(input("How much for item:")) total = cost * item if total > 100: total = total * 0.9 el...
true
1f45bdd57c3e4381ff05c668fadcb38bcaf589f8
jc345932/sp53
/workshopP4/numList.py
322
4.15625
4
list = [] for i in range(5): num = int(input("Enter the number: ")) list.append(num) print("The first number is: ",list[0]) print("the last number is: ", list[-1]) print("the smallest number is: ", min(list)) print("the largest number is: ",max(list)) print("the average of the numbers is: ",sum(list)/len(list)...
true
c7443b333e6f8b64ca5e5d55c3cdaf0b64c8e291
Necrolord/LPI-Course-Homework-Python-Homework-
/Exercise2-2.py
1,123
4.53125
5
#!/bin/usr/env python3.6 # This method is for reading the strings def Input_Str(): x = str(input("Enter a String: ")) return x # This method is for reading the number. def Input_Num(): num = int(input("Enter a number between 1 and 3 included: ")) if ((num < 1) or (num > 3)): print('The number ...
true
23c4b91775a740a59ad4970b20935d3cfb50e768
shafaypro/AndreBourque
/assignment1/mood2.py
2,454
4.53125
5
mood = input('Enter the mood of yours (angry,sad,happy,excited)') # we are taking an input in the form of a string """ if mood == "angry": # check the value of the variable mood if the value is angry compares that with angry print("Your %s" % mood) # the variable mood value is then replaced in the place of %s prin...
true
30db7f2a89d91bdd140df331d0b039d896803ee1
franciscomunoz/pyAlgoBook
/chap4-Recursion/C-4.19.py
1,890
4.4375
4
"""Function that places even numbers before odd if returns are removed in the else condition, the recursion tree becomes messy as shown : (0, 6, [2, 3, 5, 7, 9, 4, 8]) (1, 6, [2, 3, 5, 7, 9, 4, 8]) (2, 5, [2, 8, 5, 7, 9, 4, 3]) (3, 4, [2, 8, 4, 7, 9, 5, 3]) (4, 3, [2, 8, 4, 7, 9, 5, 3]) (3, 4,...
true
7981d8de44f4d1aaaab8aec30ea50b9fb1a87c48
franciscomunoz/pyAlgoBook
/chap5-Array-Based_Sequences/C-5.13.py
1,095
4.125
4
"""The output illustrates how the list capacity is changing during append operations. The key of this exercise is to observe how the capacity changes when inserting data to an an array that doesn't start at growing from size "0". We use two arrays, the original from 5.1 and another starting to grow from a different va...
true
efd406bd5d1378e7d1d38e2329d5039fdd069730
franciscomunoz/pyAlgoBook
/chap5-Array-Based_Sequences/P-5.35.py
2,019
4.25
4
"""Implement a class , Substitution Cipher, with a constructor that takes a string with 26 uppercase letters in an arbitrary order and uses that for the forward mapping for encryption (akin to the self._forward string in our Caesar Cipher class ) you should derive the backward mapping from the forward version""" impor...
true
7ed258a07a00f7092741efd7b9cef6dc69cdc4b8
Marlon-Poddalgoda/ICS3U-Unit3-06-Python
/guessing_game.py
980
4.25
4
#!/usr/bin/env python3 # Created by Marlon Poddalgoda # Created on December 2020 # This program is an updated guessing game import random def main(): # this function compares an integer to a random number print("Today we will play a guessing game.") # random number generation random_number = rando...
true
b9862bf717d958e138ffeb6918d21f5fe164a780
Lutshke/Python-Tutorial
/variables.py
882
4.40625
4
"This is where i will show you the basics ok?" # to add comments to code you need to start with a hashtag like i did # there are a few types of numbers # there are "ints" and "floats" # an int is a full number (10, 45, 100..) # an float is (0.1, 1,5...) # an int or float are variables so they save values ...
true
29e0c4f9290740a84e9f4125d8afec22aab9b3fa
Vlop01/Exercicios-Python-2
/Desafio_65.py
981
4.25
4
#Crie um programa que leia vários números inteiros pelo teclado. No final de cada execução, mostre a média entre #todos os valores e qual foi o maior e menor valor lido. O programa deve perguntar ao usuário se ele quer ou não #continuar a digitar valores continuar = 'sim' count = 0 sum = 0 while continuar == ...
false
c1d8997d5fe31c5dda44c87cbbb1fd54512b74f0
alecmchiu/DailyProgrammer
/e3.py
820
4.125
4
#!/Users/Alec/anaconda/bin/python # Challenge E3 # https://www.reddit.com/r/dailyprogrammer/comments/pkw2m/2112012_challenge_3_easy/ def encrypt(text): characters = list(text) #new_chars = [chr(((ord(x)+824)%95)+32) for x in characters] new_chars = [] for each in characters: new = ord(each)+22 if (new < 127):...
false
11357e97c21e3e5b00d83a576959ca9fd32d9142
DtjiSoftwareDeveloper/Python-Recursion-Tutorial
/recursive_fibonacci.py
405
4.28125
4
""" This file contains implementation of recursively calculating the nth Fibonacci number. Author: DtjiSoftwareDeveloper """ def fibonacci(n: int) -> int: if n == 0 or n == 1: return n else: return fibonacci(n - 1) + fibonacci(n - 2) print(fibonacci(2)) # 1 print(fibonacci(3))...
false
231d905f24fa551c060748793eee07c9ce563edd
deepaparangi80/Github_pycode
/sum_numb.py
254
4.21875
4
# program to print sum of 1 to n n = int(input('Enter n value')) print('entered value',n) sum = 0 for i in range(1,n+1): '''print(i)''' sum = sum + i print('total sum of 1 to {} is {}'.format(n,sum)) '''print (range(1,n))'''
true
d778b446a64b2a12c3cd521aa611ca71937d2381
JYDP02/DSA_Notebook
/Searching/python/breadth_first_search.py
1,263
4.40625
4
# Python3 Program to print BFS traversal from collections import defaultdict class Graph: # Constructor def __init__(self): self.graph = defaultdict(list) def addEdge(self, u, v): self.graph[u].append(v) def BFS(self, s): # Mark all the vertices as not visited vis...
true
8bf11d623899a8640bd99dc352518a2c562c9e87
lingaraj281/Lingaraj_task2
/q3.py
317
4.15625
4
print("Enter a text") a=str(input()) letter = input("Enter a letter\n") letter_count = 0 for x in a: if x == letter: letter_count = letter_count + 1 num_of_letters = 0 for x in a: if(x != " "): num_of_letters = num_of_letters + 1 frequency = (letter_count/num_of_letters)*100 print(frequency)
true
2e7266efc9d0d28413d9b28053d49830f6c85834
JatinR05/Python-3-basics-series
/17. appending to a file.py
864
4.40625
4
''' Alright, so now we get to appending a file in python. I will just state again that writing will clear the file and write to it just the data you specify in the write operation. Appending will simply take what was already there, and add to it. That said, when you actually go to add to the file, you will still use ....
true
a429e619657d092618f27c24cd0a30abfbda9e3c
JatinR05/Python-3-basics-series
/9. if elif else.py
972
4.34375
4
''' What is going on everyone welcome to my if elif else tutorial video. The idea of this is to add yet another layer of logic to the pre-existing if else statement. See with our typical if else statment, the if will be checked for sure, and the else will only run if the if fails... but then what if you want to chec...
true
4ea711632c6a2bab41d0810384552a220d35eb7a
joe-bollinger/python-projects
/tip_calculator/tip_calculator.py
1,703
4.25
4
print('Tip Calculator') print() # TODO: Get the cost of the meal and print the results get_cost = input('How much did your meal cost? (i.e. 45.67) ') # Convert the input string to a float get_cost = float(get_cost) print(f"Food Cost: ${format(get_cost, '.2f')}") # TODO: Calculate 10% sales tax for the bill and print...
true
f6717518f0fc59f794607f32ae3b2c33f8f88356
sohel2178/Crawler
/file_test.py
1,983
4.15625
4
# f= open('test.txt','r') # print(f.mode) # f.close() # Context Manager # with open('test.txt','r') as f: # Read all the Content # f_content = f.read() # There is another method to read a file line by line # f_content = f.readlines() # print(f_content) # Another way to read All of the Li...
true
d05f46251c0c3550dd70cda5948587aaf72d4901
Kjeldgaard/ProjectEuler
/src/multiple_3_5.py
1,326
4.15625
4
#!/user/bin/env python3 -tt """ Multiples of 3 and 5 https://projecteuler.net/problem=1 """ # Imports import sys import argparse def sum_of_multiples(number :int, divisor :int) -> int: max_multiple = int((number - 1) / divisor) times_multiple = float((max_multiple + 1) / 2) * max_multiple sum_of_multiple...
false
f7f83ae4a45bf1896a6c7d9608f9f560e8bf904f
ishan5886/Python-Learning
/OOPS Concepts/OOPS-Class Variables.py
2,480
4.15625
4
# class Employee: # def __init__(self, first, last, pay): # self.first = first # self.last = last # self.pay = pay # # def fullname(self): # return '{} {}'.format(self.first, self.last) # # def appraise(self): #Without using class variable # self.pay = int(self.pay ...
false
80e00f4c0f308f8c361a884b08c56b60f3e6d4b3
ishan5886/Python-Learning
/Decorators.py
1,020
4.21875
4
#Decorators - Function that takes function as an argument, performs some functionality and returns another function # def outer_function(msg): # def inner_function(): # print(msg) # return inner_function # def decorator_function(original_function): # def wrapper_function(): # return or...
true
661627a12dc195ee9a2c9b26fc340d7e0a2099be
LavanyaBashyagaru/letsupgrade-
/day3assigment.py
539
4.21875
4
'''You all are pilots, you have to land a plane, the altitude required for landing a plane is 1000ft, if it is less than that tell pilot to land the plane, or it is more than that but less than 5000 ft ask the pilot to come down to 1000 ft, else if it is more than 5000ft ask the pilot togo around and try later''' ...
true
70d43485cecbf81e32017c8ebfde6720de099f9a
felipesantos10/Python
/mundoUM/aula8.py
693
4.125
4
#Utilizando módulos #import math ( importando toda a biblioteca de matematica) #from math import sin( importante apenas as informações que eu necessito da biblioteca) #funcionalidades do match #Funcionalidade do match #ceil (arrendomamento pra cima) #floor (arredodamento pra baixo) #trunc ( quebrar o numero) #pow (pot...
false
c61b8d10b26b658b8299c691de760b7ab6eb1249
felipesantos10/Python
/mundoUM/ex022.py
384
4.15625
4
#Crie um programa que lei o nome completo de uma pessoa e mostre #O nome com todas as letras em maisculas #O nome com todas minusculas #Quantas letras ao todo(sem considerar os espaços vazios) #quantas letras tem o primeiro nome nome = str(input('Digite o seu nome completo? ')).strip() print(nome.upper()) print(nome.l...
false
953b47f0be6a1c46f7c75b888dccf5d9e484f920
MarsForever/python_kids
/7-1.py
316
4.125
4
num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) if num1 < num2: print (num1, "is less than",num2) if num1 > num2: print (num2, "is more than",num2) if num1 == num2: print (num1,"is equal to",num2) if num1 != num2: print (num1,"is not equal to", num2)
true
69ab8d1b2593f44099b0514e9b824f070af324f2
syurskyi/100DaysOfCode_i_Python
/01-03-datetimes/datetime_date.py
667
4.25
4
#!python3 from datetime import datetime from datetime import date datetime.today() # datetime.datetime(2018, 2, 19, 14, 38, 52, 133483) today = datetime.today() print(type(today)) # <class 'datetime.datetime'> todaydate = date.today() print(todaydate) # datetime.date(2018, 2, 19) print(type(todaydate)) # <class...
false
6461becb3ef2198b34feba0797459c22ec886e4c
OrSGar/Learning-Python
/FileIO/FileIO.py
2,953
4.40625
4
# Exercise 95 # In colts solution, he first read the contents of the first file with a with # He the used another with and wrote to the new file def copy(file1, file2): """ Copy contents of one file to another :param file1: Path of file to be copied :param file2: Path of destination file """ des...
true
60ce089cbbc612632e6e249227e3cac374e59ad1
MNJetter/aly_python_study
/diceroller.py
1,396
4.15625
4
################################################## ## Begin DICEROLLER. ## ################################################## ## This script is a d20-style dice roller. It ## ## requires the user to input numbers for a ## ## multiplier, dice type, and modifier, and ## ## displays re...
true
a425af412c404ebbef4e634ce335c58b75b7cee1
RhettWimmer/Scripting-for-Animation-and-Games-DGM-3670-
/Python Assignments/scripts(old)2/Calculator.py
2,452
4.21875
4
''' Enter a list of values for the calculator to solve in "Values" Enter a value in to "Power" to calculate the power of "Values" Define "userInput" to tell the calculator what function to solve for. 1 = Add 2 = Subtract 3 = Multiply 4 = Divide 5 = Power 6 = Mean 7 = Median 8 ...
true
3a75c905a3831727c8152674d1daa3c81f2be4d0
sharly2012/wechat-applet-test
/testcase/0001.py
1,598
4.25
4
def bubble_sort(array): length = len(array) if length < 2: return array else: for i in range(length - 1): for j in range(length - 1 - i): if array[j] > array[j + 1]: array[j], array[j + 1] = array[j + 1], array[j] return array def qui...
false
db95ed4eccce222cea4b4326ab5e4586f2916ac3
JimGeist/sb_18-02-20_Python_Data_Structures_Exercise
/17_mode/mode.py
856
4.28125
4
def mode(nums): """Return most-common number in list. For this function, there will always be a single-most-common value; you do not need to worry about handling cases where more than one item occurs the same number of times. >>> mode([1, 2, 1]) 1 >>> mode([2, 2, 3, 3, 2]) ...
true
cce0a73b95333ca1cdb18857403a41ede3cdb6a4
JimGeist/sb_18-02-20_Python_Data_Structures_Exercise
/12_multiply_even_numbers/multiply_even_numbers.py
589
4.375
4
def multiply_even_numbers(nums): """Multiply the even numbers. >>> multiply_even_numbers([2, 3, 4, 5, 6]) 48 >>> multiply_even_numbers([3, 4, 5]) 4 If there are no even numbers, return 1. >>> multiply_even_numbers([1, 3, 5]) 1 If the list is empty, return...
false
f320f52b98025d0edfb543da612d28752ec6f579
JimGeist/sb_18-02-20_Python_Data_Structures_Exercise
/06_single_letter_count/single_letter_count.py
587
4.28125
4
def single_letter_count(word, letter): """How many times does letter appear in word (case-insensitively)? >>> single_letter_count('Hello World', 'h') 1 >>> single_letter_count('Hello World', 'z') 0 >>> single_letter_count("Hello World", 'l') 3 """ # letter...
false
90707b2e54d15dcf7ecdcf4286a2409b271968a4
ibrahimuslu/udacity-p0
/Task4.py
1,555
4.15625
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv count =0 textPhoneDict = {} callingPhoneDict = {} receiveingPhoneDict = {} with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) for text in texts: if text[0] not in tex...
true
35c53757e5669ad24a4b61aa6878b722de8636e1
martinee300/Python-Code-Martinee300
/w3resource/Python Numpy/Qn3_PythonNumpy_CreateReshapeMatrix.py
508
4.15625
4
# -*- coding: utf-8 -*- """ Created on Mon Aug 27 14:24:51 2018 @author: dsiow """ # ============================================================================= # 3. Create a 3x3 matrix with values ranging from 2 to 10. # Expected Output: # [[ 2 3 4] # [ 5 6 7] # [ 8 9 10]] # ===================================...
true
cb0ae7e3a71550c42711351027a21917668560ba
robinrob/python
/practice/print_reverse.py
441
4.125
4
#!/usr/bin/env python class Node(object): def __init__(self, data=None, next_node=None): self.data = data self.next = next_node def ReversePrint(head): if head is not None: if head.next is not None: ReversePrint(head.next) print head.data head = Node(data=0) one =...
true
237a9ccbbfa346ff3956f90df5f52af4272b9291
robinrob/python
/practice/postorder_traversal.py
727
4.1875
4
#!/usr/bin/env python class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right """ Node is defined as self.left (the left child of the node) self.right (the right child of the node) self.data (the value of the node) """ lr = Nod...
true
1c047ac76bcb2fa3e902d3f5b6e0e145cc866c5d
KyleLawson16/mis3640
/session02/calc.py
871
4.21875
4
''' Exercise 1 ''' import math # 1. radius = 5 volume = (4 / 3 * math.pi * (radius**3)) print(f'1. The volume of a sphere with radius {radius} is {round(volume, 2)} units cubed.') # 2. price = 24.95 discount = 0.4 copies = 60 cost = (price * discount) + 3 + (0.75 * (copies - 1)) print(f'2. The total wholesale cos...
true
67cf1c78b300282078a2e00abafe7b8f81d4f837
roshandcoo7/DSA
/Hashing/Hash_chaining.py
723
4.25
4
# Function to display hash table def dispay(hashTable): for i in range(len(hashTable)): print(i, end = " ") for j in hashTable[i]: print("-->", end = " ") print(j, end = " ") print() # Creating hash table as a nested list HashTable = [[] for _ in range(10)] # Hash ...
false
a505d2e7912bd22c14d95df0e29c7caec4e28ac4
roshandcoo7/DSA
/Tree/BST.py
2,578
4.125
4
class Node: def __init__(self, data): self.left = None self.right = None self.data = data # INSERTING AN ELEMENT TO THE TREE def insert(self, data): if self.data is None: self.data = data else: if self.data <= data: if s...
false
2edf1b59279ba88f504a800fc9faae1bcd71000d
jorgeortizc06/curso_python
/sets.py
407
4.125
4
#Set: es una coleccion que no esta ordenada ni indexada y se mete en llaves. #Create an empty set s = set() #Add elements to set s.add(1) s.add(2) s.add(3) s.add(4) s.add(3) #Los sets no admite valores repetidos. No se agrega a la cadena print(s) s.remove(2) print(s) #f me permite introducir parametros en println e...
false
91b435e4c6afda99270bec91eae519bcb8a09cf8
amolsmarathe/python_programs_and_solutions
/2-Basic_NextConceptsAndNumpy/4-LocalGlobalVariables.py
1,522
4.40625
4
# Local- defined inside the function # Global- defined outside the function # Global can always be accessed inside function, given that same variable is not defined inside function, however, # local variable cannot be accessed outside the function # Local and global variables are different # 'global'-Global variable ...
true
30a9464d99def27837a31aa58c3dc01a4e494ce6
amolsmarathe/python_programs_and_solutions
/3-ObjectOriented/5-Polymorphism-3&4-MethodOverload&Override.py
1,439
4.71875
5
# Method Overload (within same class): 2 methods exist with same name but different number of args # - NOT supported as it is in python,we CANNOT have 2methods with same name in python. But there is a similar concept # - In python,we define method with arg=None &while creating an object,it will get default value No...
true
6b7990e5343b9d1d270c6ce96391a63ca89a708c
v-v-d/algo_and_structures_python
/Lesson_1/3.py
994
4.125
4
# 3. По введенным пользователем координатам двух точек вывести # уравнение прямой вида y = kx + b, проходящей через эти точки. try: x1 = float(input('Введите значение \'x\' первой точки: ')) y1 = float(input('Введите значение \'y\' первой точки: ')) x2 = float(input('Введите значение \'x\' второй точки: ')...
false
6ae308c70df76a428172a9afa44fc0a4870e55ca
v-v-d/algo_and_structures_python
/Lesson_7/2.py
1,348
4.34375
4
""" 2. Отсортируйте по возрастанию методом слияния одномерный вещественный массив, заданный случайными числами на промежутке [0; 50). Выведите на экран исходный и отсортированный массивы. """ import random def merge_sort(lst): if len(lst) > 1: center = len(lst) // 2 left = lst[:center] rig...
false
516073604835fd28c8f1c6e3a63656d9e513efdb
v-v-d/algo_and_structures_python
/Lesson_2/4.py
1,487
4.1875
4
""" 4. Найти сумму n элементов следующего ряда чисел: 1 -0.5 0.25 -0.125 ... Количество элементов (n) вводится с клавиатуры. """ # Рекурсия def get_sum_of_series(num_of_elements, num=1, summ=0): summ += num num /= -2 num_of_elements -= 1 if num_of_elements: return get_sum_of_series(num_of_elem...
false
d90b0446da8f2201d5bc0ac0bed1b15dca86eefd
qikuta/python_programs
/text_to_ascii.py
760
4.5
4
# Quentin Ikuta # August 7, 2022 # This program takes input from user, anything from a-z, A-Z, or 0-9 -- # converts the input into ASCII code, then finally prints the original input and ASCII code. # ask user for input user_string = input("please enter anything a-z, A-Z, and/or 0-9:") # iterate through each character...
true
2b3cb34f4d91c43bd4713619e0adbd53dbd6f17e
ICANDIGITAL/crash_course_python
/chapter_7/restaurant_seating.py
230
4.1875
4
seating = input("How many people are in your dinner group? ") seating = int(seating) if seating >= 8: print("You'll have to wait for a table of " + str(seating) + ".") else: print("There is currently a table available.")
true
d415802c81d337356a85c4c0f94ca993fbcb1d7d
ICANDIGITAL/crash_course_python
/chapter_8/unchanged_magicians.py
421
4.125
4
def show_magicians(magicians): """Displays the name of each magicians in a list.""" for magician in magicians: print(magician.title()) magical = ['aalto simo', 'al baker', 'alessandro cagliostro', 'paul daniels'] def make_great(tricks): """Modifies the original function by adding a message.""" ...
true
d13d378ac3ba53279864e205439454b893c52dbf
monkop/Data-Structure-in-Python
/Sorting/bubble_sort.py
441
4.28125
4
arr = [] n = int(input("Enter size of array :")) #this input ask for our array size for i in range(n): n1 = int(input("Enter Array : ")) arr.append(n1) print("Your Array : ",arr) #for Showing Your actual array for i in range(n): for j in range(n-1-i): if arr[j] > arr[j+1]: ...
false
7cd438649c6339d0c494ceaac380295e75aa2a97
monkop/Data-Structure-in-Python
/Arrays/insertionSort.py
382
4.125
4
arr = [] n = int(input("Enter Size Of array : ")) for i in range(n): array = int(input("Enter Lisy Of Array : ")) arr.append(array) print("Your Unsorted Array",arr) for i in range(1,n): temp = arr[i] j = i-1 while j >= 0 and arr[j] > temp: arr[j+1] = arr[j] j -=...
false
5550808695e2649c4c0f1136ba6ddf741ac1da8a
monkop/Data-Structure-in-Python
/Arrays/bu_pratice.py
401
4.125
4
arr = [] n = int(input("Enter size of array : ")) for i in range(n): array = int(input("Enter list of array : ")) arr.append(array) print(f"Your Unsorted Array {arr}") for i in range(0,n): for j in range(n-1-i): if(arr[j] > arr[j+1]): temp = arr[j] arr[j] = arr[j+1] ...
false
e75281768755ccae44dc2ea91b4cba0f1b775f3a
monkop/Data-Structure-in-Python
/Arrays/PraticeBS.py
348
4.125
4
arr = [] n = int(input("Size : ")) for i in range(n): array = int(input("Enter List Of array : ")) arr.append(array) print(f"Your Array {arr}") for i in range(n-1): for j in range(n-1-i): if(arr[j] > arr[j+1]): temp = arr[j] arr[j] = arr[j+1] arr[j+1] = temp pri...
false
be760a2488631c90a135637a524a857ee1bfc7d3
Divyansh-coder/python_challenge_1
/area_of_circle.py
244
4.5625
5
#import math to use pi value import math #take radius as (real number)input from user radius = float(input("Enter the radius of the circle: ")) #print area of circle print("The area of the circle with radius",radius,"is :",math.pi*radius**2)
true
7a287ab16b4fa019dc5190951f5f6268ae9d6d0b
Mannuel25/Mini-Store-Project
/items_in_file.py
657
4.34375
4
def no_of_items_in_file(): """ Displays the total number of items in the file :return: None """ filename = 'myStore.txt' # open original file to read its contents open_file = open(filename,'r') description = open_file.readline() # make a variable to count the number of items ...
true
2e93d1859265eb0f7f53a7a34c2458c8201acc20
xiaofeixiawang/cs101
/lesson5/problem-set2.py
1,744
4.1875
4
1. # Write a procedure, shift, which takes as its input a lowercase letter, # a-z and returns the next letter in the alphabet after it, with 'a' # following 'z'. def shift(letter): if letter=='z': return 'a' return chr(ord(letter)+1) print shift('a') #>>> b print shift('n') #>>> o print shift('z') #...
true
e424eb0df975b287825768065921bdac8473c72d
RaisuFire/ExProject
/leetCode/Medium/Rotate Image.py
758
4.125
4
from copy import deepcopy class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ c = deepcopy(matrix) for i in range(len(matrix)): matrix[i] = [c[j][i]...
true
aeca2a9b20564854381cba2a7478f5cfbb266201
sumitdba10/learnpython3thehardway
/ex11.py
1,108
4.25
4
print("How old are you?", end=' ') age = input() print("How tall are you in inches?",end=' ') height = input() print("How much do you weigh in lbs?",end=' ') weight = input() # end=' ' at the end of each print line. This tells print to not end the line with a newline character and go to the next line. print(f"So, you'...
true
f1169d8cfd40df1dcf07287ffaab636bb51f28db
sumitdba10/learnpython3thehardway
/ex20.py
1,856
4.5625
5
# from sys package, we are importing argument variables module from sys import argv import os # asigning two variables to argv module script,input_file = argv # defining a function to read all content of a file def print_all(f): print(f.read()) # defining a function to reset pointer to 0 position def rewind(f): ...
true
6ff3500c81ed429be175c5610a853c2e0f98a728
sumitdba10/learnpython3thehardway
/ex23.py
1,738
4.5625
5
# importing sys package import sys #assigning three variables to argv (argument variable) module # script : this whole program as .py # encoding : variable to define encoding e.g. unicode - utf8/utf16/utf32 or ASCII etcself. #error : to store errors script,encoding, errors = sys.argv # defining a function with 3 argu...
true
c640eccb766d3be16d513516ca9b3bb7499df39e
Sophorth/mypython_exercise
/ex11.py
569
4.4375
4
print " " print " ------Start Exercise 11, Asking Question ------" print " " print "What is your name: ", name = raw_input() print "How tall are you: ", height = raw_input() print "How old are you: ", age = raw_input() print "You name is %s and your are %s inches tall and you are %s" % (name, height, age) # We can do...
true
9fb33802cd8348fc3fa37be0c0bc61e81bfb683c
nojronatron/PythonPlayarea
/PycharmProjects/Chapter4Explorations/Heros_Inventory.py
1,366
4.25
4
__author__ = 'Blue' # Hero's Inventory # Demonstrates tuple creation # Create an empty Tuple inventory = () # Treat the tuple as a condition if not inventory: print("You are empty-handed.") # create a tuple with some items inventory = ("sword", "armor", "shield", "healing p...
true
aca33cc8e9e6394ba986c45caf8d3eb96f8e367c
nojronatron/PythonPlayarea
/PycharmProjects/Chapter 4 Exercizes/Word_Jumble_Game.py
1,319
4.25
4
# -------------------------------------------------# # Title: Chapter 4: Word Jumble Game # Author: Jon Rumsey # Date: 3-May-2015 # Desc: Computer picks a random word from a list and jumbles it # User is asked to guess the word. # 1. Create sequence of words # 2. Pick one word randomly from the seque...
true
56321bc2ea255b211551506b56bc2e255cdcd34d
rahuldevyadav/Portfolio-PYTHON
/gui/program2.py
436
4.375
4
#In this program we will create frame #size of widget #and putting button on it from tkinter import * root= Tk() frame = Frame(root, width=300,height =200) # ONCE WE DEFINE BUTTON WIDTH AND HEIGHT IS DEFAULT button = Button(frame,text='Button1') button.pack() frame.pack() # # frame2 = Frame(root,width=300,height =20...
true
4c4eda77068ff3b077039b6cdad46f29b679cb94
Erivks/aprendendo-python
/POO/POOIII/Objetos e Dicionários.py
1,430
4.375
4
#COMPARAÇÃO ENTRE OBJETOS E DICIONÁRIOS E # MÉTODO ESPECIAL PARA DICIONÁRIOS '''DICIONÁRIO''' #Criando dict pessoa = {'Nome': 'Lucas', 'Emprego': 'Advogado', 'Idade': 20, 'Cor de cabelo': 'Pedro'} #Mudando um valor dentro do dict pessoa['Nome'] = 'Erick' #Acessando valor print(pessoa['Emprego']) #Criando novas chaves...
false
8a80887a2d41386d9f9097abc97c08298076757d
learnPythonGit/pythonGitRepo
/Assignments/20200413_Control_Flow/secondLargeNumSaurav.py
998
4.40625
4
# .................................... # Python Assignment : # Date : 15/04/2020 : # Developer : Saurav Kumar : # Topic : Find Second Largest Num : # Git Branch: D15042020saurav : # ................................... # Compare two number and fi...
true
cd1f6862b5cae32aa0b6b28c6c084ef3d69afa5c
learnPythonGit/pythonGitRepo
/Assignments/20200413_Control_Flow/ControlFlowAssignments_Kiran.py
2,828
4.40625
4
# :................................................................................: # : Python Assignment. : # :................................................................................: # : Date : 15/04/2020 ...
false
636a447d89387773056d4e81c6a7519cea3675dd
TCIrose/watchlist
/app/models/movie.py
1,124
4.125
4
class Movie: ''' Movie class to define Movie Objects ''' def __init__(self, id, title, overview, poster, vote_average, vote_count): ''' Args: 1. Title - The name of the movie 2. Overview - A short description on the movie 3. image- The poster image for the movie ...
true
4b11b5f80610aa514338426c0b0262b20c81aa3c
Cretis/Triangle567
/TestTriangle.py
2,667
4.15625
4
# -*- coding: utf-8 -*- """ Updated Jan 21, 2018 The primary goal of this file is to demonstrate a simple unittest implementation @author: jrr @author: rk """ import unittest from Triangle import classifyTriangle # This code implements the unit test functionality # https://docs.python.org/3/library/unittest.html h...
true
9971c2273e83ae2010a55f76d3f3c8871098bb53
technolawgeek/HW
/Lesson1/Task5.py
2,048
4.1875
4
""" Запросите у пользователя значения выручки и издержек фирмы. Определите, с каким финансовым результатом работает фирма (прибыль — выручка больше издержек, или убыток — издержки больше выручки). Выведите соответствующее сообщение. Если фирма отработала с прибылью, вычислите рентабельность выручки (соотношение прибыли...
false
7cbea7f0bd0645048484806489ed71c2c6e580b7
wonpyo/Python
/Basic/VariableScope.py
1,207
4.3125
4
# Variables can only reach the area in which they are defined, which is called scope. Think of it as the area of code where variables can be used. # Python supports global variables (usable in the entire program) and local variables. # By default, all variables declared in a function are local variables. To access a g...
true
25209b004ddb4eae65d34e63235622fa9fa44a3d
wonpyo/Python
/Basic/MethodOverloading.py
1,019
4.4375
4
# Several ways to call a method (method overloading) # In Python you can define a method in such a way that there are multiple ways to call it. # Given a single method or function, we can specify the number of parameters ourself. # Depending on the function definition, it can be called with zero, one, two or more para...
true
a2cfdf0723538af644a2eee5372069785bdc048e
wonpyo/Python
/Basic/Threading.py
1,526
4.53125
5
""" A thread is an operating system process with different features than a normal process: 1. Threads exist as a subset of a process 2. Threads share memory and resources 3. Processes have a different address space in memory When would you use threading? Usually when you want a function to occur at the same time as yo...
true
50a126e7540a343ff18cbe16262324bf091cc0a4
cameron-teed/ICS3U-3-08-PY
/leap-year.py
548
4.34375
4
#!/usr/bin/env python3 # Created by: Cameron Teed # Created on: Oct 2019 # This is program finds out if it's a leap year def main(): # calculates if it is a leap year # variables leap_year = " is not" # input year = int(input("What is the year: ")) # process # output if year % 4 ==...
true
50cdfe6dd5d6826a19477bbd440f7b1af507619e
ElleDennis/build-a-blog
/crypto/helpers.py
1,276
4.4375
4
def alphabet_position(letter): """alphabet_position receives single letter string & returns 0-based numerical position in alphabet of that letter.""" alphabetL = "abcdefghijklmnopqrstuvwxyz" alphabetU = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" letter = letter.lower() if letter in alphabetL: retu...
true
4ad19fd2cc5629774a834fbffcdfae0e56c40a05
tanyuejiao/python_2.7_stuty
/lxf/interation2.py
1,182
4.25
4
#!/usr/bin/python # coding:utf-8 # 当我们使用for循环时,只要作用于一个可迭代对象,for循环就可以正常运行,而我们不太关心该对象究竟是list还是其他数据类型。 # 那么,如何判断一个对象是可迭代对象呢?方法是通过collections模块的Iterable类型判断: from collections import Iterable # 可以使用isinstance()判断一个对象是否是Iterable对象: # str是否可迭代 a = isinstance("abc", Iterable) print ("a: %s" % a) # list是否可迭代 a = isinstance([1,...
false
ef79d66df178986222288328d66bb6daa3a4b3f1
tanyuejiao/python_2.7_stuty
/lxf/class2.py
1,908
4.125
4
#!/usr/bin/python # coding:utf-8 import types '''获取对象信息 当我们拿到一个对象的引用时,如何知道这个对象是什么类型、有哪些方法呢? 使用type() 首先,我们来判断对象类型,使用type()函数: 基本类型都可以用type()判断:''' print type(123) # <class 'int'> print type('str') # <class 'str'> print type(None) # <type(None) 'NoneType'> # 如果一个变量指向函数或者类,也可以用type()判断: def abs(): pass class Ani...
false
e1a296cfe2eb437daad088ff4070a689872bb03e
ishaik0714/MyPythonCode
/Strings_Prog.py
1,232
4.375
4
mult_str = """This is a multi line string, this can have data in multiple lines and can be printed in multiple lines !""" print(mult_str) # The Multi-line string can be in either in three single quotes or three double quotes. st1 = "Hello" st2 = "World!" print (st1+st2) # String Concatenation str1 = "Hello Worl...
true
8698aa545749d13a550704ba005888e0fbb0001f
syedsouban/PyEditor
/PyEditor.py
1,690
4.15625
4
import sys print("Welcome to Python 2 Text Editor") condition = True while condition == True: print("""What do you want to do: 1. Creating a new file 2. Writing to a saved file 3. Viewing a saved file 4. Exit """) choice=eval(input("Enter your choice: ")) if choic...
true
d44ab2f4b12fbeb112faceddf889d477f0c796b2
sunil830/PracticePerfect
/ListOverlap.py
1,315
4.25
4
""" Author: Sunil Krishnan Date: 17-Apr-2016 Name: ListOverlap.py Reference: http://www.practicepython.org/exercise/2014/03/05/05-list-overlap.html Problem Statement: Take two lists, say for example these two: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13...
true
447a4be3d6ce706a5bce989a1874910855360883
bthodla/stock_tweets
/turtle_utils.py
966
4.1875
4
import turtle import math import time def polyline(t: turtle, sides: int, length: int, angle: int): """Draws *sides* line segments with the given length and angle (in degrees) between them :param t: turtle :param sides: :param length: :param angle: :return: """ for i in range(sides)...
false
b2c0f4d56af52930fb94356d565dc2a7822acd3b
KennethTBarrett/cs-module-project-iterative-sorting
/src/iterative_sorting/iterative_sorting.py
2,050
4.40625
4
# TO-DO: Complete the selection_sort() function below def selection_sort(arr): # loop through n elements for i in range(0, len(arr) - 1): cur_index = i smallest_index = cur_index # TO-DO: find next smallest element # For loop, in range of untouched indexes. for index in r...
true
e8ca51cc2ec589c50b304d5e8b25d04fc9670cc8
Cbkhare/Challenges
/Fb_beautiful_strings.py
2,140
4.15625
4
#In case data is passed as a parameter from sys import argv import string from operator import itemgetter file_name = argv[1] fp = open(file_name,'r+') contents = [line.strip('\n') for line in fp] #print (contents) alphas = list(string.ascii_lowercase) #Else use this list(map(chr, range(97, 123))) #print ...
true
fd331cd98a5383c06c45605f4a736462cfd78502
Cbkhare/Challenges
/remove_char_crct.py
1,073
4.21875
4
#In case data is passed as a parameter from sys import argv, getsizeof #from operator import itemgetter #import re #import math #from itertools import permutations #from string import ascii_uppercase file_name = argv[1] fp = open(file_name,'r+') contents = [line.strip('\n').split(', ') for line in fp] for item i...
true
8a4d50a0c008157298bfbd1c818f8192a48b9d5f
Cbkhare/Challenges
/swap_case.py
878
4.15625
4
#In case data is passed as a parameter from sys import argv, getsizeof #from operator import itemgetter #import re #import math #from itertools import permutations #from string import ascii_uppercase file_name = argv[1] fp = open(file_name,'r+') contents = [line.strip('\n') for line in fp] for item in contents: ...
true