blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
22f684c1ea3a1f78b58f9b8db35238d5041091ce
suneeshms96/python-password-validator
/python-password-validator.py
795
4.28125
4
digit_count = 0 alpha_count = 0 char_count = 0 lower_count = 0 #we can change password strength requirement here..! required_digit_count = 5 required_alpha_count = 2 required_char_count = 4 required_lower_count = 2 uname = input('Enter your username: ') word = input('Enter a password : ') for w in str(word): if ...
true
321abe804a7ce7b47ee132886559168e3b52d640
wojlas/Guess-the-number
/guess_the_number.py
909
4.1875
4
import random def guess_the_number(): try: """function checks if the given number is equal to the drawn number and displays an appropriate message""" user_number = int(input("Guess the number: ")) index = 0 while user_number != random_number: if user_number < ra...
true
29ab376394ff53ed3542e6f22877b23d5d115e72
dchtexas1/pythonFiles
/division.py
233
4.4375
4
"""Gives quotient and remainder of two numbers.""" a = input("Enter the first number: ") b = input("Enter the second number: ") print("The quotient of {} divided by {} is {} with a remainder of {}.".format( a, b, a / b, a % b))
true
88cb18925a67570cc548a039b40ea70fcf473889
Woutah/AutoConvert
/timer.py
2,290
4.25
4
"""Simple timer which can be used to get the wall/cpu time of a process. Implements the "with x:" to measure timings more easily. """ from time import process_time import time class CpuTimer: def __init__(self): self._start_time = process_time() self._paused = True self._pause_time = process_time() self._...
true
8c25a31f8dd7dba671150a51ef052880bdc5c402
Garce09/ShirleysMentees
/logic_recursion.py
1,856
4.375
4
############ Q1. Ask the user for an integer, multiply it by itself + 1, and print the result # Topic: user input ############ Q2. Ask the user for an integer # If it is an even number, print "even" # If it is an odd number, print "odd" # Topic: conditionals, user input ############# Q...
true
b4eddaa8ceada22cdf3d2c3f12e441752cfb6425
larlyssa/checkio
/home/house_password.py
1,648
4.1875
4
""" DIFFICULTY: ELEMENTARY Stephan and Sophia forget about security and use simple passwords for everything. Help Nikola develop a password security check module. The password will be considered strong enough if its length is greater than or equal to 10 symbols, it has at least one digit, as well as containing one up...
true
f1053a896ab4d62501f8f1930514e2d0e2e08dde
RodrigoAk/exercises
/solutions/ex13.py
545
4.3125
4
''' You are given a positive integer N which represents the number of steps in a staircase. You can either climb 1 or 2 steps at a time. Write a function that returns the number of unique ways to climb the stairs ''' import math def staircase(n): spaces = n//2 + n % 2 num2 = n//2 answer = 0 while(spac...
true
74ec0c3112aea6992d54a59e2cec323143085df8
hitanshkadakia/Python_Tutorial
/function.py
1,419
4.75
5
# Creating a Function # In Python a function is defined using the def keyword: def my_function(): print("Hello from a function") # Calling a Function # To call a function, use the function name followed by parenthesis: def my_function(): print("Hello from a function") my_function() # Arguments ...
true
5f2b869fad97bd52b0381a4f95ebce15c54c6568
hitanshkadakia/Python_Tutorial
/if-elsestatement.py
711
4.21875
4
#If statement a = 33 b = 200 if b > a: print("b is greater than a") #elif a = 33 b = 33 if b > a: print("b is greater than a") elif a == b: print("a and b are equal") #else a = 200 b = 33 if b > a: print("b is greater than a") elif a == b: print("a and b are equal") else: print...
true
17aeb081b24147badad1e1945acae197fe287d43
BawangGoh-zz/ELEC0088-Lab
/Exercise2.py
1,122
4.125
4
## Part 1) Implement a DNS querying program that stores the mapping between the names ## into IP addresses. Explicitly define the name of the network into the databases ## Part 2) Allow for the user to query several types of NS record (NS, MX, etc). # IP addresses query def IPquery(dct, string): return dct.get(stri...
true
0ac9ea93dd1a9cc31946535c2b6982052f6e7c60
moosuchot/handyscripts
/pyscript/add_list.py
473
4.25
4
#!/usr/bin/env python #coding:utf-8 ''' 得到n个相同长度list的对应位置的和后的list. 比如: a = [1,2,3,4] b = [5,6,7,8] 求两个list的和. 结果为: c = [6,8,10,12] ''' def add_list(*lsts): merged_list = [] for i in xrange(len(lsts[0])): merged_list.append(sum([lst[i] for lst in lsts])) return merged_list if __name__ == '__main__'...
false
ff746957eac224baeb7c47522ea4eb4edb576f0e
Ahisanz/luizacode
/python/ana_sanz_adivinha2.py
1,331
4.125
4
import random print("Seja bem vindo! Qual é o seu nome?") user_name = input() print(f"Prazer, {user_name}, vou te explicar as regras do jogo, primeiro eu vou pensar em um número de 1 a 20.") random_number = random.randint(1, 21) print() print("Pronto, pensei! Agora eu vou te dar 6 chances para acertar qual é o número...
false
222ff971a2cd98b5e876a9b3d9c9e4c7ec891793
Ahisanz/luizacode
/python/exercio1_dia1.py
577
4.25
4
''' Crie um programa que peça o nome do usuário, diga que é um prazer conhecê-lo e pergunte a idade dele. O programa se apresentará como um robô - pode inventar o nome - e dirá quantos anos mais velhos que o usuário ele é. O robô tem 107 anos Não se preocupar se o usuário já fez aniversário ou não ''' print("Olá, qu...
false
a48867d01dbbd259e0cddf2a0349d9a10b4b99fa
guilherme-witkosky/MI66-T5
/Lista 2/L2E02.py
258
4.15625
4
#Faça um Programa que peça um valor e mostre #na tela se o valor é positivo ou negativo. #Exercício 2 num = float(input("Informe um numero: ")) if num >=0: print("O numero digitado e positivo") else: print("O numero digitado e negativo")
false
7df8038be3cbd4f3d80a266420efa8ff3ebd258f
guilherme-witkosky/MI66-T5
/Lista 2/L2E10.py
711
4.15625
4
#Exercício 10 print("Informe o período em que você estuda:") print("(M) Matutino") print("(V) Vespertino") print("(N) Noturno") print("------------------------------------------") p = input("Seu Período = ") print("------------------------------------------") periodo = p.upper() print("=================================...
false
242f4e0d36978026ba5458e18defc7cb67668422
guilherme-witkosky/MI66-T5
/Lista 1/L1E11.py
627
4.40625
4
#Exercício 11 #Faça um Programa que peça 2 números inteiros e um número real. Calcule e mostre: # A) o produto do dobro do primeiro com metade do segundo. # B) a soma do triplo do primeiro com o terceiro. # C) o terceiro elevado ao cubo. int1 = int(input('Informe um numero inteiro: ')) int2 = int(input('Informe outr...
false
b2c8d209db76afe3959cb2a10117366c133f5008
guilherme-witkosky/MI66-T5
/Lista 2/L2E16.py
1,214
4.1875
4
#Exercicio 16 #Faça um programa que calcule as raízes de uma equação do segundo grau, na forma ax2 + bx + c. O programa deverá pedir os valores de a, b e c e #fazer as consistências, informando ao usuário nas seguintes situações: Se o usuário informar o valor de A igual a zero, a equação não é do segundo grau e o #pr...
false
8c180b5c53bc9a211ec88c7a4477987a307f0ed9
guilherme-witkosky/MI66-T5
/Lista 8/L8E05.py
1,310
4.125
4
#Classe Conta Corrente: Crie uma classe para implementar uma conta corrente. #A classe deve possuir os seguintes atributos: número da conta, nome do correntista e saldo. # Os métodos são os seguintes: alterarNome, depósito e saque; No construtor, saldo é opcional, # com valor default zero e os demais atributos são...
false
8a0a9d68892f0dbac3b8e55eb69e82f1788cc05e
theoliao1998/Cracking-the-Coding-Interview
/02 Linked Lists/2-4-Partition.py
1,801
4.3125
4
# Partition: Write code to partition a linked list around a value x, such that all nodes less than x come # before all nodes greater than or equal to x. If x is contained within the list, the values of x only need # to be after the elements less than x (see below). The partition element x can appear anywhere in the # "...
true
6c3b5c12c863b87a0c1d0cdb3ddc164caafb5862
jimsun25/python_practice
/turtle_race/main.py
927
4.21875
4
from turtle import Turtle, Screen import random race_on = False screen = Screen() screen.setup(width=500, height=400) user_bet = screen.textinput(title="Make your bet", prompt="Which turtle will win the race? Enter a color: ") colors = ["red", "orange", "yellow", "green", "blue", "purple"] y_pos = [-75, -45, -15, 15, 4...
true
f5f9dc8646c6e16b68dfed9ec46ef70328964ecd
jorge800/pythonLanguage
/arithmetic.py
564
4.1875
4
# Python Arithmetic Operators. # Let x = 34 and y = 78, then find z; x = 34 # Let x = 34 y = 78 # y = 78 z = (x + y) # Addition Operator print("Addition:\n"+str(z)) z = (x - y) # Substraction Operator print("Substraction:\n"+str(z)) z = (x * y) # Multiplication Operator print("Multiplication:\n"+str(z)) z = (x / y) # ...
false
b8ee4804c73a956a36f4b00d94d50551149a2ad5
sdahal1/pythonoctober
/fundamentals/python_fun/bootleg_functionsbasic2.py
1,213
4.65625
5
# CountUP - Create a function that accepts a number as an input. Return a new list that counts up by 1, from 1 (as the 0th element) up to num (as the last element). # Example: countup(5) should return [1,2,3,4,5] # Print and Return - Create a function that will receive a list with three numbers. Print the second val...
true
1a03184e8ca72e019f6afc71915f90837ecf2c34
spacecase123/cracking_the_code_interview_v5_python
/array_strings/1.2_reverse_string.py
788
4.3125
4
''' Implement a function void reverse(char* str) in C or C++ which reverses a null- terminated string. ''' def reverse(string): '''reverse in place''' string_len = len(string) if string_len <= 1 : return string last = string_len - 1 string = list(string) for i in range(string_len / 2): ...
true
05b4df401f64144d9147a616b5ff5ac94d0b0eac
Howardman2/Hello-World
/13.py
485
4.125
4
print('Welcome to TRUE or FALSE') print ('Please answer with yes or no') Truth = input('Mr Gallo is the best: ') if Truth !='yes': print('wrong') if Truth =='yes': print('Correct!') Falth = input('Coding is dumb: ') if Falth =='yes': print('WRONG') if Falth !='yes': print('Correct!') Truce...
false
1077da31c67125636c41d22aed5e7359d13ce82d
bobbybabra/codeGuild
/basics/dictIterate.py
1,016
4.1875
4
people = {} people['Bob'] = 22 people['Carol'] = 47 people['Justin'] = 14 for i, k in people.items(): print (i,k) #for i in people.keys(): # print (i) list(people.keys()) print people.keys() # print(people) people = {} ########### from quiz solution, this dict is not formatted #### correctly, but the point...
false
acf1238f2f25e2ba32b1c0086b1a75bcc0c6905a
gauravbachani/Fortran-MPI
/Matplotlib/tutorial021_plotColourFills.py
1,484
4.15625
4
# Plotting tutorials in Python # Fill colours inside plots import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl mpl.style.use('default') x = np.linspace(-2.0*np.pi, 2.0*np.pi, 201) C, S = np.cos(x), np.sin(x) plt.plot(x, C, color='g', label='Cosine') plt.plot(x, S, color='r', label='Sine') # ...
true
60a97cefda9fa31dda0b46740b8dc5de42bc17fe
StephenH69/CodeWars-Python
/8-total-amount-of-points.py
1,606
4.25
4
# Our football team finished the championship. The result of each match look like "x:y". # Results of all matches are recorded in the collection. # For example: ["3:1", "2:2", "0:1", ...] # Write a function that takes such collection and counts the points of our team in the championship. # Rules for counting points...
true
57f3618fc797fa6bec6c896585f94685b2265337
StephenH69/CodeWars-Python
/8-blue-and-red-marbles.py
1,517
4.1875
4
# You and a friend have decided to play a game to drill your # statistical intuitions. The game works like this: # You have a bunch of red and blue marbles. To start the game you # grab a handful of marbles of each color and put them into the bag, # keeping track of how many of each color go in. You take turns reac...
true
7c86e26e0bea599be21bc9a00c788f2e9e63cef4
VaishnaviBandi/6063_CSPP1
/m4/p3/longest_substring.py
1,431
4.3125
4
'''Assume s is a string of lower case characters. Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your program should print Longest substring in alphabetical order is: beggh In the case of ties, print the first subst...
true
b61b666855df35a0968802a9018d3baf29187cc2
VaishnaviBandi/6063_CSPP1
/m22/assignment1/read_input.py
426
4.375
4
''' Write a python program to read multiple lines of text input and store the input into a string. ''' def main(): """python program to read multiple lines of text input and store the input into a string.""" string = '' no_of_lines = int(input()) for each_line in range(no_of_lines): string =...
true
264245a0748c7c261abf311076a164b9cd1f4379
aaronspindler-archive/CSCI1030U
/Labs/lab04.py
1,453
4.375
4
#Date: October 8th 2015 #Practising printing the statment testing 1 2 3... print("testing 1 2 3...") #Printing numbers, variables, and num equations x=8 print(x) print(x*2) #Defining other variable types name = "Carla Rodriguez Mendoza" length = 14.5 width = 7.25 #Printing statments print("X: ") print(x) print("Nam...
true
fcf797b741b31215d44684056807336655a29638
artbb/gb_python
/hw2_2.py
642
4.21875
4
# 2) Для списка реализовать обмен значений соседних элементов, т.е. Значениями обмениваются # элементы с индексами 0 и 1, 2 и 3 и т.д. При нечетном количестве элементов последний сохранить # на своем месте. Для заполнения списка элементов необходимо использовать функцию input(). data = input('Введите не менее 3 симв...
false
7007ff4c5d4cd9ae59ba9642bf27f5b38c6af4d1
artbb/gb_python
/hw3_2.py
1,048
4.25
4
""" 2. Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя: имя, фамилия, год рождения, город проживания, email, телефон. Функция должна принимать параметры как именованные аргументы. Реализовать вывод данных о пользователе одной строкой. """ def user_data(name, surname, bir...
false
8e1997b194cd3c70b844333b9a91b1a8ffee002b
fergatica/python
/triangle.py
578
4.21875
4
from math import sqrt def area(first, second, third): total = (first + second + third) / 2 final = sqrt(total*(total-first)*(total-second)*(total-third)) return final def main(): first = input("Enter the length of the first side: ") first = float(first) second = input("Enter the length of th...
true
9514caf7bef250e2917c6444326ed88f4d03886d
alexfreed23/OleksiiHorbachevskyi-PythonCore
/Python/PythonCore/HomeWork/HomeWork_8_20200703/Task3.py
609
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 4 11:28:04 2020 @author: oleksiy """ def checkDate(day, month, year): dayInMonth = [31,28,31,30,31,30,30,31,31,30,31,30,31] if month < 1 or month > 12: return False elif day < 1 or day > 31: return False elif month > dayInMonth[mont...
false
a8ad09b9e8ba85067526a6eb731e58908559ca59
LukasSilvaSantos/python_solutions
/curso_em_video/atvidades de manipulação de textos/desafio22.py
562
4.21875
4
#Crie um programa que leia o nome completo de uma pessoa e mostre: #O nome com todas as letras maiúsculas. #O nome com todas as letras minúsculas. #Quantas letras ao todo (sem considerar os espaços.) #Quantas letras tem o primeiro nome. MeuNome = str(input(' digite seu nome!: ')).strip() print(f' Analisando seu...
false
63f3824ef398440e8cc1950da02441b0b677670f
LukasSilvaSantos/python_solutions
/faculdade/exercicio5.py
1,018
4.3125
4
print('CAlCULANDO... \n + = ADIÇÃO \n - = Subtração \n * = Multiplicação \n / = Divisão.') operação = input('qual operação deseja fazer?: ').lower() while (operação != 'sair'): numero1 = float(input('digite um valor: ')) numero2 = float(input('digite um valor: ')) if (operação == '+'): soma = numero...
false
b024afabdd981863e78cf8be0aaeaf2a5736725b
drozol/python01
/workhome/Day_03_01.py
945
4.15625
4
# 1. Napisz program do przeliczania stopni Celsjusza na Fahrenheita i odwrotnie (wyświetlając wzór i kolejne obliczenia) rodzaj = input ("Jakie stopnie będziesz podqwał do przeliczenia Fahrenheit / Celsjusz wpisz F lub C - ") temperatura = float(input ("Podaj liczbę stopni: ")) if rodzaj == 'F' or rodzaj =='f':...
false
4683537ce9b8565c779407bca07abe00992279a9
franciscomelov/Apuntes
/reto_dataAcademy/21_listas.py
631
4.125
4
# Nos permite guardar varios valores en una sola variable numero = 3 otro_numero = 4 numeros = [1, 2, 3, 4, 5, 5, 6, 1] print(numeros) # [1, 2, 3, 4, 5, 5, 6, 1] objetos = ["hola", 2, True, "a", 2.5] # Accediendo a los elementos lista = ["a", "b", "c"] lista[0] # a lista[1] # b lista[3] # IndexError # AÑADIEND...
false
e63094b8a8351924742363fd1e2517272fd2a7e2
hjungj21o/Interview-DS-A
/lc_bloomberg.py/114_flatten_binary_tree_to_linked_list.py
1,223
4.40625
4
# Given a binary tree, flatten it to a linked list in -place. # For example, given the following tree: # 1 # / \ # 2 5 # / \ \ # 3 4 6 # The flattened tree should look like: # 1 # \ # 2 # \ # 3 # \ # 4 # \ # 5 # \ # 6 # Definition for a binar...
true
e34f79a5dbe72d7e8fff2f46b5f89f9de50f673a
hjungj21o/Interview-DS-A
/lc_88_merge_sorted_arr.py
959
4.21875
4
# Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. # Note: # The number of elements initialized in nums1 and nums2 are m and n respectively. # You may assume that nums1 has enough space(size that is equal to m + n) to hold additional elements from nums2. # Example: # Input...
true
d647fc1babadb96e9d4268d9cd97255efa479bc1
hjungj21o/Interview-DS-A
/lc_bloomberg.py/21_merge_sorted_list.py
913
4.15625
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy = ListNode(0) curr = dummy while l1 and l2: ...
true
a8242252ac207c8121d7f75859a97bcd9b873875
orsnes-privatskole/python-oppgaver
/calculator-deluxe.py
2,869
4.125
4
import time # Calculator - Deluxe Edition # Name and version info version_info = "MyCalculator - Deluxe Edition v0.3" # Function for getting menu choice def get_menu_choice(): # Variable used to align the menu to a common width menu_width = 30 # List of available menu options valid_menu...
true
deab4c799195b9bd5b92f3052f10a7ec2c1f1826
MarcosRS/python_practice
/01_strings.py
1,548
4.21875
4
#escaping characters \' , \" , \t, \n, \\ alison = 'That is Alison\'s cat' print(alison) #you can also use raw string and everythig will be interpreted as a string rawStr = r'nice \' \n \" dfsfsf ' print(rawStr) # multiline strings. this iincludes new lines as tab directly. Useful when you have a large string mul = ...
true
c899ae39957dc75221110be441670016040002d4
Rachelami/Pyton_day-1
/ex 03.py
291
4.125
4
num = 3 def is_even(number): if isinstance(number, int) == True: if number == num: print("True") return True else: print("False") return False else: print ("This is NOT an integer") exit() is_even(5)
true
376c45f4b21df79d6505234d5d14f4e1e61411c7
Akansha0211/PythonPrograms
/Assignment4.6.py
1,295
4.40625
4
# 4.6 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. # Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above 40 hours. # Put the logic to do the computation of pay in a function called computepay() and use th...
true
258d58764350aab386c1fd047b0d72ef47906114
WangsirCode/leetcode
/Python/valid-parenthesis-string.py
1,892
4.375
4
# Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the validity of a string by these rules: # Any left parenthesis '(' must have a corresponding right parenthesis ')'. # Any right parenthesis ')' must have a corresponding left...
true
327adc7432d621c66865248250a20d233671e2b9
MuhammadAzizShobari/praxis-academy
/novice/02-01/latihan/kekekalan.py
552
4.1875
4
mutable_collection = ['Tim', 10, [4, 5]] immutable_collection = ('Tim', 10, [4, 5]) # Reading from data types are essentially the same: print(mutable_collection[2]) # [4, 5] print(immutable_collection[2]) # [4, 5] # Let's change the 2nd value from 10 to 15 mutable_collection[1] = 15 # This fails with the tuple i...
true
3c40edcb6143bd3a72febcac7c4e0f891e571e51
roopi7760/WebServer
/Client.py
2,797
4.125
4
''' Author: Roopesh Kumar Krishna Kumar UTA ID: 1001231753 This is the Client program which sends the request to the server and displays the response *This code is compilable only with python 3.x Naming convention: camel case Ref: https://docs.python.org/3/library/socket.html and https://docs.python.org/3/tutorial/i...
true
87a51c978d8891d80b1f1eafadbd0e7654e04237
viseth89/nbapython
/trial.py
1,042
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 26 19:06:19 2016 @author: visethsen """ import matplotlib.pyplot as plt # Importing matplotlib general way that it is used x1 = [1,2,3] y1 = [4,7,5] x2 = [1,2,3] y2 = [10,14,12] plt.plot(x1, y1, label = "first line") plt.plot(x2, y2, label = 'se...
true
bc330656519ec96a211e305cc5abd9099952d649
LordEldak/Vampy-2017-CS
/CanChickinsFly.py
1,586
4.1875
4
answer = input ("Am I an object or a place? YES/NO:") if answer == "YES": answer = input("Am i bigger than a PC? YES/NO:") if answer == "YES": answer = input("Am I a building? YES/NO:") if answer == "YES": answer = input("Am I a Salon? YES/NO:") if answer == "YES": print("I am a salon") else:...
false
4b93a00e1ca8e27e19d5c723af42b9b2604d61f4
NUbivek/PythonBootcamp
/Module6/ex1.py
1,175
4.28125
4
# Exercise 1. # Write your Binary Search function. # Start at the middle of your dataset. If the number you are searching for is lower, #stop searching the greater half of the dataset. Find the middle of the lower half #and repeat. # Similarly if it is greater, stop searching the smaller half and repeat # the proce...
true
09fdf09fb3393d7081c02d4fb9fbf3efb81e14b0
NUbivek/PythonBootcamp
/Module1/ex6.py
748
4.28125
4
##Exercise 6: Write Python program to construct the following pattern, using a nested for loop. def triangle(): temp_var = "" for num in range(5): temp_var += "*" print(temp_var) for num in range(5,0,-1): temp_var = "*" print(num * "*") ...
true
075507eb146a94e556b9fe135191c904a4e479ed
4320-Team-2/endDateValidator
/endDateValidator.py
1,352
4.34375
4
import datetime class dateValidator: #passing in the start date provided by user def __init__(self, startDate): self.startDate = startDate def endDate(self): #loop until user provides valid input while True: #try block to catch value errors try: ...
true
c72f07976c3d40c88fbef5a39d3bdab8f0a5f202
divyashree-dal/PythonExercises
/Exercise22.py
673
4.625
5
'''Question 54 Define a class named Shape and its subclass Square. The Square class has an init function which takes a length as argument. Both classes have a area function which can print the area of the shape where Shape's area is 0 by default. Hints: To override a method in super class, we can define a method with ...
true
8fd1d34b6a98d4f171c8b7bd138f892a3861800e
deepakmethalayil/PythonCrash
/list_study.py
785
4.125
4
members = ['uthay', 'prsanna', 'karthick'] members_master = members print(members) # print the entire list print(members[0]) # print list items one by one print(members[1]) print(members[2]) msg = "Hello!" print(f"{msg},{members[0].title()}") print(f"{msg},{members[1].title()}") print(f"{msg},{members[2].title()}") #...
true
0c885c721e116d2ed482bf53bae8590df0db711e
gauvansantiago/Practicals
/Prac_02/exceptions_demo.py
1,020
4.46875
4
# Gauvan Santiago Prac_02 Task_04 exceptions_demo try: # asks to input numerator and denominator numerator = int(input("Enter the numerator: ")) denominator = int(input("Enter the denominator: ")) # while loop will prevent ZeroDivisionError and ask for a valid denominator while denominator == 0: ...
true
a26da98cd7f927a76810f2b9f97a60e896cbd5ee
Anjalibhardwaj1/GuessingGame
/GuessingGame.py
2,370
4.28125
4
#December 30 2020 #Guessing Game #This program will pick a random number from 1 to 100, and #it will ask the user to guess the number. from random import randint #Welcome Message and Rules print("\n---------------------- Guessing Game ------------------------------") print("Welcome!") print("In this game I wi...
true
ed294c0d77434c644a4805c6f7a04b1789e1019d
nbrown273/du-python-fundamentals
/modules/module11_list_comprehensions/exercise11.py
1,384
4.34375
4
# List Comprehension Example def getListPowN(x, n): """ Parmaeters: x -> int: x > 0 n -> int: n >= 0 Generate a list of integers, 1 to x, raised to a power n Returns: list(int) """ return [i**n for i in range(1, x) if i % 2 == 0] # Dictionary Comprehension Example def getDictC...
true
2cad47a5a9905de6a6dfc562e71db4f8a6e66ac9
manmodesanket/hackerrank
/problem_solving/string.py
683
4.34375
4
# You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa. # # For Example: # # Www.HackerRank.com → wWW.hACKERrANK.COM # Pythonist 2 → pYTHONIST 2 # Input Format # # A single line containing a string . # # Constraints #0<=len(s)<=1000 # #...
true
4d97da83215734d677dd6b7bc15c527b9e6ee262
srs0447/Basics
/8-calculator.py
817
4.15625
4
# Basic calculator that do the basic calculations like addition, subtraction, multification etc # declaring the global variables print("This is the basic calculator") print("\n********************************************\n") print("$$$$$$^^^^^^********^^^^^^^$$$$$$$$$$") number1 = float(input('Please Enter the first nu...
true
b7341f228d1fc848f24326a63a4659ed93ff2078
DaniilAnichin/for_TA
/merge.py
863
4.125
4
#!usr/bin/python # -*- coding: utf-8 -*-# from math import log def merge_sort(num_list): half_len = len(num_list) / 2 if len(num_list) > 2: return merge(merge_sort(num_list[:half_len]), merge_sort(num_list[half_len:])) elif len(num_list) == 2: return merge(num_list[:1]...
false
e3ca668d88674d2934ac7994f959d526b392cc59
dimasiklrnd/python
/highlighting numbers, if, for, while/The number of even elements.py
610
4.28125
4
'''Посчитать количество четных элементов в массиве целых чисел, заканчивающихся нулём. Сам ноль учитывать не надо. Формат входных данных Массив чисел, заканчивающийся нулём (каждое число с новой строки, ноль не входит в массив) Формат выходных данных Одно число — результат.''' n = int(input()) x = 0 while n != 0: ...
false
d0ad5dd7e1e3fcb6555e8573b7802d23dc345e9f
si7eka/XiaoXiang-python
/案例7--模拟之掷骰子/模拟掷骰子1.0.py
2,571
4.15625
4
""" 案例描述: 通过计算机程序模拟投掷骰子,并显示各种点数的出现次数及频率 比如,投掷2个骰子50次,出现点数为7的次数是8,频率是0.16 案例分析: 如何通过Python模拟随机事件?或者生成随机数? random模块 遍历列表时,如何同时获取每个元素的索引号及其元素值? enumerate() 函数 知识点: random模块 用于生成随机数 常用函数 函数 含义 random() 生成一个[0, 1.0)之间的随机...
false
bbbac97db52c79674684601e12be34092c6d3f8f
si7eka/XiaoXiang-python
/案例2--分形树的绘画/五角星2.py
1,369
4.3125
4
""" 作者:李征 功能:五角星绘图 版本:2.0 新增:循环操作 turtle库说明: 形状绘制函数 turtle.forward(distance) 画笔向前移动distance距离 turtle.backward(distance) 笔画向后移动distance距离 turtle.right(degree) 绘制方向向右旋转degree度 turtle.exitonclick() 点击关闭图形窗口 (左) ...
false
ffb5acfef7395967bfc3a8d62fb981768ef6bae4
anish-lakkapragada/libmaths
/libmaths/trig.py
2,884
4.28125
4
#Developer : Vinay Venkatesh #Date : 2/20/2021 import matplotlib.pyplot as plt import numpy as np def trigsin(z, b): ''' In mathematics, the trigonometric functions are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. Learn More: https://www.mathsisfun.com/sine...
true
9d59edf273a76e409ca5ba7a6898c50d130d43c7
khanmaster/python_modules
/exception_handling.py
1,246
4.1875
4
# We will have a look at the practical use cases and implementation of try, except, raise and finally we will create a variable to store a file data using open() Iteration 1 try: # let's use try block for a 1 line of code where we know this will throw an error file = open("orders.text") except: print(" Panic A...
true
a89ea893b8f11bf22fc437b1b43ef3cc1e7a19a2
themoat/Codeforces-problems
/Advanced_Recursion.py
902
4.125
4
a=[[1,1,0],[1,2,1],[1,0,2]] def floodfill(a,r,c,tofill,prevfill): # yahaan pe, r and c denote the row and column we are at, or in paint we will click at. #Let's mention out how many rows and columns are there rows = len(a) col = len(a[0]) #Since we are applyng recursion over here, so let's start with ...
false
60e0fa3af1eca5fbd52590f7622545097db1a8be
jxhangithub/lintcode
/Tree/480.Binary Tree Paths/Solution.py
1,853
4.15625
4
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root of the binary tree @return: all root-to-leaf paths """ def binaryTreePaths(self, root): # write your code ...
true
b6c43d8e05c2c06879abe86a53a1d919a75b5fa9
KellyOllos/STRUCTURES
/STRUCTURE.py
416
4.1875
4
#BRIANNE KELLY R. OLLOS #STRUCTURES letters = ['s','l','l','o','s','s','o','l', 's','o','o','l','o','l','s','s', 'o','s','s','o','l','l','l', 's','l','s','l','l','o','o','s', 'l','l','s','o','s','s','o'] from collections import Counter letter...
false
1708d66404362fb9a0e18008e6e500453235a49e
chandnipatel881/201
/chap3.py
407
4.25
4
print "This program illustrates average of numbers" # total_num = input ("How many numbers you want to average : ") # sum = 0.0 # # for i in xrange(total_num): # sum = sum + input("Enter: " ) # average = sum/total_num # print average avg = 0.0 count = 0 while True: total = avg * count num = input("Enter ...
true
d4b2cdb089e531181f30b6130d915878bd5744ef
Aiswarya333/Python_programs
/const5.py
1,595
4.1875
4
'''CELL PHONE BILL - A particular cell phone plan includes 50 minutes of air time and 50 text messages for $15.00 a month. Each additional minute of air time costs $0.25, while additional text messages cost $0.15 each. All cell phone bills include an additional charge of $0.44 to support 911 call centers, and the enti...
true
38f3243733f0a36e5c2ca109f986f9fdc94cd9f0
ed4m4s/learn_python_the_hard_way
/Exercise18.py
569
4.1875
4
#!/usr/bin/python # Exercise on Names, Variables, Code, Functions # this one is like the scripts we did with argv def print_two(*args): arg1, arg2 = args print "arg1: %r, arg2: %r" % (arg1, arg2) # Take out the *args as you do not need it def print_two_again(arg1, arg2): print "arg1: %r, arg2: %r" % (arg...
true
81190be06991bf9d7d942ccc7962d7a0b1881c61
deepak7514/Venturesity-Need_For_Hack
/need25.py
1,225
4.1875
4
import datetime while True: date=raw_input("Enter date in format dd-mm-yyyy: ") if not date: print 'Please provide input' continue date=date.strip().split('-') if len(date)!=3: print 'Day, Month and Year should be separated by \'-\'.' continue d,m,y=date if y.isdi...
false
1f024b3de44ee95d07ab6b44a2c3fcf22079ba09
pioziela/programming-learning
/Hacker_Rank_Exceptions.py
965
4.25
4
import sys def divide_exceptions(): """ divide_exceptions function trying to divide two values. The user provides data in the following format: - in the first line the number of divisions to be carried out, - in the following lines, the user provides two values to divide, the values should be sepa...
true
a1b191446e960f38e7e6621275d85ac7629d0368
geetha10/GeeksForGeeks
/basic/factorial.py
317
4.25
4
def factorial(num): result = 1 for x in range(1, num+1): result = result*x return result num = input("Enter a number for finding factorial") if num.isdigit(): num = int(num) fact = factorial(num) print(f"Factorial of {num} is {fact}") else: print("Please enter a valid Integer")
true
cc8d3b1b5d12299494d897fc24e6173b0a407aca
ricamos/study_code
/Programming _Foundations_with_Python/aula3_Use_classes_Draw_Turtles/a3c5_mindstorms_v2.py
1,009
4.625
5
""" Versão otimizada: Uso de funções em codigos repetido. Estudo do uso de classes. No caso a classe turtle. Usamos varias instancias da classe turtle. instancia como brad e angie. Podemos pensar em uma classe como uma planta de um edificio. E em seus objetos (Edificios criado a partir da planta) como exemplos ou ins...
false
721b2651ffb8c02d09a2130810f3baf3294c48ec
jayantpranjal0/ITW1-Lab
/python-assignments/3/4.py
219
4.375
4
''' Python program to read last n lines of a file. ''' with open("test.txt", "r") as f: n = int(input("Enter number of lines from last to read: ")) for i in f.readlines()[-n:]: print(i, end = "")
true
4bc1c71828f44dda49523303fa15adc3ba9ed9d3
jayantpranjal0/ITW1-Lab
/python-assignments/1/14.py
213
4.21875
4
''' Python program to get the number of occurrences of a specified element in an array. ''' l = input("Enter the array: ").split() e = input("Enter the element: ") print("No of occurence: "+str(l.count(e)))
true
eecf3b4c3635d6de005320cc22de378334d64723
jayantpranjal0/ITW1-Lab
/python-assignments/2/15.py
342
4.1875
4
''' Python program to sort a list of elements using the selection sort algorithm ''' a = list(map(int, input("Enter the list: ").split())) n = len(a) for i in range(0,n-1): m = a[i] pos = i for j in range(i+1,n): if m > a[j]: m = a[j] pos = j a[i], a[pos] = ...
false
01fe18819e29ae6806c6392f384ce6cbc39c81b7
KarnolPL/python-unittest
/06_functions/04_tax/tax.py
511
4.25
4
def calc_tax(amount, tax_rate): """The function returns the amount of income tax""" if not isinstance(amount, (int, float)): raise TypeError('The amount value must be int or float type') if not amount >= 0: raise ValueError('The amount value must be positive.') if not isinstance(tax_ra...
true
5588dad39ce8b2d00d77f4497371df468016e4fe
Parzha/Assingment3
/assi3project6.py
583
4.125
4
flag=True number_list = [] while flag: user_input=int(input("Please enter the numbers you want? ")) number_list.append(user_input) user_input_2=input("If you wanna continue type yes or 1 if you want to stop type anything= ").lower() if user_input_2=="1" or user_input_2=="yes": flag=Tr...
true
e68ce6ed23b536195d51f4d71f3e91521f133c68
AaryanGoel/Homework-1
/main.py
1,684
4.25
4
# author: Aaryan Goel apg5720@psu.edu letter = input("Enter your course 1 letter grade: ") credit1 = float(input("Enter your course 1 credit: ")) GradeP = 0 if letter == "A": GradeP = 4.0 elif letter == "A-": GradeP = 3.67 elif letter == "B+": GradeP = 3.33 elif letter == "B": GradeP = 3.00 elif letter == "B-...
false
e42748ed030e92c694657695e48fdc29a3dafed8
ConnorHoughton97/selections
/Water_Temp.py
337
4.34375
4
#Connor Houghton #30/09/14 #telling the user whether ater is frozen, boiling or neither water_temp = int(input("please enter the temperature of the water: ")) if water_temp >= 100: print ("The water is boiling.") elif water_temp <= 0: print("The water is frozen.") else: print("The water is neit...
true
a9dd7f6698194127322ccb3430435f8bb70ce01f
WhiteLie1/PycharmProjects
/alex_python/day6/继承实例.py
1,774
4.25
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/8 19:58 # @Author : chenxin # @Site : # @File : 继承实例.py # @Software: PyCharm class SchoolMember(object): members = 0; #初始学校人数为0 def __init__(self,name,age): self.name = name self.age = age def tell(self): pass def...
false
ed1ad13442cde6d47dba6ea1ac955ad157929c16
shreethi29/Python-for-Everybody-Specialization
/assignment6.py
375
4.1875
4
largest = -1 smallest = None while True: num = input("Enter a number: ") if num == "done" : break try: n=float(num) except: print("Invalid input") if smallest is None: smallest=n elif n>largest: largest=n elif n<smallest: smallest=n print("Maxi...
false
fbf00374688203f1feacec0636e2f1d385439be0
zhanshi06/DataStructure
/Project_1/Problem_2.py
1,375
4.375
4
import os def find_files(suffix, path): """ Find all files beneath path with file name suffix. Note that a path may contain further subdirectories and those subdirectories may also contain further subdirectories. There are no limit to the depth of the subdirectories can be. Args: suffi...
true
8456392830bb561c6f4156b270e445f10b0e67c4
0xphk/python_tutorial1
/07_if_conditions_1.py
241
4.28125
4
age = int(input("age: ")) if age == 18: print("age is 18!") elif age < 21 > 18: print("age over 18 but not yet 21!") elif age == 21: print("age is 21!") elif age >= 21: print("age over 21!") else: print("age under 18!")
false
32e95aacf766b380faaa2b8dc64d13b7bb062f24
fffelix-jan/Python-Tips
/3a-map-those-ints.py
239
4.15625
4
print("Enter space-separated integers:") my_ints = list(map(int, input().split())) # collect the input, split it into a list of strings, and then turn all the strings into ints print("I turned it into a list of integers!") print(my_ints)
true
0ff46aa541476ec73d8dbe2de099a11048d0f560
SS1908/30_days_of_python
/Day 16/properties_of_match.py
342
4.21875
4
"""" .span() returns a tuple containing the start-, and end positions of the match. .string returns the string passed into the function. .group() returns the part of the string where there was a match. """ import re str = "The train in Spain" x = re.search("train",str) print(x.span()) print(x.str...
true
d62363750fa06239f769f4490b7c8dea0eeb06eb
SS1908/30_days_of_python
/Day 12/LIst_comprehension.py
466
4.34375
4
""" List Comprehension is defined as an elegant way to define, create a list in Python. It consists of brackets that contains an expression followed by for clause. SIGNATURE: [ expression 'for' item 'in' list 'if' condition] """ letters = [] for letter in 'Python': letters.ap...
true
c07614f370a9f5b625593569cf89f2e98f15e01a
SS1908/30_days_of_python
/Day 17/type_of_variable_in_class.py
940
4.34375
4
""" we have a two type of variable in class :- 1) instance variable 2)class variable instance variable is changes object to object. class variable is same for all the instance/object of the class. """ class car: #this is a class variable ...
true
9d6e28084ff70545db5ed473b6ca361806566481
SS1908/30_days_of_python
/Day 6/Comparisons_of_set.py
406
4.25
4
# <, >, <=, >= , == operators Days1 = {"Monday", "Tuesday", "Wednesday", "Thursday"} Days2 = {"Monday", "Tuesday"} Days3 = {"Monday", "Tuesday", "Friday"} # Days1 is the superset of Days2 hence it will print true. print(Days1 > Days2) # prints false since Days1 is not the subset of Days2 print(Days1 < Days...
true
6a1f01bccda41e9216fc389162eaa758f241ac7d
SS1908/30_days_of_python
/Week 1/Day 1/Logical_operator.py
761
4.5625
5
#Logical operators are use to combine conditional statements. # Operator Description # and Returns True if both statements are true # or Returns True if one of the statements is true # not Reverse the result, returns False if the result is true pr...
true
34133a627a028c0b89086bd79ab2928cdd85aa36
leoweller7139/111-Lab-1
/calc.py
1,299
4.15625
4
# Method on the top def seperator(): print(30 * '-') def menu(): print('\n') #\n is like pressing enter seperator() print(" Welcome to PyCalc") seperator() print('[1] - Add') print('[2] - Subtract') print('[3] - Multiply') print('[4] - Divide') print('[x] - Exit') ...
true
684a6f6049359c0f77b8d6e13e7780570a71f845
gabe01feng/trinket
/Python Quiz/dayAndWeekOfYear.py
959
4.1875
4
number = int(input("Pick a number from 1-365. ")) week = ((number + 4) // 7) + 1 day = (number + 3) % 7 ending = '' if day % 10 == 1 and day != 11: ending = 'st' elif day % 10 == 2 and day != 12: ending = 'nd' elif day % 10 == 3 and day != 13: ending = 'rd' else: ending = 'th' if week % 10 == 1 and we...
false
c3b4e2f580b13b04739c2b47b7dd47def850947e
gabe01feng/trinket
/Python Quiz/poolVolume.py
1,108
4.1875
4
import math name = input("What is your name? ") pool = input("What shape is your pool, " + name + "? (Use RP for rectangular prism, C for cube, or CY for a cylindrical pool) ") if pool == "RP": length = float(input("What is the length of the pool in feet? ")) width = float(input("What is the width of the pool...
true
29b59615adf2069988a4e84989840118886faf05
TushinIE/cource-work
/Курсовая работа по программированию/31 Задача (2 часть курсовой)/example_29.py
1,119
4.1875
4
#имя проекта: numpy-example #номер версии: 1.0 #имя файла: example_29.py #автор и его учебная группа: И.Тушин, ЭУ-142 #дата создания: 20.05.2019 # дата последней модификации: 20.05.2019 #связанные файлы: пакеты numpy, matplotlib # описание: Создать прямоугольную матрицу A, имеющую N строк и M столбцов со # случ...
false
726edd78dab141ca239759642d86a4312b7c92af
TushinIE/cource-work
/Курсовая работа по программированию/31 Задача (2 часть курсовой)/example_17.py
1,110
4.28125
4
#имя проекта: numpy-example #номер версии: 1.0 #имя файла: example_17.py #автор и его учебная группа: И.Тушин, ЭУ-142 #дата создания: 11.05.2019 # дата последней модификации: 11.05.2019 #связанные файлы: пакеты numpy, matplotlib # описание: Создать прямоугольную матрицу A, имеющую N строк и M столбцов со # случ...
false
d68f4b523b209f3a42cea58cafd8b153eeba6ba2
Mukosame/learn_python_the_hard_way
/ex25.py
1,380
4.4375
4
def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return words def sort_words(words): """Sorts the words.""" return sorted(words) def print_first_word(words): """Prints the first word after popping it off.""" word = words.pop(0) print word...
true