blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
33fd8f151e3a06f6b304f6ec74003efa7afaf8e5
AngelPerezV/python
/Condicionales.py
1,419
4.125
4
""" Condicionales (pt. I) Los condicionales los utilizaremos para validar si se cumple una o más condiciones para ejecutar cierto bloque de código, en esencia nos ayuda a tomar decisiones sobre el flujo de nuestro código. """ """ Sintaxis: if condition: # Block of code elif other_condition: # Another block of c...
false
ebf0a9c88f3db9b20577e9bbeceab4d0cd243d26
longjiazhen/learn-python-the-hard-way
/ex11.py
1,241
4.3125
4
#coding:utf-8 #print语句的后面有逗号的话,输出这句话以后就不会换行,而是在同一行等待输入 #print语句的后面没有逗号的话,输出以后就会换行,到下一行去等待输入 print "How old are you?", age = raw_input() age11 = raw_input("How old are you??\n") #这样输入How tall are you? 6'22" print "How tall are you?", height = raw_input() print "How much do you weigh?", weight = raw_input() print "So,y...
false
35b8cae406fb052b17ac400bbd22d93af679999a
Mohanishgunwant/Home_Tasks
/problem2.py
455
4.375
4
#Create a program that asks the user for a number and then prints out a list of all the divisors of that number. # (If you don’t know what a divisor is, it is a number that divides evenly into another number. For example, 13 is a divisor of 26 because 26 / 13 has no remainder.) def list_divisor(x): lis = [] f...
true
e67c0dcb9c17cabd20f9896fe33d1f236b6e02ad
sharonzz/Programming-For-Everybody.coursera
/assignment7.2.py
796
4.28125
4
#7.2 Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form: X-DSPAM-Confidence: 0.8475 #Count these lines and extract the floating point values from each of the lines and compute the average of those values and produce an output as shown below...
true
bed359932d354615b7849676da7d04476dd72132
jswetnam/exercises
/ctci/ch9/robot.py
1,395
4.15625
4
# CTCI 9.2: # Imagine a robot sitting in the upper left corner of an X by Y grid. # The robot can only move in two directions: right and down. How many # possible paths are there for the robot to go from (0, 0) to (X, Y)? # Imagine that certain spots are off-limits. Design an algorithm for the # robot to go from the ...
true
bdd706b18ce4a36e14e6e69253fae329f14696c9
m0hanram/ACADEMICS
/clg/sem4/PYTHONLAB/psbasics_1/assignment 1/ps1basic_7.py
324
4.15625
4
def panagram_func(sentence): alphabet = "abcdefghijklmnopqrstuvwxyz" for i in alphabet: if i not in sentence.lower(): return "false" return "true" sen = input("enter the sentence : ") if (panagram_func(sen) == "true"): print("it is a panagram") else: print("it is not a panagram...
true
3bf9847235620c0ad7663bb9e1b8f205e62801d0
SelvaLakshmiSV/Registration-form-using-Tinker
/form.py
2,701
4.53125
5
#how to create simple GUI registration form. #importing tkinter module for GUI application from tkinter import * #Creating object 'root' of Tk() root = Tk() #Providing Geometry to the form root.geometry("500x500") #Providing title to the form root.title('Registration form') #this creates 'Label' widget for Registra...
true
b727ed52184529f3bb0735f536986e244a21d4dd
kangliewbei128/sturdy-siamese
/caesar cipher.py
2,471
4.75
5
import pyperclip import string #This asks the user for what message they want to be encrypted inputedmessage=input('enter a message to be translated:') #converts the message that the user inputed into lowercase letters. optional. If you want it converted, add .lower() at the end of inputedmessage message=inputedmessage...
true
b432afe745e13a897a4ad44ea51f6105440d39c8
petrenkonikita112263/Python_Professional_Portfolio_Projects
/Tic Tac Toe/tic_tac.py
2,171
4.28125
4
class TicTacToeGame: def __init__(self, board) -> None: """Class constructor""" self.board = board def display_board(self) -> None: """Function that sets up the board as the list""" print(f""" ------------------------- |\t{self.board[1]}\t|\t{self.board[2]}\t|\t...
true
39a4aee8be08db5c2e90b874a862ecbff87c1389
k1ll3rzamb0n1/Code_backup
/Undergrad/2012/Fall 2012/comp sim/plants-and-animals/plants and animals/plotter.py
2,124
4.125
4
# COMP/EGMT 155 # # Program to create a graphical plot of functions # stored as points read from a text file. # # This program will plot the output from the # plants_and_animals.py program. from graphics import * from string import * #--------------------------------------------------- # Function to transform a poin...
true
025b2f7ba336976f61136ebe46f7e9228a859568
bendaw19/EntornosDesarrollo
/Tema 2/Actividad 3 VisualStudioCode.py
774
4.25
4
# En este ejercicio pide al usuario dos numeros por teclado y una operación, suma, resta, multiplicación o división. # Se evaluará los errores que se puedan introducir. # Posteriormente mostrará el resultado de la operación. try: numero1 = float(input("Introduce primer numero: ")) numero2 = float(input("Int...
false
11a8b6b733cb8b55e32149da5b17ba576c7faea5
Hunter-Chambers/WTAMU-Assignments
/CS3305/Demos/demo1/Python/timer.py
1,262
4.34375
4
#!/usr/bin/env python3 '''This file contains the Timer class''' from time import time, sleep class Timer: '''A class to model a simple timer''' def __init__(self): '''default constructor ''' self.start_time = 0 self.stop_time = 0 # end __init__ def start(self): '''st...
true
f6c6add641c75fece52810cdd31dedcc4170025f
valdot00/hola_python
/7 bucles y condiciones/37_ejercicio_1.py
643
4.125
4
#37 ejercicio 1 #crea un dicionario con los siguientes pares de valores #manzana apple #naranje orange #platano banana #limon lemon #muestra la traducion para la palabra "naranja" #añade un elemento nuevo "piña" y pineaple" # haz un bucle para mostrar todos los elementos del dicionario diccionario={"manzana":"apple"...
false
59f4a3c574d7e2ca588c5c13f9fd7309ceebf29c
valdot00/hola_python
/4 cadenas de texto/16_ejercicio_2.py
783
4.34375
4
#ejercicio #crear una variable "cadena" que contiene el texto "esto es un texto de ejemplo" #crear una variable "longitud" que contiene la longitud (numero de caracteres) de la variable "cadena" #crear una variable "mayusculas" que contiene la variable(cadena) en mayusculas # crear un variable "resultado" que concatene...
false
e7ab690072141453c17ff58dca413b67a2385f6d
vadim-vj/wh
/syllabuses/cs/problems/merge-sort/_.py
809
4.1875
4
def merge_ordered_lists(list1, list2): result = [] while list1 or list2: if list1 and list2: # `<` is important lst = list1 if list1[0] < list2[0] else list2 elif list1: lst = list1 elif list2: lst = list2 result.append(lst.pop(...
false
f6dbb5cef74dea564a35491e61e991f5bb2a2259
fsahin/algorithms-qa
/Recursive/PhoneNumberPermutation.py
729
4.21875
4
""" For any phone number, the program should print out all the possible strings it represents. For example 2 can be replaced by 'a' or 'b' or 'c', 3 by 'd' 'e' 'f' etc. """ d = { '0':"0", '1':"1", '2': "ABC", '3': "DEF", '4': "GHI", '5': "JKL", '6': "MNO", '7': "PQRS", '8': "TUV...
true
fed28e9c2affe058cfb233be1cfa1f918c0cff51
ukms/pyprogs
/factorial.py
293
4.40625
4
def findFactorial(num): if num == 1 or num == 0: return 1 else: factorial = num * findFactorial(num -1) return factorial num = input(" Enter the number to find the Factorial: ") if num < 0: print -1 else: print "The Factorial is: ",findFactorial(num)
true
04ea54eb96992d447e5b0bcd8754274223a8d5f3
PrinceWangR/pywork
/chart3.py
2,130
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #age = 3; #if age >= 18: # print('Your age is' , age) # print('adult') #else: # print('Your age is' , age) # print('teenager') #input返回的是字符串 #born = input("birth:") #born = int(born) #if born < 2000: # print("00前") #else: # print("00后") #体重属性判断“体重/身高的平方”” #如:我身高1.71,体重...
false
a49360504955debdc1f902b8970de4fd8cf4d2a7
tdcforonda/codewars-practice
/Python/valid_parentheses.py
544
4.1875
4
def valid_parentheses(string): # your code here checker = 0 if string == "": return True for char in string: if char == "(": checker += 1 if char == ")": checker -= 1 if checker < 0: return False if checker == 0: ...
true
841fda7005cd87d5f3ac6e9008d926058e0db87b
SDSS-Computing-Studies/003-input-darrinGone101
/task1.py
325
4.5
4
#! python3 """ Ask the user for their name and their email address. You will need to use the .strip() method for this assignment. Be aware of your (2 points) Inputs: name email Sample output: Your name is Joe Lunchbox, and your email is joe@koolsandwiches.org. """ name = str( input("input name:")).stip() email = ...
true
fb0dc1d767dcf929911a524a9e6b0d73ace35e8e
yangwangkong/python-xuexi
/字符串下标.py
262
4.28125
4
""" 使用字符串中特定的数据 这些字符会按顺序从0开始分配一个编号 -- 使用这个编号就可以精确找到这个字符 -- 即为索引或者下标,索引值 str1[下标] """ str1 = 'abcdefg' print(str1) print(str1[0]) print(str1[2])
false
b36f458c94cb92ecd441c81465cbcf0c2f6aea7f
yangwangkong/python-xuexi
/if嵌套.py
419
4.125
4
""" 1.准备将来要做的判断的数据:钱和空座 2.判断是否有钱:有钱,上车;没钱,不能上车 3.上车了:判断是否能坐下,有空座位和没有空座位 """ money = 1 seat = 1 if money == 1: print("请上车") if seat == 1: print("有空座位,可以坐下了") else: print("没有空座,站着等...") else: print("朋友,忘记带钱了?")
false
4d7c969ae9b87fdd268819fa2732b0d3213aaaec
yangwangkong/python-xuexi
/认识数据类型.py
542
4.21875
4
''' 1. 按经验将不同的变量存储不同的数据 2. 验证这些数据到底是什么类型--检测数据类型--type(数据) ''' # int--整形 num1 = 1 print(type(num1)) # float--浮点型 num2 = 1.1 print(type(num2)) # str--字符串 a = 'Hello world!' print(type(a)) # bool--布尔值 b = True print(type(b)) # list--列表 c = [10, 20, 30] print(type(c)) # tuple--元组 d = (10, 20, 30) print(type(d)) ...
false
66c58c5a4739510a1209147258355d2af2d0eb30
eightarcher/hackerrank
/SimpleArraySum.py
768
4.25
4
""" Given an array of integers, can you find the sum of its elements? Input Format The first line contains an integer, , denoting the size of the array. The second line contains space-separated integers representing the array's elements. Output Format Print the sum of the array's elements as a single integer. S...
true
4a0a227a309e7b976951b23d36d148af14384198
LucaCappelletti94/dict_hash
/dict_hash/hashable.py
1,322
4.1875
4
class Hashable: """The class Hashable has to be implemented by objects you want to hash. This abstract class requires the implementation of the method consistent_hash, that returns a consistent hash of the function. We do NOT want to use the native method __hash__ since that is willfully not consi...
true
13466cd075e3ed41d71b05df3bb0a9ac86e80a1f
dAIsySHEng1/CCC-Junior-Python-Solutions
/2004/J1.py
208
4.1875
4
def squares(): num_tiles = int(input()) i = 1 a = i**2 while a <= num_tiles: i+= 1 a = i**2 b = str(i-1) print('The largest square has side length',b+'.') squares()
true
7af34baadaed3d48da49a5632025bbd058d1d7c8
dAIsySHEng1/CCC-Junior-Python-Solutions
/2015/J1.py
282
4.46875
4
def is_feb_18(): month = input() day = int(input()) if month == '1' or (month == '2' and day < 18): print('Before') elif (month != '1' and month != '2') or (month == '2' and day > 18): print('After') else: print('Special') is_feb_18()
false
b8840a75e87046562283642f0e11be187d7a1cf9
jmhernan/code4fun
/quartiles.py
1,413
4.25
4
# Given an array, 'arr', of 'n' integers, calculate the respective first quartile (Q1), second quartile (Q2), # and third quartile (Q3). It is guaranteed that Q1, Q2, and Q3 are integers. # Steps # 1. Sort the array # 2. Find the lower, middle, and upper medians. # If the array is odd then the middle element in the mi...
true
591375be5bf0f32ee9b52b076560e52ec8d2d2c0
MouseCatchCat/pythonStudyNote
/venv/Include/classes.py
1,122
4.21875
4
students = [] class Student: school_name = 'School' # constructor to init an obj def __init__(self, name, student_id=1, student_grade=0): self.name = name self.student_id = student_id self.student_grade = student_grade # override the print function basically, if I print t...
true
37a29bb134960c34710dd94d56c8f4410cf4d5e3
Yahya-Elrahim/Python
/Matplotlib/Scatter Plot/scatter.py
1,001
4.1875
4
# ------------------------------------------------------------- # ----------------------- Scatter ----------------------------- # Scatter plots are used to observe relationship between variables and uses dots to represent the relationship # between them. The scatter() method in the matplotlib library is used to draw ...
true
58862e58468698bbe77a5405b78df4f948e48e33
CindyTham/Favorite-Meal-
/main.py
693
4.125
4
print('Hello, What is your name?') name = input('') print('Hello ' + name +', Let me get to know you a little better, Tell me about your Favourite meal?') respond = input ('') print ('Great, what is your favourite starter?') starter = input('') print('And your favourite main course?') main_course = input('') print('Gre...
true
e2c06777f29b4f3308029c54bb2e83b060627dc4
dbconfession78/holbertonschool-webstack_basics
/0x01-python_basics/15-square.py
1,296
4.25
4
#!/usr/bin/python3 """ Module 15-square """ class Square: """ class definition for 'Square' """ def __init__(self, size=0): """ Square class initialization """ self.__size = size def __repr__(self): """ __repr__ for the Square class """ ...
false
0a8a2e3035a8329e9da15b572fb51398ea291289
erikkvale/algorithms-py
/sort/selection_sort.py
740
4.34375
4
def find_smallest(_list): """ Finds the smallest integer in an array >>> demo_list = [4, 5 , 2, 6] >>> find_smallest(demo_list) 2 """ smallest = _list[0] smallest_idx = 0 for idx, num in enumerate(_list): if num < smallest: smallest = num smallest_idx...
true
29e6efc7ed814dd9228ea9da15dc42cff8ca14a0
coderrps/Python-beginners
/newcode_11.py
206
4.40625
4
#exponents (2**3) used as 2^3 def raise_to_power(base_num, pow_num): result = 1 for index in range(pow_num): result = result * base_num return result print(raise_to_power(4,2))
true
187e9470b42a049edd81f56ff46e443570e69a3e
danjgreene/python
/Coursera - Python 1 & 2/coursera_intro_py_pt2/wk5/wk5A_lsn1_practice1.py
823
4.3125
4
# Echo mouse click in console ################################################### # Student should enter code below # Examples of mouse input import simplegui import math # intialize globals WIDTH = 450 HEIGHT = 300 # define event handler for mouse click, draw def click(pos): print "Mouse click at " + str(pos)...
true
c3ce682b36d98cb5b2c331694392411c6781d001
c0d1f1c4d0r/tryinggit
/exercicios_curso_em_video/exerc006.py
282
4.125
4
# Exercício Python 006: Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raiz quadrada. n = float(input('Insira um número: ')) print('O número inserido foi {} seu dobro é {} seu triplo é {} e sua raiz quadrada é {}'.format(n, (n*2), (n*3), (n ** (1/2))))
false
edbde5c1980e9947ed07222c875f7f42f864efcb
sushantchandanwar/Assignment_01
/42_CheckSubstringInString&LengthOfString.py
969
4.15625
4
# Method1: Using user defined function. # function to check if small string is # there in big string def check(string, sub_str): if (string.find(sub_str) == -1): print("NO") else: print("YES") # driver code string = "geeks for geeks" sub_str = "geek" check(string, sub_str) # method-2 def c...
true
204c3817555e95c26eb82523001a7d92c6cd5677
sushantchandanwar/Assignment_01
/30_PositveNoList.py
328
4.375
4
# Python program to print positive Numbers in a List # method-1 list1 = [11, -21, 0, 45, 66, -93] for num in list1: if num >= 0: print(num, end=" ") # method-2 # list1 = [-10, -21, -4, 45, -66, 93] # # # using list comprehension # n = [x for x in list1 if x >= 0] # # print("Positive numbers in the list:...
true
843a3fd9dee6d2a37b81b91c982baef4b7edc43d
clayboone/project-euler
/src/problem003/solution.py
668
4.15625
4
import math def lpf(n: int) -> int: """Return the largest prime factor of a number `n`""" # Algorithm found online. Comments are for my understanding. assert n > 1 max_prime = None # where n is 110, primes are [2, 5, 11] # Strip the number of 2s that divide n while n % 2 == 0: max...
false
951bf4357da6caeea01211d980fd694036518bb7
joeryan/100days
/cybrary.py
1,114
4.25
4
# cybrary1.py # exercise 1: practical applications in python # adapted and expanded from cybrary.it video course # Python for Security Professionals at www.cybrary.it/course/python # used to improve pytest understanding and overall python knowledge import platform import numbers # 1. determine if the input is odd or...
true
488899ba082277204541e5227250ba3ee0571684
khurath-8/SDP-python
/assignment1_areaoftriangle_58_khurath.py
234
4.21875
4
#PROGRAM TO FIND AREA OF TRIANGLE height=float(input("enter the height of triangle:")) base=float(input("enter the base of the triangle:")) aot=(height*base)/2 print("area of triangle is :",aot)
true
c54432a3b333ab2ba233568328f7971f60e63f61
joneskys7/pi
/NESTED IF.py
714
4.1875
4
while True: a=(raw_input("please enter value of A")) b=(raw_input("please enter value of B")) if a>b: print "A is greater" c=(raw_input("please enter value of c")) d=(raw_input("please enter value of d")) if c>d: print "c is greater" if c<d: ...
true
68f5968fd6b077983bee5ffee8ea059d65a08b3f
joneskys7/pi
/IF GREATER.py
246
4.1875
4
while True: a=(int(input("please enter value of A"))) b=(int(input("please enter value of B"))) if a>b: print "A is greater" if b>a: print "B is greater" if a==b: print"Both are equal"
true
9c94768e58be59b312f7c37dc578bec5395e21f1
Baobao211195/python-tutorial
/data_structure/tuple.py
558
4.28125
4
print(""" + tap hop cac element phan tach nhau bang giau phay + tuple is immutable object + if element of type is mutable object, we can modify these mutable objects + Thuc hien packing and unpacking """) tp = 23, 32, 54, "oanh" print("type of tp : ", type(tp)) print(tp) tp = tp, ([1,2,1]) print ("new tp ", tp) ...
false
75b49068bfa72485b42356d3d2b533635ad8d515
leerobertsprojects/Python-Mastery
/Advanced Python Concepts/Functional Programming/Common_Functions.py
830
4.21875
4
from functools import reduce # map, filter, zip & reduce #map def multiply_by2(item): return item*2 print(list(map(multiply_by2, [1,2,3]))) mylist = [2,3,4] def multiply_by3(item): return item*3 def check_odd(item): return item % 2 != 0 print(list(map(multiply_by3, mylist))) print(mylist) # filter ...
true
620694b8fb9e64c13116b42e7856c515e62927ff
vaibhavnaughty/Fibonachi-series
/series.py
249
4.21875
4
# Using Loop # Vaibhav Verma # Print nth series n = int(input("Enter the value of 'n': ")) n1 = 0 n2 = 1 sum = 0 count = 1 print("Fibonacci Series: ", end = " ") while(count <= n): print(sum, end = " ") count += 1 n1 = n2 n2 = sum sum = n1 + n2
false
2ef17d1392c4b6bbefdd46d9903710856d660d44
bradmann/projectEuler
/problem002.py
386
4.125
4
from math import sqrt import sys def fibonacci(value): rho = (1 + sqrt(5)) / 2 return int((rho**value - (-1/rho)**value) / sqrt(5)) if __name__ == "__main__": upperBound = int(sys.argv[1]) i = 3 fibValue = fibonacci(i) fibSum = 0 while fibValue <= upperBound: fibSum += fibValue ...
false
6a486c3807ab428f11ceae22c4996ce363855670
heyese/hackerrank
/2d array.py
1,189
4.125
4
#https://www.hackerrank.com/challenges/2d-array/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays def hour_glass_sum(x,y, arr): """ arr is a list of lists. 0,0 is top left element in arr (x,y) -> x is the column, y is the row. (3,2) is 4th element in ...
true
cc6d22f51a9967266106aae9a8840984b031a824
khizra-ali/Python-Practice
/result.py
724
4.1875
4
English=int(input("enter obtained marks in English: ")) Pak_Studies=int(input("enter obtained marks in Pakistan Studies: ")) Sindhi=int(input("enter obtained marks in Sindhi: ")) Chemistry=int(input("enter obtained marks in Chemistry: ")) Biology=int(input("enter obtained marks in Biology: ")) obtained_marks=Eng...
false
b2382a0966607257a1e18123c9b1061aeae1590c
khizra-ali/Python-Practice
/list.py
830
4.15625
4
#list employee_list = ["umair", "ali", "amir", "danish", "hamza", 5,7,8] employee_age = [22,33,23,26,28] print(employee_list) print("employee name is: "+str(employee_list[6])) print("employee name is: "+str(employee_list[7])) print("employee name is: "+str(employee_list[1]) +"employee age is: "+ str(employee_ag...
false
c3881a0b59adb0fd8d3ab4b8717c5fd9a9f725db
puglisac/hackerrank-practice
/arrays_ds.py
370
4.46875
4
""" Function Description Complete the function reverseArray in the editor below. reverseArray has the following parameter(s): int A[n]: the array to reverse Returns int[n]: the reversed array >>> reverse_array([1, 2, 3]) [3, 2, 1] """ def reverse_array(arr): reversed=[] for i in range(0,len(arr)): ...
true
d6d0bcb2dbb50a00693bc1a56103da506ebfb75f
dzzgnr/colloquium
/3.py
1,249
4.15625
4
''' 3. Створіть масив з п'яти прізвищ і виведіть їх на екран стовпчиком, починаючи з останнього ''' arr = [] #инициализация массива print('enter 5 surnames : ') for i in range(5): el = input() #ввод фамилии arr.append(el) #добавление в массив print('\narr :', arr, '\n') for i in range(5): print(arr[4 -...
false
0f887fd140fe691a2a8d69dc70feb7c035f04ddf
Sourav692/100-Days-of-Python-Code
/Day 1/1. array_longest_non_repeat_solution.py
1,117
4.3125
4
# --------------------------------------------------------------- # python best courses https://courses.tanpham.org/ # --------------------------------------------------------------- # Challenge # # Given a string, find the length of the longest substring # without repeating characters. # Examples: # Given "abcabcbb"...
true
da7b84bdc7883e02407b47f49c2c8fbeb0dbe24d
tanu312000/pyChapter
/linksnode.py
2,609
4.125
4
class Node: def __init__(self, val, next_ref): self.val = val; self.next = next_ref; # Global variable for header and tail pointer in singly linked list. head = tail = None; # appends new node at the end in singly linked list. def append_node(val): global head, tail; node = Node(val...
true
84277dde39dc9b9ba32d48ee811154c9ca1bf363
kelraf/ifelif
/learn python 3/ifelif.py
872
4.3125
4
#The program asks the user to input an intager value #The program evaluates the value provided by the user and grades it accordingly #The values provided must be between 0 and 100 #caution!!! if you provide other values other than ints the program will provide errors marks=int(input("Please enter Students marks to Gra...
true
907c2116937946b84cdd771730ca9d41576730d1
TroGenNiks/python_for_beginers
/basics/string.py
473
4.21875
4
str = "Welcome in my world ." print(str) print(str[:5]) # print upto 5 print(str[2:]) # print from 2 print(str[0::2]) # print by skipping 1 letter print(str[::-1]) # reverse the string # functions of string print(str.isalnum()) # checking string for alphanumeric or not print(str.lower()) # converting into lower prin...
true
76e6460bf21370cdf4262a3da40eae1f6f07798e
meksula/python-workspace
/bootcamp/section_3/strings.py
1,277
4.28125
4
# komendy linuxa możemy wywoływać za pomocą metod z przestrzeni `os` import os print('Python test') #output = os.system('ps aux') ############ # string w Pythonie można traktować jako niemutowalną tablicę znaków nameDisordered = 'alrok' name = nameDisordered[4] + nameDisordered[0] + nameDisordered[2] + nameDisordere...
false
c001dc7306530a377450ac57337cab0d7880e998
kgrozis/netconf
/bin/2.4 Matching and Searching for Text Patterns.py
2,343
4.375
4
''' Title - 2.4. Matching & Searching for Text Patterns Problem - Want to match or search text for a specific patterns Solution - If match is a simple literal can use basic string methods ''' text = 'yeah, but no, but yeah, but no, but yeah' # Exact match print('Exact Match:', text == 'yeah') # Match at start...
true
2aa611cce77b26f6ec0eca14d32e703d7cc4cf36
emlam/CodingBat
/List-1/first_last6.py
469
4.125
4
def first_last6(nums): """ Given an array of ints, return True if 6 appears as either the first or last element in the array. The array will be length 1 or more. first_last6([1, 2, 6]) → True first_last6([6, 1, 2, 3]) → True first_last6([13, 6, 1, 2, 3]) → False """ if nums[0] ...
true
f5f21b70304bc006ef8e67593ef13a257d318767
AChen24562/Python-QCC
/Week-1/VariableExamples_I/Ex7a_numbers_integers.py
754
4.25
4
# S. Trowbridge 2020 # Expression: 5+2 # + is the operator # 5 and 2 are operands # Expression: num = 5+2 # = is called assingment, this is an assignment operation # integers and basic maths print(5+2) # addition print(5-2) # subtraction print(5*2) # multiplication print("") print(5/2) # floating-point division...
true
48453ed9edda73bb3a756d220d98fe763774562c
AChen24562/Python-QCC
/Week-1/VariableExamples_I/Ex6_type_casting.py
424
4.28125
4
# Chap2 - Variables #type casting from float to integer x = int(2.8) print(x,type(x)) #type casting from string to integer x = int("3") print(x,type(x)) #type casting from integer to float y = float(1) print(y,type(y)) #type casting from string to float y = float("3.8") print(y,type(y)) #type casting from integer ...
true
89516e62abc9a2e12dd14c65cb2750a4088b2ae7
AChen24562/Python-QCC
/Week-2-format-string/Week-2-Strings.py
292
4.1875
4
address = '5th Avenue' print('5th Avenue') print(address) print("This string has a 'quotation' in it") item1 = "apples" item2 = "pears" number = 574 message = f"I want to buy {number} {item1} and {item2}." print(message) message = f"Hi, do you want to buy {number} {item1}?" print(message)
true
a2e9857ca65fe8486937e6a632996f5347b7f724
AChen24562/Python-QCC
/Exam2/Q10.py
911
4.5625
5
'''a) Create a dictionary, people, and initialize it with the following data: 'Max': 15 'Ann': 53 'Kim': 65 'Bob': 20 'Joe': 5 'Tom': 37 b) Use a loop to print all items of the dictionary people as follows: name is a child (if the value is younger than 12). name is a teenager (if the value is younger than 20). name is...
true
e7dac55232da561490983510b4d0ec74d289a2c4
AChen24562/Python-QCC
/Exam2-Review/Review2-input-if.py
212
4.3125
4
num = int(input("Enter an integer number: ")) # Determine if input is negtive, positive or zero if num < 0: print("Negative") else: if num == 0: print("Zero") else: print("Positive")
true
d63e95c3988f731fc95b7fb25d0b2219fe7fee23
ledbagholberton/holbertonschool-machine_learning
/pipeline/0x03-data_augmentation/2-rotate.py
348
4.15625
4
#!/usr/bin/env python3 """ Write a function that rotates an image by 90 degrees counter-clockwise: image is a 3D tf.Tensor containing the image to rotate Returns the rotated image """ import tensorflow as tf import numpy as np def rotate_image(image): """Rotate image""" flip_2 = tf.image.rot90(image, k=1, n...
true
76ae676219453fdcbc8218dbc8a0ee6f98e8eee0
ledbagholberton/holbertonschool-machine_learning
/math/0x06-multivariate_prob/multinormal.py
2,625
4.25
4
#!/usr/bin/env python3 """ data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError with the message data must be a 2D numpy.ndarray If n is less than 2, raise a ValueError with t...
true
32aa2a887039e511d35daf6768de28d9d301eda9
xzhou29/symbolic-fuzzer-1
/examples/check_triangle.py
1,373
4.25
4
def is_divisible_by_3_5(num: int, num2: int): num = 15 if num % 3 == 0: if num % 5 == 0: return True else: return False return False def is_divisible_by_3_5_without_constant(num: int, num2: int): if num % 3 == 0: if num % 5 == 0: ...
false
03f1cec6035b6e629fe729f17d157afd52779995
jrieraster/pildoras
/08_tuplas.py
642
4.1875
4
miTupla=("Juan",13,7,1995) print(miTupla) print(miTupla[2]) miLista=list(miTupla) #"List" Asigno a una lista la tupla print(miLista) #Notar que cambia los () por [] myList=["teto","Tito", False,5,18,21.9,18] myTuple=tuple(myList) # "Tuple" Para convertir una lista a una tupla print(myTuple) print("teto" in myTu...
false
18cb1709c41d781f819fd31dfa3e28da5b181be9
Fiskk/Project_Euler
/#1.py
1,505
4.3125
4
#Steffan Sampson #11-8-2017 #Project Euler Problem 1 def sum_of_multiples(): print("This function finds the sums of multiples of integers below an upper bound") print("This function takes in an upper bound") print("As well as the numbers to be used to find the multiples") #low_end = int(input("Please...
true
18ec76f38dd7a8e9405d351a4e2e3f6b794296b8
sainathprabhu/python-class
/Assertion.py
359
4.1875
4
#assert is a keyword to check values before performing the operations def multiplication(a,b): assert(a!=0), "cannot perform the operation" #makes sure that a is not zero assert(b!=0), "cannot perform the operation" #makes sure that b is not zero return(a*b) print(multiplication(3,0)) #print(multiplica...
true
b6bd7b83c8d50a8dc499c6efccbf237f480df0f9
Debu381/Coding-battel
/2.py
1,609
4.15625
4
def pattern(number): li = list() # to store of lists num=1 # to initiate for i in range(1, number+1): x = list() # to create a temporary list for j in range(1 , ...
true
1a9c8c09b72a831f202c42f27f3647c9baeb26f5
Kertich/Algorithm-qns
/smallest_difference.py
786
4.15625
4
array_a = [-1, 5, 10, 20, 28, 3] array_b = [26, 134, 135, 15, 17] get = [] def smalldifference(array_a, array_b): ''' Prints a list of two values each from different array(array_a, array_b). The difference of the two values returns the smallest difference. Parameters: ---------- array_a(it...
true
9c7baffba283344307ada04b57412dff6c52a2db
wildsrincon/holbertonschool-higher_level_programming
/0x06-python-classes/6-square.py
2,198
4.375
4
#!/usr/bin/python3 """6-square.py: Script to print tuples of square position""" class Square: """Creates Square type""" def __init__(self, size=0, position=(0, 0)): """Initializes the square with position and size""" self.size = size try: self.position = position ...
true
e737e7b18d4dec68ffea54b048e3c207320733c2
AlexSkrivseth/python_scripts
/python_scripts/ah.py
877
4.125
4
# In the formula below, temperature (T) is expressed in degrees Celsius, # relative humidity (rh) is expressed in %, # and e is the base of natural logarithms 2.71828 [raised to the power of the contents of the square brackets]: # # Absolute Humidity (grams/m3) = 6.112 × e^[(17.67 × T)/(T+243.5)] × rh × 18.02 / (273.1...
true
18e3425cf8b6efa0d0d52d9ed458dffd98d25679
SaiPrathekGitam/DSPprograms
/simple_interest.py
223
4.15625
4
# Program to calculate simple interest p = int(input('Enter Initial Principal Balance : ')) r = int(input('Enter ANnual Interst Rate : ')) t = int(input('Enter Time(in years) : ')) print('Simple Interest Is', p*r*t)
false
12f98b8a6150acf567acc1e62de69e1ebdb012ad
ADARSHGUPTA111/pythonBasics
/python_basics(git)/dictionaries.py
1,331
4.21875
4
#dictionaries act as a key value pair ninja_belts={"crystal":"red","ryu":"black"} print(ninja_belts) print(ninja_belts['crystal']) #this returns the value associated with this key #how to check whether there exists a key in the given dictionary or not #use key in dict print('yoshi' in ninja_belts)#returns ...
true
80970b63c28851bcb5ab76b8b3d418e5f5289489
Chadmv95/cis457-Project-1
/ftp-client.py
2,774
4.125
4
# CIS457 Project 1 # Description: ftp-client will connect to an ftp server. Valid commands are exit, retrieve, store, and list #!/usr/bin/python3 import ftplib # Function to get FTP connection information from user # return IP of server and port number def welcome(): print("Welcome to FTP client app\n") ser...
true
b94da510b1b838748c6f1fac774f8dc8ab74fd0a
iliankostadinov/thinkpython
/Chapter9/Ex9.6.py
573
4.15625
4
#!/usr/bin/env python3 """ Write a function called is_abecedarian that returns True if the letters in a word appear in alphabetical order (double letters are ok). How many abecederian words are there? """ def is_abecedarian(word): tmp_char = 'a' for letters in word: if tmp_char > letters: ...
true
059220dcf416327b83c9fe2eeb06b3fb25b39202
iliankostadinov/thinkpython
/Chapter9/Ex9.4.py
336
4.25
4
#!/usr/bin/env python3 """ Write a function named uses_only that takes a word and a string of letters, and that returns True if the word contains only letters in the list """ def uses_only(word, string): for chars in word: if chars in string: continue else: return False ...
true
08b048f0fddd8a43263c32cce9a76238df233e20
joshuathompson/ctci
/linked_lists/palindrome.py
794
4.1875
4
from linked_list import LinkedList def is_palindrome(linkedList): palindromeStr = "" node = linkedList.head while node is not None: palindromeStr += node.data node = node.nextNode palindromeStr = palindromeStr.replace(" ", "") reversedPalindrome = palindromeStr[::-1] return p...
false
389c7c1344976822a774803fa44dfcca8e0f4414
behrouzmadahian/python
/pandas/13-hierarchical-Indexing.py
2,756
4.34375
4
import pandas as pd ''' Up to this point we've been focused primarily on one-dimensional and two-dimensional data, stored in Pandas Series and DataFrame objects, respectively. Often it is useful to go beyond these and store higher-dimensional data–that is, data indexed by more than one or two keys. ''' print('R...
true
8c01d08334ea73dfef9c593241aaf2281585dd79
behrouzmadahian/python
/python-Interview/4-sort/3-insertion-sort.py
1,122
4.125
4
''' for index i: looks into the array A[:i] and shifts all elements in A[:i] that are greater than A[i] one position forward, and insert a[i] into the new position. takes maximum time if elements are sorted in reverse order. ''' def insertion_sort(a): for i in range(1, len(a)): key = a[i] ...
true
ba3f073b642f828f39bc28fb3ea7b185fbf01f1c
behrouzmadahian/python
/python-Interview/4-sort/2-bubbleSort.py
689
4.125
4
''' Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. on the first pass, the last element is sorted, On the second pass the last two elements will be sorted,.. O(n2) ''' def bubble_sort(a): for i in range(len(a)): for j...
true
d4a2ec8e6957ad4b2550589260d608267a3c90c9
behrouzmadahian/python
/python-Interview/5-linkedList/2-Insertion.py
1,568
4.53125
5
''' A node can be added in three ways 1) At the front of the linked list 2) After a given node. 3) At the end of the linked list. ''' class Node: def __init__(self, data): self.data = data self.next = None # LinkedListClass class LinkedList: # function to initialize the linke...
true
64fa4a7d5c0651baf5a24367aeac8663b1e94e34
KkrystalZhang/ToyRobot
/robot.py
2,228
4.125
4
from grid import Grid from utils import DIRECTIONS, MOVES class Robot(object): """ The Robot class contains state of the robot and methods to update the state. """ def __init__(self): self.x = None self.y = None self.direction = None def place(self, x: int, y: int, directi...
true
f5562b6f521fcebd02606b50dc90b0e42080298d
Niranjana55/unsorted-array-questions
/MtoNprime.py
633
4.125
4
#prime num import math def isprime(N): a=True for i in range(2,int(math.sqrt(N)+1)): if(N%i==0): a=False break return a #print all prime num m to n def PrintPrimesFromMToN(m,n): count=0 if(m==1 or m==2): print(2) count+=1 m=3 if(m%2==0): ...
false
016a78e9e87e2eaa9bebe126a658dcef73ce281a
Sarbodaya/PythonGeeks
/Variables/Variables.py
831
4.28125
4
# Global Variable # Global variables are those who are declared # outside the function we need to use inside the function def f(): s = 'Me Too' print(s) s = "I want to Become Data Scientist" f() print(s) # If a variable with the same name is defined inside the scope of # function as well then it...
true
7bef1dc5c4f2ac421b43578a7e4bac9c2629b58e
Sarbodaya/PythonGeeks
/Variables/PackingUpacking2.py
987
4.875
5
# A Python # program to # demonstrate both packing and # unpacking. # A sample python function that takes three arguments # and prints them def unpacking(a, b, c): print(a, b, c) def packing(*args): args = list(args) args[0] = 'GeeksForGeeks' args[1] = 'awesome' unpacking(*args...
false
24ffdc95caf475b3cd21d1dd134adfb64ad97f42
Sarbodaya/PythonGeeks
/Data Types/AccessingTuples.py
1,048
4.78125
5
# Accessing the tuple with indexing Tuple1 = tuple("Geeks") print("First element of Tuple : ") print(Tuple1[1]) # Tuple Unpacking Tuple1 = ("Sarbodaya Jena", "Indian Army", "Indian Navy", "Indian Air Force") # This line unpack the values of tuple a, b, c, d = Tuple1 print("Values after Unpacking : ") print...
true
d9d06ff6ea7e72fa2a977246d418e3d06f765637
Sarbodaya/PythonGeeks
/ControlFlows/tut5.py
1,046
4.53125
5
king = {'Akbar': 'The Great', 'Chandragupta': 'The Maurya', 'Modi': 'The Changer'} for key, value in king.items(): print(key, value) # Using sorted(): sorted() is used to print the container is sorted order. It doesn’t # sort the container but just prints the container in sorted order for 1 instance. # The ...
true
6f367f512d9df7f20689ea7716053401e2f09045
Sarbodaya/PythonGeeks
/Basics/StringIsKeywordOrNot.py
798
4.15625
4
# Python code to demonstrate working of iskeyword() import keyword key = ["while", "sarbodaya", "for", "global", "nonlocal", "lambda", "Tanishq", "Rahul", "def", "import"] for i in range(len(key)): if keyword.iskeyword(key[i]): print(key[i], " is a keyword") else: print(key[i], " is n...
false
5db93f86f3128a7ff07ecead0bacc8cd82b362a3
Sarbodaya/PythonGeeks
/ControlFlows/tut3.py
431
4.1875
4
fruits = ["apple", "orange", "kiwi"] for fruit in fruits: print(fruit) # Creating an iterator object # from that iterable i.e fruits fruits = ["mango", "banana", "grapes"] iter_obj = iter(fruits) while True: try: # getting the next item fruit = next(iter_obj) print(fruit...
true
c2045c9e986ff05195bc2860905f7ae37819cc90
Sarbodaya/PythonGeeks
/ControlFlows/tut2.py
1,387
4.53125
5
print("List Iteration : ") list1 = ['Sarbodaya', 'Jena', 'Army'] for i in list1: print(i) print("Tuples Iteration : ") tuple1 = ("Geeks", "For", "Geeks") for i in tuple1: print(i) print("String Iteration : ") s = "geeks" for i in s: print(i) print("Dictionary Iteration : ") d = dict() d[...
false
21795b39ac96ea65e171431811c5c75f2594e797
Sarbodaya/PythonGeeks
/ControlFlows/tut4.py
1,594
4.9375
5
# Different Looping Techniques # Using enumerate(): enumerate() is used to loop through the containers printing # the index number along with the value present in that particular index. for key, value in enumerate(['The', 'Big', 'Bang', 'Theory']): print(key, value) for key, value in enumerate(['Geeks',...
true
6955a27ab909bd7a55235829d2eb3390cbdb75f8
rekikhaile/Python-Programs
/4 file processing and list/list_examples.py
828
4.28125
4
# Initialize my_list = [] print(my_list) my_list = list() print(my_list) ## Add element to the end my_list.append(5) print(my_list) my_list.append(3) print(my_list) # notice, list can contain various types my_list.append('Im a string') print(my_list) ## more operations on lists my_list.remove('Im a string') print(my...
true
d31fd6fcfd7419e8f184d0fefa6e77b280d96858
Nahid-Hassan/fullstack-software-development
/code-lab/DSA - Fibonacci Numbers.py
910
4.21875
4
import random import math def fibonacci_recursive(n): if n <= 1: return n return fibonacci_recursive(n - 1) + fibonacci_recursive(n - 2) def fibonacci_iterative(n): fib = [0, 1] for i in range(2, n+1): fib.append(fib[i-1]+fib[i-2]) return fib[n] def fibonacci_formula(n): ...
false
447513034ca76fc1c522377b2c89ad7fb15e4198
pyfor19/babel-emmanuel
/input/first.py
529
4.1875
4
# Premier traitement fullname = input("Quel est votre prénom et nom ?") print(fullname) names = fullname.split() print(names) print(type(names)) len_listnames = len(names) print(len_listnames) if len_listnames == 2: print("Prénom " + names[0] + " Nom: " + names[1]) elif len_listnames == 3: print(f"Prénom {n...
false
c52f66676fcf6ab8ed68d82dfb96cf773ab265f2
KarlYapBuller/03-Higher-Lower-game-Ncea-Level-1-Programming-2021
/02_HL_Get_and_Check_User_Choice_v1.py
1,092
4.1875
4
#Get and Check User input #Number Checking Function goes here def integer_check(question, low=None, high=None): situation = "" if low is not None and high is not None: situation = "both" elif low is not None and high is None: situation = "low only" while True: try: ...
true
a4af8a265f728ad04325783b9a2279421beb44ed
zhanglae/pycookbook
/ch1/cookbook1_13.py
1,192
4.3125
4
'1.13 Sorting a List of Dict by common key' ''' Problem You have a list of dictionaries and you would like to sort the entries according to one or more of the dictionary values. ''' 'Think about its a small db, sort by one column' rows = [ {'fname': 'Brian', 'lname': 'Jones', 'uid': 1003}, {'fna...
true
88ea161e3affcbd9132cf26218c035f67a03e953
Lokarin/Fragmentos
/tabuada.py
495
4.1875
4
# -*- coding: utf-8 -*- numero = float(input("Número do multiplicando: ")) x1 = numero * 1 x2 = numero * 2 x3 = numero * 3 x4 = numero * 4 x5 = numero * 5 x6 = numero * 6 x7 = numero * 7 x8 = numero * 8 x9 = numero * 9 x10 = numero * 10 print("--- Tabuada do %i --- \n"%numero ) print("×1 = %f"%x1) print("×2 = %f"%x2...
false