blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
7d7ac0d51758458af03015b2b016c7608d266232
fminor5/TonyGaddisCh13
/p13-7button_demo.py
849
4.28125
4
import tkinter import tkinter.messagebox class MyGUI: def __init__(self): self.main_window = tkinter.Tk() # Create a Button widget. The text 'Click Me!' should appear on the # face of the Button. The do_something method should be executed when # the user clicks the Button. ...
true
7cdf5ba9b7c9cf90abcc0f0592cff859ecde851a
thangln1003/python-practice
/python/trie/208-implementTrie_I.py
2,294
4.125
4
""" 208. Implement Trie (Prefix Tree) (Medium) https://leetcode.com/problems/implement-trie-prefix-tree/ Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // returns true trie.search("app"); // returns false trie.startsWi...
true
a670acd7b46c33e6c19dbd4130be7b20860bc89e
thangln1003/python-practice
/python/1-string/438-findAllAnagrams.py
2,175
4.125
4
""" 438. Find All Anagrams in a String (Medium) https://leetcode.com/problems/find-all-anagrams-in-a-string/ Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,1...
true
3c5bc82862d3f05da5ce7d0807de1e5d0e735e7d
rasmiranjanrath/PythonBasics
/Set.py
521
4.25
4
#A set is a collection which is unordered and unindexed. In Python sets are written with curly brackets. set_of_link={'google.com','facebook.com','yahoo.com','jio.com'} #loop through set def loop_through_set(): for links in set_of_link: print(links) loop_through_set() #check if item exists or not if 'google.com' ...
true
5b7543e3b0fc8cf24b22afb680da2e4f28a1b9ac
LeenaKH123/python3
/02_classes-objects-methods/02_04_classy_shapes.py
1,078
4.4375
4
# Create two classes that model a rectangle and a circle. # The rectangle class should be constructed by length and width # while the circle class should be constructed by radius. # # Write methods in the appropriate class so that you can calculate # the area of both the rectangle and the circle, the perimeter # of the...
true
f7fe24777d99688ce0f67c7f16ee4788d4c694d4
LeenaKH123/python3
/02_classes-objects-methods/02_06_freeform.py
695
4.125
4
# Write a script with three classes that model everyday objects. # - Each class should have an `__init__()` method that sets at least 3 attributes # - Include a `__str__()` method in each class that prints out the attributes # in a nicely formatted string. # - Overload the `__add__()` method in one of the classes s...
true
0c9ff7275e96c309b823844d42ac93dcc4dd2082
halida/handout_6.00
/ps3a.py
704
4.125
4
#!/usr/bin/env python #-*- coding:utf-8 -*- """ module: ps3a """ from string import * def countSubStringMatch(target, key): i = 0 k = 0 while i != -1: i = find(target, key, i) if i < 0: break i += len(key) k += 1 return k def countSubStringMatchRecursive(target, key): ...
false
d9dcd1205b58e9f5502d6b2fb183b95ff6e24deb
arkoghoshdastidar/python-3.10
/14_for_loop.py
524
4.5
4
# for loop can be used to traverse through indexed as well as un-indexed collections. fruits = ["apple", "mango", "banana", "cherry"] for x in fruits: if x == "cherry": continue print(x) else: print("fruits list completely traverse!!") # range function range(starting_index, last_index, step) for...
true
f4fc56008cdb9d12034813951f4ae6673bb32b5d
arkoghoshdastidar/python-3.10
/19_iterator.py
899
4.15625
4
# All python collections have their own inbuilt iterators list1 = list(("apple", "banana", "cherry", "guava")) list_iter = list1.__iter__() print(next(list_iter)) print(next(list_iter)) print(next(list_iter)) print(next(list_iter)) tuple1 = tuple(("apple", "mango", "pineapple")) tuple_iter = tuple1.__iter__() prin...
false
4ded74124b0a8a72d4f3ef553470bc01609be6b9
shireeny1/Python
/python_basics_104_lists.py
2,208
4.4375
4
# Lists in Python # Lists are ordered by index ## AKA --> Arrays or (confusingly) as objects in JavaScript # Syntax # Declare lists using [] # Separate objects using , # var_list_name = [0 , 1, 2, 3,..] --> index numbers crazy_x_landlords = ['Sr. Julio', 'Jane', 'Alfred', 'Marksons'] print(crazy_x_landlords) prin...
true
5e7dbf191a2b1396cb23f1bdc870d8b1dbcbff7e
nirzaf/python_excersize_files
/section9/lecture_043.py
289
4.125
4
### Tony Staunton ### Working with empty lists # Empty shopping cart shopping_cart = ['pens'] if shopping_cart: for item in shopping_cart: print("Adding " + item + " to your cart.") print("Your order is complete.") else: print("You must select an item before proceeding.")
true
edb115e5a043e70668684de5ac215346c59df01b
nirzaf/python_excersize_files
/section9/9. Branching and Conditions/8.1 lecture_040.py.py
324
4.21875
4
### 28 / 10 / 2016 ### Tony Staunton ### Checking if a value is not in a list # Admin users admin_users = ['tony', 'frank'] # Ask for username username = input("Please enter your username?") # Check if user is an admin user if username not in admin_users: print("You do not have access.") else: print("Access ...
true
d4d7ddf9bac3658959f888dda9c75d49491fdfad
AnetaEva/NetPay
/NetPay.py
837
4.25
4
employee_name = input('Name of employee: ') weekly_work_hours = float(input('How many hours did you work this week?: ')) pay_rate = float(input('What is your hourly rate?: $')) #Net Pay without seeing the breakdown from gross pay and tax using the pay rate * work hours * (1 - 0.05) net_pay = pay_rate * weekly_work_h...
true
43b8107a49178ce617fa90e55b0b3d612be117bb
cornielleandres/Intro-Python
/src/day-1-toy/fileio.py
403
4.1875
4
# Use open to open file "foo.txt" for reading foo = open('foo.txt') # Print all the lines in the file for line in foo: print(line) # Close the file foo.close() # Use open to open file "bar.txt" for writing bar = open('bar.txt', 'w') # Use the write() method to write three lines to the file lines = ['first line\n', ...
true
dc6c18763a5cdbb0e8ec0ddee339010e5ede0d7d
shuxianghuafu/IntroductionToAlgorithms
/chapter02/MERGE-SORT/mergeSort.py
1,443
4.1875
4
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ """ author : xiaohai email : xiaohaijin@outlook.com """ def merge(left, right): """ 归并排序的辅助函数 """ array = [] left_cursor, right_cursor = 0, 0 """ 开始收集两个子‘数组’中的元素 """ while left_cursor < len(left) and right_cursor < len(right): ...
false
08138bc7d63a9cc15ec13c8cf33e60cce825d6da
VinidiktovEvgenijj/PY111-april
/Tasks/a0_my_stack.py
980
4.3125
4
""" My little Stack """ my_stack = [] def push(elem) -> None: """ Operation that add element to stack :param elem: element to be pushed :return: Nothing """ global my_stack my_stack.append(elem) return None def pop(): """ Pop element from the top of the s...
true
40b0eab57ae17cdb77045d0156e53e0ba073abd2
Viiic98/holbertonschool-higher_level_programming
/0x0A-python-inheritance/4-inherits_from.py
352
4.15625
4
#!/usr/bin/python3 def inherits_from(obj, a_class): """ inherits_from Check if obj is a sub class of a_class Return: True if it is a subclass False if it is not a subclass """ if type(obj) is not a_class and issubclass(type(obj), a_class): return True...
true
6e4f90c3dd486241de794f0d071a0601fcc1ea44
ysjwdaypm/study
/python/pyfiles/deco.py
510
4.4375
4
""" 问题: Python的函数定义中有两种特殊的情况,即出现*,**的形式。 如:def myfun1(username, *keys)或def myfun2(username, **keys)等。 解释: * 用来传递任意个无名字参数,这些参数会一个Tuple的形式访问。 **用来处理传递任意个有名字的参数,这些参数用dict来访问。* """ def deco(fun): def inner(*args,**kwargs): return fun(*args,**kwargs) return inner @deco def my_func(*args): print(arg...
false
d15a5aa268e7d312cef56fdd19be4efe2a0b9fdc
dscottboggs/practice
/HackerRank/diagonalDifference/difference.py
1,391
4.5
4
from typing import List """The absolute value of the difference between the diagonals of a 2D array. input should be: Width/Height of the array on the first input line any subsequent line should contain the space-separated values. """ def right_diagonal_sum(arrays: List[List[int]]) -> int: """Sum the right diago...
true
b4729ac8cb9c4d7ba23b8fb98149a734ef517a93
yawitzd/dsp
/python/q8_parsing.py
1,343
4.375
4
#The football.csv file contains the results from the English Premier League. # The columns labeled ‘Goals’ and ‘Goals Allowed’ contain the total number of # goals scored for and against each team in that season (so Arsenal scored 79 goals # against opponents, and had 36 goals scored against them). Write a program to...
true
b12125bfd87a14b9fba134333f933e0adf308bb6
talhahome/codewars
/Oldi2/Write_Number_in_Expanded_Form.py
612
4.3125
4
# You will be given a number and you will need to return it as a string in Expanded Form. For example: # # expanded_form(12) # Should return '10 + 2' # expanded_form(42) # Should return '40 + 2' # expanded_form(70304) # Should return '70000 + 300 + 4' # NOTE: All numbers will be whole numbers greater than 0. def expan...
true
ea28dc883c613ace6f42e05c4bcd733df3482635
talhahome/codewars
/Number of trailing zeros of N!.py
580
4.3125
4
# Write a program that will calculate the number of trailing zeros in a factorial of a given number. # N! = 1 * 2 * 3 * ... * N # # Examples # zeros(6) = 1 # 6! = 1 * 2 * 3 * 4 * 5 * 6 = 720 --> 1 trailing zero # # zeros(12) = 2 # # 12! = 479001600 --> 2 trailing zeros # Hint: You're not meant to calculate the factoria...
true
3e27494fa5776ac2a3f8190bd688e6aacb5539c3
imayush15/python-practice-projects
/Learn/ListEnd.py
260
4.15625
4
print("Program to Print First and last Element of a list in a Seperate List :=\n") list1=['i',] x = int(input("Enter the Range of list : ")) for i in range(x): y = int(input("Enter the Value : ")) list1.append(y) print(list1[1], list1[-1])
true
3c28effd55d6948bfcd606a1e3466a2cbbc25218
imayush15/python-practice-projects
/Learn/Pythagorean_Triplet.py
311
4.1875
4
print("This is the program for thr Pythagoran triplet : ") h = int(input("Enter the Height : ")) b = int(input("Enter the Base : ")) p = int(input("Enter the Hypotaneus : ")) if (p*p)==(h*h)+(b*b): print("This is a Pythagorean Triplet :)") else: print("Sorry ! This is not a Pythagorean Triplet :(")
false
b1189fb8bb27a5ea03cfb834c376c30eae5c152d
Dyn0402/QGP_Scripts
/poisson_vs_binomial.py
523
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on May 14 10:47 AM 2020 Created in PyCharm Created as QGP_Scripts/poisson_vs_binomial @author: Dylan Neff, Dylan """ import numpy as np import matplotlib.pyplot as plt from scipy.stats import binom, poisson def main(): n = 60 p = 0.5 x = np.aran...
false
78d0f11ae198c5115cee65f7646a1cc00472b497
piotrbelda/PythonAlgorithms
/SpiralTraverse.py
1,280
4.1875
4
# Write a function that takes in an n x m two-dimensional array # (that can be square-shaped when n==m) and returns a one-dimensional array of all the array's # elements in spiral order; Spiral order starts at the top left corner of the two-dimensional array, goes # to the right, and proceeds in a spiral pattern all th...
true
209019237804db02fcb51e4001df53aaff1e45b0
kleutzinger/dotfiles
/scripts/magic.py
2,524
4.25
4
#!/usr/bin/env python3 """invoke magic spells from magic words inside a file magic words are defined thusly: (must be all caps) #__MAGICWORD__# echo 'followed by a shell command' put something of that format inside a file to set up running that command additionally, #__file__# will be substituted with the path of t...
true
6369192c8d069bc4fd9f3b49e1e0cc94b1cc124a
nihaal-gill/Example-Coding-Projects
/Egyption Fractions/EgyptianFractions.py
1,000
4.28125
4
#Language: Python #Description: This program is a function that uses the greedy strategy to determine a set of distinct (i.e. all different) Egyptian #fractions that sum to numerator/denominator. The assumptions in this program are that the numerator and denominator are positive integers #as well as the numerator is...
true
57060973638e77b4247be650fc3f065b3a06070c
BloodyInspirations/VSA2018
/proj01.py
2,321
4.375
4
# Name: # Date: # proj01: A Simple Program # Part I: # This program asks the user for his/her name and grade. #Then, it prints out a sentence that says the number of years until they graduate. # Part II: # This program asks the user for his/her name and birth month. # Then, it prints a sentence that says the number ...
true
65fb4afd1c43749106c02ed065d530e8bf3782b3
KeerthanaPravallika/DSA
/Patterns/Xpattern.py
558
4.28125
4
''' Write a program to take String if the length of String is odd print X pattern otherwise print INVALID. Input Format: Take a String as input from stdin. Output Format: print the desired Pattern or INVALID. Example Input: edyst Output: e t d s y d s e t ''' word = input() if len(word) % 2 == 0: ...
true
3a5e1b7ade252d9acc549f3d1177580ff9d9fd89
akuelker/intermediate_python_class
/Exercise 7/Exercise7_3.py
279
4.3125
4
import datetime year = int(input("Enter your Church Year: " )) today = datetime.date(year,1,1) # January 1st today += datetime.timedelta(days = 6 - today.weekday()) # First Sunday while today.year == year: print(today) today+= datetime.timedelta(days = 7)
false
488adf142b4eea5c71f5f3381b80935a33e47ebb
kayodeomotoye/Code_Snippets
/import csv.py
848
4.1875
4
import csv from io import StringIO def split_words_and_quoted_text(text): """Split string text by space unless it is wrapped inside double quotes, returning a list of the elements. For example if text = 'Should give "3 elements only"' the resulting list would be: ...
true
a29a74255df46a2d0944a8389558cc294ed2eacb
kayodeomotoye/Code_Snippets
/running_mean.py
1,227
4.3125
4
from itertools import islice import statistics def running_mean(sequence): """Calculate the running mean of the sequence passed in, returns a sequence of same length with the averages. You can assume all items in sequence are numeric.""" avg_list=[] new_list = [] for num in sequence: ...
true
e12ec0d529f890f1f46ead8feb24ce5ba1bef83a
rinoSantoso/Python-thingy
/Sorting.py
1,256
4.21875
4
def sort(unsorted): sorted = [] sorted.append(unsorted[0]) i = 1 while i < len(unsorted): for j in range(len(sorted)): if unsorted[i] < sorted[j]: sorted.insert(j, unsorted[i]) break elif j == len(sorted) - 1: sort...
true
037ed9844747010a9a2d8da79c8ca973b6b278c2
DtjiAppDev/Python-Recursion-Tutorial
/recursive_fibonacci.py
406
4.28125
4
""" This file contains implementation of calculating the nth Fibonacci number using recursion Author: CreativeCloudAppDev2020 """ def fibonacci(n: int) -> int: if n < 0: return 0 elif n == 0 or n == 1: return n else: return fibonacci(n - 1) + fibonacci(n - 2) # Tes...
false
c0842c0917df268ba89c1d1fac5c46154ce24960
twhorley/twho
/matplotlib_tests.py
1,540
4.34375
4
""" Script to play around with how to make a variety of plots using matplotlib and numpy. I'll be using object-oriented interface instead of the pyplot interface to make plots because these are far more customizable. """ import matplotlib.pyplot as plt import numpy as np # Create a figure with 2 axes, both same scal...
true
a98813061b478d0d7be602d6ba503f33ed228863
LaKeshiaJohnson/python-fizz-buzz
/challenge.py
664
4.3125
4
number = int(raw_input("Please enter a number: ")) # values should be stored in booleans # If the number is divisible by 3, print "is a Fizz number" # If the number is divisible by 5, print "is a Buzz number" # If the number is divisible by both 3 and 5, print is a FizzBuzz number" # Otherwise, print "is neither a fiz...
true
a6b7095bdf942c083324dc7d49dc2835d651bdb9
RileyMathews/nss-python-exercises-classes
/employees.py
1,597
4.1875
4
class Company(object): """This represents a company in which people work""" def __init__(self, company_name, date_founded): self.company_name = company_name self.date_founded = date_founded self.employees = set() def get_company_name(self): """Returns the name of the compan...
true
eec5d6c8cb0b850addb2f043eb56b93787cb123f
peterjoking/Nuevo
/Ejercicios_de_internet/Ejercicio_22_Readfile.py
897
4.53125
5
""" Opening a file for reading is the same as opening for writing, just using a different flag: with open('file_to_read.txt', 'r') as open_file: all_text = open_file.read() Note how the 'r' flag stands for “read”. The code sample from above reads the entire open_file all at once into the all_text variable. Bu...
true
6cb4981ac678cc3bca8a2d9f19eb6972e08bad81
tomi8a/algoritmosyestructuradedatos
/CLASE 13/indexacion_numerica_1.py
960
4.1875
4
# Recordemos el manejo de índices y slicing # con strings var = 'Algoritmos y estructura de datos' print('La primera letra es: ' + var[0]) print('La última letra es: ' + var[-1]) print('Las primeras 3 letras son: ' + var[0:3]) print('Las primeras 3 letras son: ' + var[:3]) print('Las últimas 3 letras son: ' + va...
false
f3b36b0d425a27a84edce61bd93de52c69ec90fe
ceejtayco/python_starter
/longest_strings.py
455
4.125
4
#Given an array of strings, return another array containing all of its longest strings. def longest_string(inputList): newList = list() longest = len(inputList[0]) for x in range(len(inputList)-1): if longest < len(inputList[x+1]): longest = len(inputList[x+1]) for x in inputLi...
true
eab7db0160e4e7dfc0da0690f114d51b49cbd69a
Haris-HH/CP3-Haris-Heamanunt
/Exercise_5_2_Haris_Heamanunt.py
262
4.28125
4
distance = int(input("Distance (km) : ")) time = int(input("Time (h) : ")) if(distance < 1): print("Distance can not be less than 1 km") elif(time < 1): print("Time can not be less than 1 hour") else: result = distance / time print(result,"km/h")
true
383cd867c393b32c6655c8c5bfbbd8baba60ad6a
LeilaRzazade/python_projects
/guess_number.py
802
4.1875
4
#This is random number generator program. #You should guess the random generated number. import random random_num = random.randint(1,100) user_input = int(input("Guess the number: ")) if (user_input == random_num): print("Congratulations! Guessed number is: ", user_input) while(user_input != random_num): ...
true
4f8686f815a0f47d40b96cd5d9f6491d490a6159
jlast35/hello
/python/data_structures/queue.py
1,905
4.34375
4
#! /usr/bin/env python # Implementation of a Queue data structure # Adds a few non-essential convenience functions # Specifically, this is a node intended for a queue class Node: def __init__(self, value): self.value = value self.nextNode = None class Queue: def __init__(self): self.head = None self.tail =...
true
2bb03b26a4554f78c897815138c6bf675ddfe96e
YuliiaAntonova/leetcode
/reverse integer.py
786
4.125
4
# Given a signed 32-bit integer x, return x with its digits reversed. # If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. class Solution(object): def reverse(self,n): y = str(abs(n)) # Create a variable and convert the integer into a string ...
true
29a891c4b6e33cdc6dcbc0d8a17345d08990f332
zhaozongzhao/learngit
/arithmeticstudent/paint/pentagram_v4.0.py
1,877
4.21875
4
'''' 作者:赵宗召 功能:绘制五角星 版本:v3.0 时间:2017.11.19 功能:turtle库常用函数 V1.1 新增功能:使用循环画五角星 v1.2 将画五角星封装成函数 V2.0 设置画笔的颜色和宽度 V3.0 循环和函数的结合,递归 v4.0 树形图 ''' import turtle def tree_pentagram(distance): if distance > 5: # 绘制右侧树枝 if distance < 20: turtle.pencolor("green") ...
false
cc54a0283f674a4091d9d3a26f3b70459245119e
JaffarA/ptut
/python-4.py
1,626
4.4375
4
# introduction to python # 4 - io, loops & functions cont.. # functions can take multiple arguments, default arguments and even optional arguments (part of *args) def introduce(name='slim shady', age, hobby='fishing'): return print(f'Hi, my name is {name}. Hi, my age is {age}. Hi, i like this "{hobby}"') # this code...
true
07899e72ed5eb012e3734e2bd01b0afd3dc4e698
karenlopez-13/Curso-de-Python-main
/funcionEjecucion.py
1,038
4.1875
4
#Metodos especiales y cuando hay 1 o 2 guiones bajos son metodos privados nombre = "Karen Lopez" print("Primero") print(nombre[2:4:2]) #strip quita los espacios de una cadena de texto ejemplo: "blusa azul" pasa a "blusaazul" #no jalo el strip así que pusimos en su lugar "replace" #lower lo hace minuscula def valida_pa...
false
f9f86abfd5bab24edac6d6149fefd15b451f438e
anvarknian/preps
/Heaps/min_heap.py
2,621
4.1875
4
import sys # defining a class min_heap for the heap data structure class min_heap: def __init__(self, sizelimit): self.sizelimit = sizelimit self.cur_size = 0 self.Heap = [0] * (self.sizelimit + 1) self.Heap[0] = sys.maxsize * -1 self.root = 1 # helper function to swa...
true
643bb8a4c5100d1f22dbd60132317b66f6fb3b06
Vinaypatil-Ev/aniket
/1.BASIC PROGRAMS/4.fahrenheit_to_degree.py
286
4.40625
4
# WAP to convert Fahrenheit temp in degree Celsius def f_to_d(f): return (f - 32) * 5 / 9 f = float(input("Enter Fahrenheit temprature: ")) x = f_to_d(f) print(f"{f} fahreheit is {round(x, 3)} degree celcius") # round used above is to round the decimal values upto 3 digits
true
3211aaae0cdbca9324479483fb2206519ccf8ca2
TonyPwny/cs440Ass1
/board.py
1,614
4.1875
4
# Thomas Fiorilla # Module to generate a Board object import random #import random for random generation def valid(i, j, size): roll = random.randint(1, max({(size - 1) - i, 0 + i, (size - 1) - j, 0 + j})) return roll # function to generate the board and place the start/end points # returns the built board and...
true
bd30e544beabc8a27f9dc2397b1395c233d8c583
rotuloveio/CursoEmVideoPython
/Mundo3/Aula21/ex104.py
507
4.1875
4
# Crie um programa que tenha a função leiaint(), que vai funcionar de forma semelhante à função input() do Python, só # que fazendo a validação para aceitar apenas um valor numérico. def leiaint(msg): while True: num = str(input(msg)) if num.isnumeric(): return int(num) ...
false
68edf05eacc3113f09a101c78825ce260ba82ce9
rotuloveio/CursoEmVideoPython
/Mundo3/Aula21/ex101.py
601
4.15625
4
# Crie um programa que tenha uma função chamada voto() que vai receber como parâmetro o ano de nascimento de uma pessoa, # retornando um valor literal indicando se a pessoa tem voto NEGADO, OPCIONAL ou OBRIGATÓRIO nas eleições. from datetime import date def voto(ano): idade = date.today().year - ano re...
false
30b85504154a9a22042c416955ca643818f45e63
psarangi550/PratikAllPythonRepo
/Python_OOS_Concept/Monkey_Pathching_In_Python.py
2,149
4.4375
4
#changing the Attribute of a class dynamically at the runtime is called Monkey Patching #its a common nature for dynamically typed Language #lets suppose below example class Test:#class Test def __init__(self):#constructor pass#nothing to initialize def fetch_Data(self):#instance method #remeber...
true
1bbc38978d15042164c2a458952ea34ba30853db
yuliia11882/CBC.Python-Fundamentals-Assignment-1
/Yuliia-py-assignment1.py
1,380
4.21875
4
#Canadian Business College. # Python Fundamentals Assignment 1 #PART 1:------------------------------- #enter how many courses did he/she finish # the input value (which is string) is converted into number with int() num_of_courses = int(input("How many courses have you finished? ")) print(num...
true
6e3568a6057b0d88393120ad65238b14834d53ba
samiCode-irl/programiz-python-examples
/Native_Datatypes/count_vowels.py
273
4.125
4
# Python Program to Count the Number of Each Vowel vowels = 'aeiou' ip_str = 'Hello, have you tried our tutorial section yet?' sent = ip_str.casefold() count = {}.fromkeys('vowels', 0) for letter in sent: if letter in count: count[letter] += 1 print(count)
true
2bcc3c8c44bb0e4d435fd96c44e10293d88e4dcb
carv-silva/cursoemvideo-python
/Mundo03/exercsMundo03/exerc075.py
1,213
4.21875
4
'''Desenvolva um programa que leia quatros valores pelo teclado e guarde-os em uma tupla. No final mostre: A) quantos vezes aparece o valor 9. B) em que posição foi digitado o primeiro valor 3 C) quais foram os numeros pares.''' tupla = tuple(int(input('Digite um numero: '))for i in range(0, 4)) print(tupla) print(f...
false
90ae4b0ff81699ca43a31b2c89c41eb345db6ed3
carv-silva/cursoemvideo-python
/Mundo01/exercsMundo01/ex017.py
518
4.1875
4
'''Faca um programa que leia o comprimento do cateto aposto e do cateto adjacente de um triangulo retangulo, calcule e mostre o comprimento da hipotenusa''' from math import sqrt a = float(input('Entre com o cateto: ')) b = float(input('Entre com o cateto aposto: ')) h = sqrt(a**2+b**2) print(f'A hipotenusa é: {h:.2f...
false
a7c1d52f39a6b061c082067f05f451f3833f55bc
carv-silva/cursoemvideo-python
/Mundo01/exercsMundo01/ex018.py
787
4.34375
4
'''Faca um programa que leia um angulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse angulo ''' import math a = float(input('Digite um angulo: ')) r = math.radians(a) ## --> tranforma o angulo em radiando para poder fazer a conta print(f'O angulo de {a} tem o Seno de {(math.sin(r)):.2f}') ## o ...
false
2bd75ae280198f305db856b68e869fbf0bc1bfbe
carv-silva/cursoemvideo-python
/Mundo02/exercsMundo02/ex060.py
803
4.25
4
from math import factorial '''Faca um programa que leia um numero qualquer e o mostre o seu fatorial EX: 5! 5X4X3X2X1 = 120''' ''' n = int(input('Digite um numero inteiro qualquer: ')) fat = 1 i = 1 while i <= n: fat *= i i += 1 print(fat) resultado = 1 numero = int(input('Digite um numero inteiro qualquer:...
false
7b7ef605632efa89f4d1de71edeeb3e78c933199
carv-silva/cursoemvideo-python
/Mundo01/exercsMundo01/ex035.py
882
4.5
4
''' Desenvolva um programa que leia o comprimento de tres retas e diga ao usuario se elas podem ou nao formar um trinagulo ''' '''a = float(input('Insira o comprimento 1: ')) b = float(input('Insira o comprimento 2: ')) c = float(input('Insira o comprimento 3: ')) if a + b + c == 180: print('Tringulo formado') el...
false
f19151fce2c14be35efad14a418a87e724286aa0
bryanlie/Python
/HackerRank/lists.py
1,198
4.46875
4
''' Consider a list (list = []). You can perform the following commands: insert i e: Insert integer at position . print: Print the list. remove e: Delete the first occurrence of integer . append e: Insert integer at the end of the list. sort: Sort the list. pop: Pop the last element from the list. reverse: Reverse t...
true
89c8504779287cad8e9f3d65cebd28b62845bb88
FriggD/CursoPythonGGuanabara
/Mundo 2/Desafios/Desafio#37.py
584
4.15625
4
#Escreva um programa que leia um número inteiro qualquer e peça para o usuário escolher qual será a base de conversão num = int(input('Digite um número inteiro: ')) escolha = int(input(''' Para conversão Para BINÁRIO: 1 Para OCTAL: 2 Para HEXADECIMAL: 3 ''')) if escolha == 1: print('O numero {} em binário é: {}'....
false
66c0aeb6aed01f7e4887108de381d5e823d12fe1
FriggD/CursoPythonGGuanabara
/Mundo 1/Desafios/Desafio#22.py
562
4.21875
4
#Crie um programa que leia o nome completo de uma pessoa e mostre: #1. O nome com todas as letras maiúsculas; #2. O nome com todas as letras minúsculas; #3. Quantas letras tem sem contar os espaços; #4. Quantas letras tem o primeiro nome nome = input('Digite seu nome completo: ') print('1. Nome em maiúsculo: {}'.form...
false
36fa0d82a540296a84fcfedc10e2c229aeaf60b3
FriggD/CursoPythonGGuanabara
/Mundo 3/Desafios/Desafio#75.py
721
4.15625
4
# Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre: # A) Quantas vezes apareceu o valor 9. # B) Em que posição foi digitado o primeiro valor 3. # C) Quais foram os números pares. # Variáveis simples dentro de () formam as tuplas num = ( int(input('Digite um nú...
false
c270f4865da343415ea72349627c690b2bd5ad54
dipikakhullar/Data-Structures-Algorithms
/coding_fundamentals.py
772
4.125
4
def simpleGeneratorFun(): yield 1 yield 2 yield 3 # Driver code to check above generator function for value in simpleGeneratorFun(): print(value) import queue # From class queue, Queue is # created as an object Now L # is Queue of a maximum # capacity of 20 L = queue.Queue(maxsize=20) ...
true
d39fc9f7c2504fd3122a243ecc48a9e74c76a1fb
matioli254/practice.py
/differentlists.py
1,316
4.3125
4
#list challenge 7 Different Types of Lists Program print("\n\t\t\tSummary Table") #Define list num_strings = ["15", "100", "55", "42"] num_ints = [15, 100, 55, 42] num_floats = [4.5, 10.5, 16.3, 34.3] num_lists = [[1,2,3],[4,5,6],[7,8,9]] # A summary of each variable (or list) print("\nThe variable num_strings is a ...
false
28a982b392e5a1c3e5ecc287f78d63b506349c2a
Aparna768213/Best-Enlist-task-day3
/day7task.py
794
4.34375
4
def math(num1,num2): print("Addition of two numbers",num1+num2) print("Subtraction of two numbers",num1-num2) print("Multiplication of two numbers",num1*num2) print("Division of two numbers",num1/num2) num1 = float(input("Enter 1st number:")) num2 = float(input("Enter 2nd num:")) math(num1,num2) ...
true
c28bc62bc1b7a68b6a73b36cceada5cf8f07cd0c
rishikumar69/all
/average.py
239
4.21875
4
num = int(input("Enter How Many Number you want:")) total_sum = 0 for i in range(num): input = (input("Enter The Number:")) total_sum += input ans = total_sum/num line = f"Total Average of {total_sum}is{ans}" print(line)
true
6a56ceb00fb302373d36dd1854e6775cba83b7c5
Gaurav716Code/Python-Programs
/Tuples/creating tuples.py
952
4.5
4
def createTuple(): # Different types of tuples # Empty tuple my_tuple = () print("Empty : ",my_tuple) # Tuple having integers my_tuple1 = (1, 2, 3) print("Integer : ",my_tuple1) # tuple with mixed datatypes my_tuple2 = (1, "Hello", 3.4) print("Mixed : ",my_tuple2)...
false
d6ab91f6579ec619a681ab8f0d6f31240773a194
Gaurav716Code/Python-Programs
/if else if/ph value..py
288
4.125
4
def phvalue(): num = float(input("Enter number : ")) if num > 7 : print(num," is acidic in nature.") elif num<7: print(num," is basic in nature.") else: print(num,"is neutral in nature.") print("~~~~ End of Program ~~~~~~") phvalue()
true
d22f4ce6a9cff8d04db8fca268a56a52bb2092e3
ridwan098/Python-Projects
/multiplication table.py
220
4.21875
4
# This program displays the multiplication table loop = 1 == 1 while loop == True: n= input('\nenter an integer:') for i in range(1, 13): print ("%s x %s = %s" %(n, i, i*int(n)))
true
e4d00925b6e7d22f3f36a97fe670119419ffc614
ridwan098/Python-Projects
/fibonacci sequence(trial 1).py
361
4.15625
4
# This program prints out the fibonacci sequence(up to 100) loop = 1 == 1 while loop == True: number = 1 last = 0 before_last = 0 num = int(input("\nHow many times should it list? ")) for counter in range(0, num): before_last = last last = number number = be...
true
26f0f0fdbbe45e57831f01a07ccdcf501e11515c
kelleyparker/Python
/grades.py
512
4.3125
4
print("This program calculates the averages of five students' grades.\n\n") # Define a list of tuples containing the student names and grades students = [] for i in range(5): name = input(f"Insert student {i+1}'s name: ") grade = float(input(f"Insert {name}'s grade: ")) students.append((name, grade)) # Ca...
true
19387fd2d7095b98e0492d1e93bd8f98001d8cf1
MaiShantanuHu/Coursera-Python-3-Programming
/Python-Basics/Week-2/Lists and Strings.py
1,622
4.21875
4
'''Q-1: What will the output be for the following code?''' let = "z" let_two = "p" c = let_two + let m = c*5 print(m) #Answer: # pzpzpzpzpz '''Q-2: Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write your code so that it work...
true
88aa8d4f5e4c0db6bc03e01b37b1b81e5419b3fa
dtulett15/5_digit_seperator
/3digit_seperator.py
300
4.28125
4
#seperate three digits in a three digit number entered by user #get number from user num = int(input('Enter a 3 digit number: ')) #set hundreds digit num1 = num // 100 #set tens digit num2 = num % 100 // 10 #set ones digit num3 = num % 10 #seperate digits print(num1, ' ', num2, ' ', num3)
true
9c2987a4dc6565034ae0ee703a4af1175d409d22
shahzeb-jadoon/Euclids-Algorithm
/greatest_common_divisor.py
691
4.375
4
def greatest_common_divisor(larger_num, smaller_num): """This function uses Euclid's algorithm to calculate the Greatest Common Divisor of two non-negative integers pre: larger_num & smaller_num are both non-negative integers, and larger_num > smaller_num post: returns the greatest com...
true
873a3801db68683d1551df016016074821335284
Meghna-U/posList.py
/posList.py
215
4.125
4
list=[] s=int(input("Enter number of elements in list:")) print("Enter elements of list:") for x in range(0,s): element=int(input()) list.append(element) for a in list: if a>0: print(a)
true
b088d63f6224b4081924db231b5f058b78498171
aastha2008/C1-Turtle
/main.py
1,993
4.59375
5
''' 03/22/2021 Introduction to Turtle # 1. Import turtle library import turtle # 2. Create a pen/turtle variable=turtle.Turtle() # 3. Create a paper/screen variable2 = turtle.Screen() # 4. Movements a. Move forward variable1.forward(DISTANCE) variable1.fd(DISTANCE) b. Move backward variable1.ba...
false
7e97f790d96abf42d0220cb1fe537834a50d0796
shikhaghosh/python-assigenment1
/assignment2/question10.py
284
4.15625
4
print("enter the length of three side of the triangle:") a,b,c=int(input()),int(input()),int(input()) if a==b and a==b and a==c: print("triangle is equilateral") elif a==b or b==c or a==c: printf("triangle is a isoscale") else: printf("triangle is a scalene")
true
e22b05a76b97dc275f3092a23404a3b7263f0f24
shikhaghosh/python-assigenment1
/assignment2/question7.py
268
4.21875
4
print("enter three numbers:") a1,a2,a3=int(input()),int(input()),int(input()) if(a1<a2<a3 or a3<a2<a1): print(a2,"is the second smallest") elif(a2<a3<a1 or a1<a3<a2): print(a3,"is the second smallest") else: print(a1,"is the second smallest")
false
143f78b793a0772073bcc3239ce361d2735339d4
IbroCalculus/Python-Codes-Snippets-for-Reference
/Set.py
1,592
4.21875
4
#Does not allow duplicate, and unordered, but mutable. #It is faster than a list #Python supports the standard mathematical set operations of # intersection, union, set difference, and symmetric difference. #DECLARING EMPTY SET x= set() #NOTE: x = {} is not an empty set, rather an empty dictionary s ...
true
b27175e1a40f491c0ef12308615e1fc946b694e6
IbroCalculus/Python-Codes-Snippets-for-Reference
/Regex2.py
902
4.4375
4
import re #REGULAR EXPRESSIONS QUICK GUIDE ''' ^ - Matches the beginning of a line $ - Matches the end of a line . - Matches any character \s - Matches whitespace \S - Matches any non-whitespace character * - Repeats a character zero or more times *? - Repeats a character zero or more times (non-greedy) + ...
true
43c3fddb4167b616b765b692e7c4a02d36f2e32f
IbroCalculus/Python-Codes-Snippets-for-Reference
/Dictionary.py
1,766
4.3125
4
#CREATE A DICTIONARY: 2 METHODS cars = {"Benz": 2, "Corola": 1} cars2 = dict(fname="Ibrahim", mname="Musa", sname="Suleiman") print(f'The number of Benz cars are: {cars["Benz"]}') print(f'You are welcome Mr {cars2["fname"]} {cars2["mname"]} {cars2["sname"]}') #Copy a dictionary cars2 = dict(fname="Ibrahim",...
false
1f7f8ee6ed425bc86dba4a171d6c5da109035b5a
santospat-ti/Python_ExListas
/ex10.py
318
4.125
4
"""Faça um Programa que leia um vetor A com 10 números inteiros, calcule e mostre a soma dos quadrados dos elementos do vetor.""" num = [] soma = 0 for n in range(10): num.append(int(input('Digite um número: '))) soma += (num[len(num) - 1] ** 2) print('A soma dos quadrados do vetor são', soma)
false
d13a82fd3c12c780d64089c05e1e3387c3d5ab39
santospat-ti/Python_ExListas
/ex07.py
826
4.21875
4
"""Faça um Programa que leia duas listas com 10 elementos cada. Gere uma terceira lista de 20 elementos, cujos valores deverão ser compostos pelos elementos intercalados das duas outras listas.""" lista_um = [] lista_dois = [] lista_tres = [] lista_inter = [] for n in range(10): print('Lista um') lis...
false
fd9adb7ebb5603760577526aa16ab7d83555be5d
ParulProgrammingHub/assignment-1-mistryvatsal
/Program8.py
241
4.15625
4
# WPP TO TAKE INPUT BASE AND HEIGHT OF THE TRIANGLE AND PRINT THE AREA OF THE TRIANGLE base = int(input('ENTER THE BASE OF THE TRIANGLE :')) height = int(input('ENTER THE HEIGHT OF THE TRIANGLE :')) print('AREA IS : ', 0.5 * height * base)
true
c26f6b50cf1d5469dbd3cc97838e12ec9893e8ba
johnlev/coderdojo-curriculum
/Week2/activity.py
633
4.34375
4
# We are going to be making a guessing game, where the user guesses your favorite number # Here we define a variable guess which holds the user's response to the question # The input function asks the user the question and gives back the string the user types in. # The int(...) syntax converts the string into an i...
true
f83050b30754d73714f4382103ec3499635b7eb2
GiantPanda0090/Cisco_Toolbox
/regex/remove_dup_words.py
695
4.46875
4
################################################### # Duplicate words # The students will have to find the duplicate words in the given text, # and return the string without duplicates. # ################################################### import re def demo(): print(remove_duplicates("the bus bus will never be...
true
7b23940e3907b14467adeec77e52d3713ae5ad87
jtylerroth/euler-python-solutions
/1-100/14.py
1,219
4.125
4
# The following iterative sequence is defined for the set of positive integers: # # n → n/2 (n is even) # n → 3n + 1 (n is odd) # # Using the rule above and starting with 13, we generate the following sequence: # # 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 # It can be seen that this sequence (starting at 13 and fin...
true
f8ba737f5a10bd6f8d3bdc7edb17545ed95c78fb
Monamounika/Python
/Functions/Var_len_arg.py
734
4.3125
4
''' The variable length argv is an argv that can accept any no.of values. The variable length argv is written with * before variable in fn definition. ''' def totalcost(x,*y): sum=0 for i in y: sum+=i print(x+sum) #print(sum) totalcost(100,200) totalcost(122,576,8) totalcost(67) def to...
false
7c54831f8c3e6f351e963513424ee7cc89c52ee6
fsaraos27/Codigos_Varios
/Multiplicar.py
413
4.15625
4
print("") print("Multiplica ") print("") print("Ingresa un numero a multiplicar ") num1 = int(input()) print("Ingresaste el numero", num1) print("") print("Ingresa el segundo numero a multiplicar ") num2 = int(input()) print("Ingresaste ", num2) print("Presiona enter para multiplicar ") enter = input() print("La multip...
false
a9e34edfcc8e1aae24613a2e286a6e34ef0ec5d5
marslwxc/read-project
/Python高级编程和异步IO并发编程/Chapter08/metaclass_test.py
968
4.125
4
# 类也是对象,type是创建类的类 def create_class(name): if name == 'user': class User: def __str__(self): return "user" return User elif name == "company": class Company: def __str__(self): return "company" return Company # type动态创建类 c...
false
086a9d173ed3e63778658acb1b08f31c5adacf90
leo-sandler/ICS4U_Unit_4_Algorithms_Leo_Sandler
/Lesson_4.1/4.1_Recursion_and_Searching.py
1,826
4.21875
4
import math # Pseudo code for summing all numbers from one to 100. # Initialize count variable, at 1 # for 101 loops # Add loop number to the count, with reiterating increase # Real code count = 0 for x in range(101): count += x # print(count) # Recursion is calling the same function within itself. # Recursi...
true
83971e63972f9a21edf9f355529cab109502a54d
sanketha1990/python-basics
/pythonHelloWorld/com/python/learner/ComparisionOperatorInPython.py
410
4.46875
4
temperature=30 if temperature > 30: # == , !=, print('its hot day !') else: print('it is not hot day !') print('=============================================') name=input('Please enter your name .. ') name_len=len(name) if name_len <= 3: print('Name should be gretter thant 3 charecter !') elif name_len >=5...
true
07c5d362279a97b82ea87639ceefc126938d9535
bijayofficial/College_webDev
/college/class 6/uc_lc.py
208
4.125
4
a=input("enter the character") if(a>'A' and a<='Z'): print("upper case") elif(a>'a' and a<='z'): print("lower case") elif(a>='0' and a<='9'): print("number") else: print("Symbols")
false
bc0237b5b7ad679068c608b10a522c79423ca44a
alexisfaison/Lab1
/Programming Assignment 1.py
1,021
4.1875
4
# Name: Alexis Faison # Course: CS151, Prof. Mehri # Date: 10/5/21 # Programming Assignment: 1 # Program Inputs: The length, width, and height of a room in feet. # Program Outputs: The area and the amount of paint and primer needed to cover the room. import math #initialize variables width_wall = 0.0 length_wall = 0....
true
c566f5a501c3836a02acec1ecdbbdebad233eee3
AAKANSHA773/Basic-of-python
/6.dictionary.py
742
4.15625
4
d2=dict() print("empty dictionary",d2) d1={} print("empty dictionary repersant",d1) d={'1':"one"} print("key and value",d) d3={'1':"one",'2':"two",'3':"third",'4':"string"} print(d3) d3['1']='100'#chnage the value of index one element print(d3) d3[1]=[1,2,3] #give value in the from of list print(d3) print("two" i...
false
0f662c6750f4e56b67eb4c73f495dc70b96c1bf7
pallavibhagat/Problems
/problem2.py
376
4.4375
4
""" If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Write a program to find the sum of all the multiples of 3 or 5 below 1000. """ def multiple(): sum = 0 for i in range(1,1000): if i%3==0 or i%5==0: sum +=i ...
true
2133af4c52bba08fd49755539e15512f1ee865e5
DipakTech/Python-basic
/app.py
2,827
4.15625
4
# print('hello world') # python variables # one=1 # two=2 # some_number=1000 # print(one,two,some_number) # booleans # true_boolean=True # false_boolean=False # # string # my_name='diapk' # # float # book_price=12.3 # print(true_boolean,false_boolean,my_name,book_price) # if True: # prin...
true