blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
1edba41774723a9513d2f54f1124286b91de2b22 | Greesha1337/python_basic_11.05.2020 | /hw5/hw5_task1/task1.py | 602 | 4.3125 | 4 | # Lesson 5 HomeWork - Task 1
"""
Создать программно файл в текстовом формате,
записать в него построчно данные, вводимые пользователем.
Об окончании ввода данных свидетельствует пустая строка.
"""
with open('user_file.txt', 'a', encoding='UTF-8') as file:
while True:
user_words = input('Введите данные дл... | false |
479a5121a83c7d842158e0103026d6705b5a355c | bdrummo6/Sprint-Challenge--Data-Structures-Python | /names/binary_search_tree.py | 2,415 | 4.375 | 4 |
class BSTNode:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
# Insert the given value into the tree
def insert(self, value):
new_node = BSTNode(value)
# Compare the new value with the parent node
if self.value:
... | true |
c949deb09588dd751cccd359fa7c403e47a1a46c | stefanpostolache/pythonHandsOnExamples | /complete/example-0/main.py | 1,433 | 4.21875 | 4 | import random
"""
Module containing functions to create a hand of cards
"""
def createHand(handsize):
"""
Creates a hand of cards
Args:
handsize (int): size of the hand of cards
Returns:
tuple: hand and remainder of the deck
"""
deck = generateDeck()
deck = shuffle(deck)
... | true |
bbdf381fbe52e6039ea91ba56e7cbd259b503ae9 | gustavogattino/Curso-em-Video-Python | /Mundo 1 - Fundamentos/Aula09/aula09_1.py | 803 | 4.65625 | 5 | """Exemplos aula 09."""
frase = ' Curso em Vídeo Python '
print(frase)
print(frase[3])
print(frase[3:13])
print(frase[:13])
print(frase[1:15:2])
print(frase[::2])
print("""Nessa aula, vamos aprender operações com String no Python.
As principais operações que vamos aprender são o Fatiamento de String,
Análise com len... | false |
90eac31f7a975d89e6aedf0b7a44e3f9fa3adb93 | gustavogattino/Curso-em-Video-Python | /Mundo 1 - Fundamentos/Aula08/aula08_1.py | 288 | 4.21875 | 4 | """Exemplos aula 08."""
# import math
from math import sqrt, floor
num = int(input('Digite um número: '))
# raiz = math.sqrt(num)
raiz = sqrt(num)
# print('A raiz de {} é igual a {:.2f}.'.format(num, math.floor(raiz)))
print('A raiz de {} é igual a {:.2f}.'.format(num, floor(raiz)))
| false |
b92b3348fa54343d7ee3a47c52ad10104292e99a | joshua-paragoso/PythonTutorials | /13_numpyArrays.py | 2,103 | 4.5625 | 5 | # Numpy arrays are great alternatives to Python Lists. Some of the key advantages of Numpy arrays are that
# they are fast, easy to work with, and give users the opportunity to perform calculations across entire
# arrays.
# In the following example, you will first create two Python lists. Then, you will import the n... | true |
89b4791ec2c77af0224a9970b5c2f093a9e2a3a9 | AnkitaTandon/NTPEL | /python_lab/sum_of_cubes.py | 254 | 4.34375 | 4 |
'''
Q3 (Viva) : Write a Python program for finding cube sum of first n natural numbers.
'''
sum=0
n=int(input("Enter the value of n: "))
for i in range(1,n+1):
sum += (i*i*i)
print("The sum of the cubes of first n natural numbers = ", sum)
| true |
edb4f262aa8eca2abf3754958c29ad3eade451e6 | AnkitaTandon/NTPEL | /python_lab/1b.py | 245 | 4.1875 | 4 | '''
Lab Experiment 1b: Write aprogram which accepts the radius of a circle
from the user and computes it's area.
'''
num=int(input("Enter the radius of the circle: "))
a=3.14*num*num
print("Area of the circle = ",a)
| true |
32d593104fa5ca8d27dcda20491664a5a60f59bc | AnkitaTandon/NTPEL | /python_lab/add_set.py | 392 | 4.125 | 4 | '''
Lab Experiment 6b: Write a program to add members in a set.
'''
s=set({})
n=int(input("Enter the number of elements to add to a new set:"))
print("Enter the elements-")
for i in range(n):
s.add(int(input()))
print(s)
n=int(input("Enter the number of elements to update to a set:"))
print("Enter the e... | true |
c862d7b2ed1835580cccd4768cc7703b6a79d6e1 | nothingtosayy/Strong-Number-in-python | /main.py | 349 | 4.1875 | 4 | def StrongNumber(x):
sum = 0
for i in str(x):
fact = 1
for j in range(1,int(i)+1):
fact = fact*int(j)
sum = sum + fact
return sum
number = int(input("Enter a number : "))
if number == StrongNumber(number):
print(f"{number} is a strong number")
else:
print(f"{numbe... | true |
fcbf5e0b09aa329d4f5e092990d344290c2b9206 | frappefries/Python | /Assignment/ex1/prg7.py | 696 | 4.40625 | 4 | #!/usr/bin/env python3
"""Program to create a list with 10 items in it and perform the below
operations
a) Print all the elements
b) Perform slicing
c) Perform repetition with * operator
d) Concatenate with other list
Usage: python3 prg7.py
"""
def init():
"""Perform operations on the list object and display the... | true |
e838153c9ffe71dcd43b77bd2b78d198d2c14193 | frappefries/Python | /Assignment/ex1/prg6.py | 1,073 | 4.46875 | 4 | #!usr/bin/env python3
"""Program to read a string and print each character separately.
also do
a) slice the string using [:]operator to create subtstrings
b) repeat the string 100 times using the * operator
c) read the second string and concatenate it with the first string using
+ op... | true |
5bc62025f4a8731214f840073dbfd5a980678449 | frappefries/Python | /Assignment/ex1/prg17.py | 1,038 | 4.53125 | 5 | #!/usr/bin/env python3
"""Program to find the biggest and smallest of N numbers (use functions to find
the biggest and smallest numbers)
Usage: python3 prg17.py
"""
def init():
"""Fetch 5 numbers and display the smallest and biggest number"""
num = []
print("Enter 5 numbers:")
for item in range(5):
... | true |
feef9f3d26f617fefd95cd910c2ae481f9ba8386 | jenniferjqiai/Python-for-Everybody | /Chapter 8/Exercise 4.py | 649 | 4.3125 | 4 | #Exercise 4: Download a copy of the file www.py4e.com/code3/romeo.txt.
# Write a program to open the file romeo.txt and read it line by line. For each line,
# split the line into a list of words using the split function. For each word,
# check to see if the word is already in a list. If the word is not in the list, add... | true |
de6b6981980fad37774192df2b7bab67f773511b | atmilich/DaltonPython | /hw2.py | 2,081 | 4.125 | 4 | def convertScoreToGrade(n):
grade = ""
if(99 <= int(n) <= 100):
print("true")
grade = "A+"
elif(96 <= int(n) <= 98):
grade = "A"
elif(93 <= int(n) <= 95):
grade = "A-"
elif(90 <= int(n) <= 92):
grade = "B+"
elif(87 <= int(n) <= 89):
grade = "B"
elif(84 <= int(n) <= 86):
grade = "B-"
elif(81 <= int... | true |
f3fddc03d0ba3399490a014e3bbcae93a411cf62 | EarthenSky/Python-Practice | /misc&projects/ex(1-5).py | 1,154 | 4.28125 | 4 | # This is a built in python library that gives access to math functions
import math
# Uses pythagorean theorm to find the hypotenuse of a triangle
def find_hypotenuse(a, b):
return math.sqrt(a ** 2 + b ** 2)
# Inital statement
print "This is a right triangle hypotenuse calculator."
# Define Global input paramet... | true |
8da15a787b0276cae157b598910d8eadbc809ee0 | EarthenSky/Python-Practice | /misc&projects/ex(1-4).py | 1,314 | 4.3125 | 4 | # Initial print statements
print "Name: Gabe Stang"
print "Class: Magic Number 144"
print "Teacher: Mr. Euclid \n"
# "def" is how you define a function / method.
# A function in python may or may not have a return value.
# Outputs a string detailing what numbers were added and the solution
def string_sum(num1, num2):... | true |
0437d19e719d4ae83939d6f2507f95290ff8ee46 | OneTesseractInMultiverse/python-class-group-1 | /s-clase2/variables.py | 771 | 4.1875 | 4 | print("Hola, esto es una clase sobre variables en Python")
print("-----------------------------------------")
# Esto es un comentario de una sola línea
"""
A continuación vamos a crear un programa que nos permite
calcular un discriminante. El discriminante se puede
calcular de la siguente manera:
dicriminante = (bˆ2)... | false |
dcecd97b65c9cffa90b45aa04186619d0b8f791e | Cherchercher/magic | /answers/flatten_array.py | 407 | 4.46875 | 4 | def flatten_array_recursive(a):
"""
recursively flattened nested array of integers
Args:
a: array to flatten which each element is either an integer or a (nested) list of integers
Returns:
flattened array
"""
result = []
for i in a:
if type(i) == list:
result += f... | true |
5b60b8daede4884824ec4652dd1e35b1099b18a5 | league-python-student/level0-module1-RedHawk1967 | /_03_if_else/_5_shape_selector/shape_selector.py | 1,083 | 4.40625 | 4 | import turtle
from tkinter import messagebox, simpledialog, Tk
# Goal: Write a Python program that asks the user whether they want to
# draw a triangle, square, or circle and then draw that shape.
if __name__ == '__main__':
window = Tk()
window.withdraw()
# Make a new turtle
my_t... | true |
cd52330ace48dffaf87384d281d9585b82fa2172 | AK-171261/python-datastructures-programs | /sort_dict.py | 996 | 4.3125 | 4 | '''
Ways to sort list of dictionaries by values in Python – Using lambda function/Using itemgetter
'''
lis = [{"name": "Nandini", "age": 20},
{"name": "Manjeet", "age": 20},
{"name": "Nikhil", "age": 19}]
# Method-1
for obj in sorted(lis, key=lambda x: (x["age"], x["name"])):
print(obj)
# {'name': '... | false |
436a5a72ec807c80d379373be7f619e982a7f663 | edufreitas-ds/Datacamp | /01 - Introduction to Python/03 - NumPy/12 - Average versus median_adapted.py | 1,142 | 4.1875 | 4 | """
You now know how to use numpy functions to get a better feeling for your data. It basically comes down to importing
numpy and then calling several simple functions on the numpy arrays:
import numpy as np
x = [1, 4, 8, 10, 12]
np.mean(x)
np.median(x)
The baseball data is available as a 2D numpy array with... | true |
1a719ddedba620ec08f18633c1730f50cfc3d0e9 | the-carpnter/algorithms | /towers_of_hanoi.py | 565 | 4.1875 | 4 | def hanoi(n, rod0, rod1, rod2):
# This is the base case, we just have to move the 1 remaining plate to the target plate
if n == 1:
print('Plate 1 from {} to {}'.format(rod0, rod2))
return
# We have to first move n-1 plates to the auxiliary rod
hanoi(n-1, rod0, rod2, rod1)
# Moving th... | true |
c81a139f48b30116760c3710f5778fedcac40def | gmoore016/Project_Euler | /Complete/Problem009.py | 1,306 | 4.25 | 4 | """
Gideon Moore
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
"""
def main():
# Solutions are defined by pairs of a and b since... | true |
7e46412e2ebbc5927203136c852039fb3067da7e | ofhellsfire/python-notes | /lectures/02-intermediate/06-iterables-iteration/example/multiply_table.py | 642 | 4.28125 | 4 | # Nested Comprehension Example
TABLE_SEPARATOR = '|'
FORMAT = f'{TABLE_SEPARATOR} {{:>2}} '
def get_table_length(table, frmt):
return len([rows for rows in table]) * len(frmt.format('')) + 1
def print_row_separator(length, sep='-'):
print(sep * length)
def main():
mul_table = [[x * y for x in range(1... | false |
2d5f0fa53d224128c6c6730cbd317decf614f72a | yashlad27/MAC-Python-basics-Jun21 | /Tuples01.py | 1,165 | 4.6875 | 5 | # TUPLE: it is a collection which is ordered and unchangeable
# tuples are written with round brackets
thisTuple = ("apple", "banana", "cherry")
print(thisTuple)
# 1. tuple items are ordered, unchangeable, and allow duplicate values
# first item has index [0] and the second item has index [1]
# 2. tuples have a defi... | true |
75b576265e6714bc87460fadd1891797cc5bbcad | yashlad27/MAC-Python-basics-Jun21 | /tupleUnpack.py | 896 | 4.75 | 5 | # UNPACKING A TUPLE:
# When we creat a tuple, we normally assign values to it. This is called "packing" tuple.
fruitsT = ("apple", "cherry", "orange")
# but in Python we are allowed to extract the values back into variables.
# this is called unpacking
(green, yellow, red) = fruitsT
print(green)
print(yellow)
print(... | true |
5c96164b29472c96a0ba028c64f5e21cdeeea9c8 | yang1127/school-test | /数据管理与方法/用户.py | 292 | 4.15625 | 4 | name = input("请输入您的姓名:")
gender = input("请输入您的性别:")
age = input("请输入您的年龄:")
# 通过字典设置参数
dic = {"name":name, "gender":gender, "age":age}
print("您的姓名是: {}, {}, 年龄{}岁".format(dic["name"], dic["gender"], dic["age"]))
| false |
c6518e553b8f94585b1fe98f6b82f70ea450d88f | duanwandao/PythonBaseExercise | /Day02(分支及循环)/Test04.py | 1,115 | 4.3125 | 4 | """
分支:
单分支
if 表达式:
表达式成立执行的代码...
双分支
多分支
分支的嵌套
循环:
while
语法:
while 表达式:
表达式成立执行的代码...
迭代(趋向终止)
for
"""
# 将HelloWorld输出10遍
# print('HelloWorld\n'*10)
# i = 0
# while i < 10:
# print("HelloWorld i = %d"%i)
# i = i + 1
# i = 1
# while i <= 100:
# ... | false |
b4f462b12b36781b009255fed1f4274cddee6217 | duanwandao/PythonBaseExercise | /Day11(面向对象3)/Test06.py | 419 | 4.28125 | 4 | """
多继承中属性的处理:
"""
class A():
def __init__(self,a,aa):
self.a = a
self.aa = aa
class B():
def __init__(self,b):
self.b = b
class C(A,B):
def __init__(self,a,b,c):
super().__init__(a,b)
self.c = c
#
# c = C(1,2)
# print(c.a)
# print(c.aa)
# print(c.b)
c = C(1,2,3)
... | false |
6ff16bbe8fd5433d4d4287801962ee7b036982fd | duanwandao/PythonBaseExercise | /Day13(异常及模块的使用)/Test06.py | 894 | 4.1875 | 4 | """
1.包是什么?
包:(文件夹)
package
python3中可以不使用__init__.py模块
__init__.py 初始化
python2中一定要有
2.如何创建一个包
new->package
直接创建一个文件夹
3.包的作用
1.方便管理
2.不同的包中,允许存在同名类
4.如何引入指定包中的指定模块
import package1.Test00
from package1.Test00 import *
引入某个包中的任何一个模块,该包中的__init__.py会先执行
在ini... | false |
80fd335569f5cd677e7cc9968fd6a39a04c8e291 | duanwandao/PythonBaseExercise | /Day09(面向对象1)/Test05.py | 685 | 4.28125 | 4 | """
创建对象,拥有默认属性:
__init__()方法的使用
"""
class Driver():
#增加一个方法
def __init__(self,id,name):
print("我是init方法")
# 给自己加属性
self.id = id
self.name = name
def drive_car(self):
print("工号:%d %s为您服务"%(self.id,self.name))
print("1、踩离合")
print("2、打火")
prin... | false |
3acfc2b29d25fc139abe71e875c8baef909c90af | duanwandao/PythonBaseExercise | /Day12(设计模式及异常处理)/Test03.py | 838 | 4.28125 | 4 | """
设计模式:
单例模式:
全局对象唯一
__new__()
作用: 分配内存空间
__init__()
作用: 初始化
初始化唯一性
"""
class Data():
#定义一个私有的类属性
__single = None
def __new__(cls, *args, **kwargs):
print("new方法")
if cls.__single == None:
cls.__single = super().__new__(cls)
... | false |
94583feac92b4d55a2b1be598de7aadebc4a7276 | duanwandao/PythonBaseExercise | /Day07(递归及文件处理)/Test05.py | 1,187 | 4.375 | 4 | """
匿名函数
关键字
lambda
lambda 参数...: 表达式
注意:
1.匿名函数中可以存在0,1,多个参数
2.匿名函数中不能存在return语句
3.匿名函数运算完之后,只能得到一个值(返回值)
思考:
一般函数可以存在几个返回值?
一个还是多个?
返回值可以存在1个或者多个
如果函数返回多个值,接受的方式有两种:1. 只有一个接受 2.个数匹配
"""
def get_sum(a,b):
return a + b
# test = lam... | false |
c38533f21096e3481670b9da2aa42525c648b59a | duanwandao/PythonBaseExercise | /Day19(高级特性)/Test05.py | 699 | 4.3125 | 4 | """
一个函数拥有多个装饰器的问题:
装饰器用来装饰函数
如果一个函数有多个装饰器,那么,装饰顺序取决于离函数的远近距离(近的先装)
《》
"""
def add_out1(func):
print("装饰器开始装饰1")
def add_in1():
return '《' + func() + "》"
return add_in1
def add_out2(func):
print("装饰器开始装饰2")
def add_in2():
return '*' + func() + "*"
return add_in2
@ad... | false |
ebf86e745c08079f18e418c017f5015c4f3bc051 | duanwandao/PythonBaseExercise | /Day10(面向对象2)/Test03.py | 2,253 | 4.1875 | 4 | """
练习:
面向对象的封装练习:
回合制游戏:
大话西游、梦幻西游、问道...
角色:
Hero:
属性:
名字、生命值、伤害值(浮动随机值)
方法:
攻击方法
Boss:
属性:
名字、生命值、伤害值(浮动)
方法:
攻击方法
Hero
Boss
while True:
if Hero.活着:
... | false |
fa2728ce4877a73cfd46ad3dbc1ab76aba2cce5c | khabib-habib/week3 | /exercises.py | 294 | 4.15625 | 4 | phrase = input("Enter the phrase: ")
# return the vowels used in the phrase
vowels = ['e', 'u', 'i', 'o', 'a']
result = []
for letter in phrase:
if letter in vowels:
result.append(letter)
print(result)
print("".join(result))
result2 = {'e':0, 'u':0, 'i':0, 'o':0, 'a':0}
| true |
71761cf997e5ddb9fbb89a5a7e5d72906461dcb3 | mehul-clou/turtle_race | /main.py | 1,130 | 4.28125 | 4 | from turtle import Turtle, Screen
import random
is_race_on = False
screen = Screen()
screen.setup(width=500, height=400)
user_guess= screen.textinput(title="Make your bet", prompt="Which Turtle Will Win the race? Enter a race")
print(user_guess)
color = ["red", "yellow", "green", "orange", "brown", "pink", "blue"]
y_... | true |
53eac1a63bbd7eae0395d4320c0d4e521aa3cd5c | lotlordx/CodeGroffPy | /type_conversion_exception_handling.py | 764 | 4.21875 | 4 | def divide_numbers(numerator, denominator):
"""For this exercise you can assume numerator and denominator are of type
int/str/float.
Try to convert numerator and denominator to int types, if that raises a
ValueError reraise it. Following do the division and return the result.
However if ... | true |
1afba2447fa497eae562f3edde3f9bce1aecef15 | MDCGP105-1718/portfolio-s189385 | /xp11.py | 291 | 4.21875 | 4 | low_value = int(input("please input the lowest value"))
high_value = int(input("please input the highest value"))
for i in range(low_value,high_value):
if i % 3 == 0 and i % 5 == 0:
print("FIZZBUZZ")
elif i % 3 == 0:
print("FIZZ")
elif i % 5 == 0:
print("BUZZ")
else:
print(i)
| false |
147d74d2301bf83acae626f93d0ade6d920c7eb5 | Bivekrauniyar/my-calculator | /main.py | 445 | 4.125 | 4 | print("welcome to my calculator\n made by bivek" )
print("enter your operator",
"+","-","*","/","%")
n1=input()
print("enter first number")
n2=input()
print("enter second number")
n3=input()
if n1=="+":
print(int(n2)+int(n3))
elif n1=="-":
print(int(n2)-int(n3))
elif n1=="*":
print(in... | false |
3c532b716e5c8f9616e9ee644dca1269f1aecafc | davidebuglione/esercizi-in-classe | /esercizio_31.py | 552 | 4.25 | 4 | numero_decimale=int(input("inserire il numero decimale che si desidera trasformare in binario"))
funzione_python=bin(numero_decimale)
numeri_binari=[]
numeri_binari.append(numero_decimale%2)
while numero_decimale!=1:
numero_decimale//=2
resto=numero_decimale%2
numeri_binari.append(resto)
numeri_binari.rever... | false |
bc0226c18442d8117ac9caae0070b818e987af74 | davidebuglione/esercizi-in-classe | /scheda_3.py | 725 | 4.125 | 4 | linguaggio_svizzero=input("inserire una parola o una frase in rovarspraket da tradurre")
lista_linguaggio_svizzero=[]
for lettera in linguaggio_svizzero:
lista_linguaggio_svizzero.append(lettera)
vocali=["a","e","i","o","u"]
for lettera2 in lista_linguaggio_svizzero:
index_consonante=lista_linguaggio_sviz... | false |
fc58262858ac1531f14a0dda380c02c7d48d431a | muremwa/Simple-Python-Exercises | /exercise_6C_text_processing.py | 1,644 | 4.125 | 4 | # Q6c) Find the maximum nested depth of curly braces
#
# Unbalanced or wrongly ordered braces should return -1
#
# Iterating over input string is one way to solve this, another is to use regular expressions
import re
def max_nested_braces(string_):
braces = []
nesting = 0
# eliminate empty braces
if ... | true |
a08b1d9406425a7a7955eea2ba2160a58cd5ffe9 | muremwa/Simple-Python-Exercises | /exercise_1_variables_and_print.py | 506 | 4.28125 | 4 | # Ask user information, for ex: name, department, college etc and display them using print function
def main():
name = input('Enter your name: ')
college = input('Enter your college: ')
department = input('Enter your department: ')
print('\n')
print('-'*35)
print('Name' + ' '*(len('department'... | false |
932bae627c6a763a94ab7822ad3b7c1edf668a95 | VartikaPandey1303/first_repository | /if_1.py | 515 | 4.15625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 13 17:03:41 2019
@author: user
"""
#grades to be printed
day=int(input('enter a digit between 1 to 7 '))
if (day==1):
print('It is monday')
elif (day==2):
print('It is tuesday')
elif (day==3):
print('It is wednesday')
elif (day==4):
p... | false |
7728d8b1f32f2c697b3a9a72bc219c7481f5df6c | Abdirahman136896/python | /areaofcircle.py | 267 | 4.4375 | 4 | #Write a Python program which accepts the radius of a circle from the user and compute the area.
import math
radius = int(input("Enter the radius of the circle: "))
x= math.pi
#area = ((22/7) * pow(radius, 2))
area = (math.pi * pow(radius, 2))
print(area) | true |
df4ee5f6f227c883f6ee5295bebab3ccb0fafb57 | Abdirahman136896/python | /tuples.py | 418 | 4.21875 | 4 | #create tuple
coordinates = (4,5)
#prints all the values in the tuple
print(coordinates)
#prints values of the tuple at a specific index
print(coordinates[0])
print(coordinates[1])
#coordinates[1] = 6 returns an error tuple object not supporting assignment because tuples are immutable
list_coordinates = [(4,5),... | true |
d68b9d4137ae3b1c74c5dea1fa34d4f9527a857c | jeneferjene/guvi_set1 | /odd.py | 248 | 4.15625 | 4 | ch = input("")
if((ch >= 'a' and ch <= 'z') or (ch >= 'A' and ch <= 'Z')):
print("invalid")
elif(ch >= '0' and ch <= '9'):
num=int(ch)
if (num % 2) == 0:
print("Even")
else:
print("Odd")
else:
print("invalid")
| false |
8b2f89d9739db319d3744bc3388829240417d3a1 | badlydrawnrob/python-playground | /anki/unused/bitwise.py | 1,032 | 4.34375 | 4 | '''
Bitwise | Introduction to bitwise operators
'''
print(5 >> 4) # Right Shift
print(5 << 1) # Left Shift
print(8 & 5) # Bitwise AND
print(9 | 4) # Bitwise OR
print(12 ^ 42) # Bitwise XOR
print(~88) # Bitwise NOT
# Numbers
# =======
# 8's bit 4's bit 2's bit 1's bit
# 1 0 1 0
#... | false |
e3ab63a25d5169348149a7749270a1311e54342a | badlydrawnrob/python-playground | /anki/added/lists/indexes-06.py | 1,092 | 4.625 | 5 | #
# Indexes: Sort
# - List Capabilities and Functions (9)
## sort() method
################
animals = ["cat", "ant", "bat"]
animals.sort()
for animal in animals:
print animal
#### Q: What is `sort()` doing here?
#### - Explain what it defaults to (alphabetical)
#### - Note that .sort() modifies the list rather ... | true |
a6d79d3a25e37f8ccaff2e47536d41a1ddbc0e86 | badlydrawnrob/python-playground | /flask-rest-api/05/tests/user_01.py | 2,014 | 4.15625 | 4 | '''
We're allowing the user class to interact
with sqlite, creating user mappings (similar
to the functions we created in `security.py`
`usename_mapping`, `userid_mapping`)
'''
import sqlite3
class User(object):
def __init__(self, _id, username, password):
self.id = _id
self.username = username
... | true |
d6f82c716dbfd073f594b06f26dafed1cfdd440d | liyi54/python-refresher | /Functions.py | 2,556 | 4.25 | 4 | # import turtle
#
# __import__("turtle").__traceable__ = False
#
#
# # def draw_square(name, size):
# """This function draws a simple square of a given size"""
# # for i in range(4):
# # name.forward(size)
# # name.left(90)
#
#
# def draw_mult_square(name, size):
#
# """Make turtle name draw a m... | false |
954e6f9ab4770826ad54bc799a054515b8ea85e2 | HashtagPradeep/python_practice | /control_flow_assignment/Assignment- Control Flow_Pradeep.py | 886 | 4.46875 | 4 | #!/usr/bin/env python
# coding: utf-8
# ---
# ---
#
# <center><h1>📍 📍 Assignment: Control Flow 📍 📍</h1></center>
#
# ---
#
# ***Take 3 inputs from the user***
#
# - **What is your Age?** (Answer will be an Intger value)
# - **Do you eat Pizza?** (Yes/No)
# - **Do you do exercise?** (Yes/No)
#
# #... | true |
7f60171c06620157ee51f79e34750848b7ade127 | AlexandruGG/project-euler | /22.py | 1,190 | 4.15625 | 4 | # Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
# For example,... | true |
49c35742888364656b980820e7278e1634aaf576 | BioGeek/euler | /problem014.py | 914 | 4.15625 | 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 finis... | true |
c0d467d681edc97d6048ad6080f6ca57f7231bd7 | unaidelao/codewars-solutions | /8kyu/bin_to_decimal.py | 418 | 4.375 | 4 | # 8 kyu
# Bin to Decimal - Python
# Complete the function which converts a binary number (given as a string) to a decimal number.
def bin_to_decimal(inp):
return int(inp, 2)
print(bin_to_decimal("0")) # 0
print(bin_to_decimal("1")) # 1
print(bin_to_decimal("10")) # 2
print(bin_to_decimal(... | false |
a30d28d0a0a0ab74bf73aae113bae31e1ae28bae | alf42pac/python1 | /less7_3.py | 807 | 4.15625 | 4 | # Lesson 7_3
class Cage:
def __init__(self, a):
self.a = a
def order(self, line):
return '\n'.join(['*' * line for i in range(self.a // line)]) + '\n' \
+ '*' * (self.a % line)
def __str__(self):
return self.a
def __add__(self, other):
return f'Сумма - ... | false |
ffa490bae900863d83963a5d68ef29a119852d71 | lukepeeler/lukepeeler.github.io | /docs/data_generator.py | 2,970 | 4.1875 | 4 | from graphics import *
from utility import *
import random
# Generates a random 2D points.
# meanX: mean of X-axis of the underlying normal distribution, type: int
# meanY: mean of Y-axis of the underlying normal distribution, type: int
# sigmaX: standard deviation on X-axis, type: int
# sigmaY: standard deviation on ... | true |
3e0644d2a2e4c28aa63219ce205d7d67d4af2130 | PickertJoe/algorithms-data_structures | /Chapter3_Basic_Data_Structures/palindrome_checker.py | 1,234 | 4.15625 | 4 | # A program to verify whether a given string is a palandrome - Miller and Ranum
from pythonds.basic import Deque
def main():
while True:
print("~~~Welcome to the Python Palindrome Checker!~~~")
palindrome = input("Please enter the string you'd like to test: ")
tester = palchecker(palindro... | true |
e2118826da7fd3917370b40d00f0c4199dbd93bd | PickertJoe/algorithms-data_structures | /Chapter5_Searching_Sorting/bubble_sort.py | 367 | 4.25 | 4 | # A simple function to perform a bubble sort algorithm to order a numeric list. Sourced from Miller & Ranum
def bubbleSort(alist):
for iteration in range(len(alist) - 1, 0, -1):
for i in range(iteration):
if alist[i] > alist[i + 1]:
temp = alist[i]
alist[i] = al... | true |
10e1be03e36e97d938f05566b1e464a0d2e3890e | PickertJoe/algorithms-data_structures | /Chapter3_Basic_Data_Structures/unordered_list_test.py | 2,693 | 4.25 | 4 | # A program to test the function of the unordered list class
import unittest
from unordered_list import UnorderedList
class ULTestCase(unittest.TestCase):
"""Ensures proper functioning of unordered list methods"""
def test_UL_empty(self):
"""Ensures Unordered List returns correct boolean re: existan... | true |
bf2accb1d629c86bbd82f9f6ca7f7e1aa0cb550a | t6nesu00/python-mini-projects | /guessNumber.py | 739 | 4.1875 | 4 | # number guessing game
import random
guess = 0
computers_number = random.randint(0, 9)
print(computers_number)
condition = True
while condition:
user_guess = input("Guess the number (0-9) or exit: ")
if user_guess == "exit":
print("Hope to see you again.")
condition = False
elif computers_... | true |
6f68500287c37a8c41121dba41b4ace190e8460c | cyxorenv/Test | /Numbers.py | 686 | 4.40625 | 4 | # In python there is three types of numbers:
# =----------------------------------------=
# 1) x = 1 int (Integer)
# 2) y = 1.1 float (a decimal point)
# 3) z = 1 + 2j (Complex numbers)
# Standart arithmetic in python - (and any outher programming languige).
# Addition
print(10 + 3)
# Sustruction
print(10 - 3)
# M... | true |
e782dec2b7611e67f0c732cb21fc82c077d0f81f | rajiv25039/love-calculator | /main.py | 1,073 | 4.1875 | 4 | # 🚨 Don't change the code below 👇
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
combined_name = name1 + name2
combined_name_in_lower_case = combined_name.lower()
t = com... | true |
0b4e6205d0c646eb976e18ff1bbc97c52a018a5a | Takate/hangman | /hangman_0.1.py | 2,953 | 4.125 | 4 | import random
rerun = "Yes"
while rerun == "Yes" or "Y" or "yes" or "YES":
listOfWords = ["test"]
guessWord = random.choice(listOfWords)
guessWordList = list(guessWord)
#print(guessWordList)
letterIs = []
board = [" * " for char in guessWord]
difficulty = input("\n easy - 15... | true |
b3002a921b6eccc3c318b66b5e242279b853c02b | kvssea/Python-Challenges | /palindrome.py | 845 | 4.5 | 4 | '''Create a program, palindrome.py, that has a function that takes one string argument and prints a sentence indicating if the text is a palindrome. The function should consider only the alphanumeric characters in the string, and not depend on capitalization, punctuation, or whitespace.
If your string is a palindr... | true |
2df2ddc83610a326d4e5adbc825e12351a4cd630 | a200411044/Python_Crash_Course | /name.py | 278 | 4.21875 | 4 | #This show how to format your name in Python!
name = "simon law"
print(name.title())
print(name.upper())
print(name.lower())
first_name = "simon"
last_name = "law"
full_name = first_name + " " + last_name
print(full_name)
msg = "Hello, " + full_name.title() + "!"
print(msg)
| true |
049d58de078d51cbd6f07ec4f9f6db77ce41842a | Ayetony/python-parallel-training | /basic/futures_executor.py | 1,718 | 4.21875 | 4 | """
线程池和进程池是用于优化和简化线程或者进程的使用。
通过池提交任务给executor
池由两部分组成,一个是内部的队列,存放着执行的任务,另一部分是一些列的进程或者线程,用于执行
这些任务。池的的主要目的是为了重用。
"""
import concurrent.futures
import time
number_list = [1, 2, 3, 4, 5, 6, 7, 7, 9]
def evaluate_item(x):
result_item = count(x)
return result_item
def count(number):
for i in range(0, 100... | false |
7a2eaecdf76a8a44963109bd8fc595f5e660b7aa | mslok/SYSC3010_Michael_Slokar | /Lab-3/lab3-database-demo.py | 1,095 | 4.125 | 4 | #!/usr/bin/env python3
import sqlite3
#connect to database file
dbconnect = sqlite3.connect("mydatabase");
#If we want to access columns by name we need to set
#row_factory to sqlite3.Row class
dbconnect.row_factory = sqlite3.Row;
#now we create a cursor to work with db
cursor = dbconnect.cursor();
#execute insetr stat... | true |
f656fe862e4c13070c21cf18ecf10ea973e78681 | Ausduo/Hello_World | /french toast.py | 329 | 4.125 | 4 | print ("french toast")
bread = input ("enter bread size - thick or thin?")
bread = bread.lower ()
if bread == "thick":
print ("dunk the bread a long time")
elif bread == "thin":
print ("dunk the bread quickly")
else:
print ("don't do anything with it then")
print ("Thanks for following the help ... | true |
e3aed22a599977ea2b46f1f86b1c30241ae3b236 | pablosq83/Pruebas3 | /filtrar_palabras.py | 998 | 4.28125 | 4 | #!usr/bin/python
# -*- coding: utf -8 -*-
"""
Función que recibe como parámetros una lista de palabras y un entero, devolverá una lista de palabras cuya longitud sea mayor o igual al número entero pasado como parámetro. La función hará un filtrado de palabras de longitud n.
Autor: Pablo Sulbarán (psulbaran@cenditel.go... | false |
31f648d3a317b0c5a37d1147f04ac636121a653b | DracoNibilis/pands-problem-sheet | /weekday.py | 367 | 4.4375 | 4 | # Program that outputs whether or not today is a weekday.
# Author: Magdalena Malik
#list with weekend days
weekendDays = ["Saturday", "Sunday"]
#input for day
givenDay = input("enter a day: ")
#if statement that checking if day is weekday or weekend
if givenDay in weekendDays:
print("It is the weekend, yay!")
e... | true |
228d2c3eeb296e07345ebf6304165ecfd8210593 | hclife/code-base | /lang/python/practices/fibo.py | 438 | 4.125 | 4 | #!/usr/bin/python
#Fibonacci numbers module
def fib1(n):
'''Print a Fibonacci series up to n.'''
a,b=0,1
while b<n:
print(b,end=' ')
a,b=b,a+b
print('')
def fib2(n):
'''List with a Fibonacci series up to n.'''
result=[]
a,b=0,1
while b<n:
result.append(b)
... | false |
e2c211c9354e0d90ca724b4cbb5ea9d466148f29 | hclife/code-base | /lang/python/practices/var.py | 245 | 4.25 | 4 | #!/usr/bin/env python3
i=5
print(i)
i=i+1
print(i)
print('Value is',i)
s='''This is a multi-line string.
This is the second line.'''
print(s)
t='This is a string. \
This continues the string.'
print(t)
width=20
height=5*9
print(width*height)
| true |
7fa4b69da07c842f00fa2598fabaf52908d44c81 | frazierprime/articles-and-papers | /project_euler/euler_nine.py | 790 | 4.5 | 4 | #!/usr/bin/env python3
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
# a^2 + b^2 = c^2
# For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.
MAX_VALUE = 1000
def is_pythagorean_triplet(a, b,... | false |
d744e8a5c0a5316d4690bee342c6a1ab1382d357 | QuinteroSantiago/OOP_Projects | /Learning/python_projects/bmi_app.py | 411 | 4.1875 | 4 | def bmi_app():
h = input('How tall are you?(cm)')
w = input('How much do you weigh?(kg)')
bmi = int(w)/((int(h)/100)**2)
print('Your bmi is {}'.format(round(bmi, 2)))
if bmi < 18.5:
print('You\'re underweight. Try to gain weight')
if bmi >= 18.5 and bmi <= 24:
print('You\'re in a healthy weight range')
else:... | false |
ffddaecc11fb57681fa5ce9fa520e16c0c5c86c1 | gitter-badger/python_me | /hackrankoj/ErrorAndException/incorrectregex.py | 780 | 4.28125 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
You are given a string S.
Your task is to find out whether S is a valid regex or not.
Input Format
The first line contains integer , the number of test cases.
The next lines contains the string .
Constraints
Output Format
Print "True" or "False" for each test case withou... | true |
177988f87f1086e04fe5120ce23f80d6899847ef | gitter-badger/python_me | /hackrankoj/strings/capitalize.py | 1,534 | 4.125 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Sample Input
hello world
Sample Output
Hello World
原以为很简单,print ' '.join([s.capitalize() for s in raw_input().split()])
但是就是错在 ' '这里,不一定每个单词之间只有一个空格。
例如hello world lol这种。
'''
"""
s=raw_input()
new_s=''
for i in range(len(s)):
if i == 0 or (s[i-1].isspace() and... | false |
be8529d67a52b67b19aaad17a5db59c203ab94d9 | gitter-badger/python_me | /hackrankoj/collections/namedtuple.py | 2,422 | 4.15625 | 4 | #!/usr/bin/python
#-*- coding: utf-8 -*-
'''
namedtuple
Code 01
>>> from collections import namedtuple
>>> Point = namedtuple('Point','x,y')
>>> pt1 = Point(1,2)
>>> pt2 = Point(3,4)
>>> dot_product = ( pt1.x * pt2.x ) +( pt1.y * pt2.y )
>>> print dot_product
11
就是给一个tuple 比如(1,2)赋予实际的意义,然后建立一个类,每一个元素对应一个属性,这里建立的是Po... | false |
cf3dc601aa03d39564d83b37a82b7fce8ab453ea | gitter-badger/python_me | /GUI/component/scrollbar.py | 2,558 | 4.34375 | 4 | #!/usr/bin/python
#-*- coding: utf-8 -*-
# File Name: scrollbar.py
# Created Time: Thu Mar 2 20:08:59 2017
__author__ = 'Crayon Chaney <mmmmmcclxxvii@gmail.com>'
from Tkinter import *
root = Tk()
scrollbar = Scrollbar(root)
scrollbar.pack(side = RIGHT,fill = Y)
#如果没有fill=Y的话,右边只显示了一段小框,但是没有滚动条,fill大概意思就是整条Y都填充
scro... | false |
9e4dbeae2f401eecfb50daa6f60f33ed8d53f7c7 | varun-va/Python-Practice-Scripts | /GeeksforGeeks/majority_element.py | 1,009 | 4.21875 | 4 | '''
Given an array arr[] of size N and two elements x and y, use counter variables to find which element appears most in the array, x or y.
If both elements have the same frequency, then return the smaller element.
Note: We need to return the element, not its count.
Example 1:
Input:
N = 11
arr[] = {1,1,2,2,3,3,4,... | true |
7f7c3d62a0a66664b05773bcde7c450291ad06d8 | jem441/OOP | /final.py | 1,140 | 4.34375 | 4 | print("Today we will play a number game.") #Beginning of the game.
print("You will take a guess at a number and if you are correct, you win!")
from textblob import TextBlob #importing the TextBlob Python Library
inpt = input("Enter a number between 0-10:") #giving the user the option to guess a number
text = ... | true |
d2d92bb0c527585152f1e211ed3f68c669b12dd7 | Cole-Black/HW2 | /main.py | 1,101 | 4.1875 | 4 | # Author: Cole Black-Stallard cdb5655@psu.edu
# Collaborator: N/A *Solo*
def getGradePoint(Gin):
if Gin == "A":
grade = 4.0
elif Gin == "A-":
grade = 3.67
elif Gin == "B+":
grade = 3.33
elif Gin == "B":
grade = 3.0
elif Gin == "B-":
grade = 2.67
elif Gin == "C+":
grade = 2.33
elif... | false |
c07c8066bcd2b2a86c329f68d8c107e54a285dba | NiumXp/Algoritmos-e-Estruturas-de-Dados | /src/python/insertion_sort.py | 1,607 | 4.3125 | 4 | """Implementação do algoritmo insertion sort iterativo e recursivo."""
def insertion_sort_iterativo(vetor):
"""
Implementação do algoritmo de insertion sort iterativo.
Args:
vetor (list): lista que será ordenada.
Returns:
Retorna a lista ordenada.
"""
for i in range(1, len(ve... | false |
8a22aa66c7dcef600900898ee2f46bdc3cc4662b | NiumXp/Algoritmos-e-Estruturas-de-Dados | /src/python/busca_sequencial_recursiva.py | 696 | 4.21875 | 4 | """ Implementaçao do algoritmo de busca sequencial com recursão """
def busca_sequencial(valor, lista, index):
"""Busca sequencial recursiva.
Returns:
Retorna o indice do valor na lista.
Se nao encontrar retorna -1.
"""
if len(lista) == 0 or index == len(lista):
return -1
if lista... | false |
1a2b9a0f8c147f10f8e376c1c70d76c4f9a4c8c0 | david2999999/Python | /Archive/PDF/Sequences/Dictionaries.py | 2,674 | 4.84375 | 5 | def main():
# When you first assign to menus_specials , you ’ re creating an empty dictionary with the curly braces.
# Once the dictionary is defined and referenced by the name, you may start to use this style of
# specifying the name that you want to be the index as the value inside of the square brackets,... | true |
241558933826203ee70c021dfb647c7d0fc07a35 | david2999999/Python | /Archive/PDF/Objects/Object-Basic.py | 2,414 | 4.34375 | 4 | # The methods that an object makes available for use are called its interface because these methods are
# how the program outside of the object makes use of the object. They ’ re what make the object usable.
# The interface is everything you make available from the object. With Python, this usually means that
# all of ... | true |
150b28dfc4fc10f049ae0c4cbbf4387e3fa85801 | david2999999/Python | /Archive/PDF/Basic/String.py | 926 | 4.1875 | 4 | # When you type a string into Python, you do so by preceding it with quotes. Whether these quotes are
# single ( ' ), double( '' ), or triple( " " " ) depends on what you are trying to accomplish. For the most part, you
# will use single quotes, because it requires less effort (you do not need to hold down the Shift ke... | true |
5aac6daec9b8beb2115fd5923584f8c1a506529c | david2999999/Python | /Archive/PDF/Decision/Comparison.py | 2,401 | 4.53125 | 5 | def main():
# Equality isn ’ t the only way to find out what you want to know. Sometimes you will want to know
# whether a quantity of something is greater than that of another, or whether a value is less than
# some other value. Python has greater than and less than operations that can be invoked with the ... | true |
addd83aecdb01324615304c312abed1698ce99f4 | david2999999/Python | /Archive/PDF/Function/Docstring.py | 1,651 | 4.3125 | 4 | # If you place a string as the first thing in a function, without referencing a name to the string, Python will
# store it in the function so you can reference it later. This is commonly called a docstring , which is short for
# documentation string .
# Documentation in the context of a function is anything written tha... | true |
4e7a9a3efd57c5866681b9a110af532252113c63 | Blak3Nick/MachineLearning | /venv/mulitple_linear_regression.py | 2,548 | 4.125 | 4 | # Multiple Linear Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 4].values
# Feature Scaling
"""from sklearn.preprocessing import Standar... | true |
45728d1d9df3c4df2a2a5c9c2ed33272c4576839 | brucez082/Car_rental | /Car_rental.Achieved.py | 2,575 | 4.25 | 4 | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Bruce Zhang
#
# Created: 06/09/2021
# Copyright: (c) Bruce Zhang 2021
# Licence: <your licence>
#------------------------------------------------------------------------... | true |
8d4de53103ef5ea2eceddc64eb3ddd7e1e6b3b3f | arianacabral/Introduction-to-Python | /Atividade 5/Q19.py | 422 | 4.1875 | 4 | # Escreva um programa que leia números até o usuário digitar -1. Ao final, informe quantos números foram lidos.
def conta_numeros(number):
cont = 1
while number != -1:
number = float(input("Informe um número:"))
cont += 1
return cont
input0 = float(input("Informe um núme... | false |
83f2011c420c5044dcc1eb7d31113d6f909547b5 | harrifeng/Python-Study | /Interviews/Coin_Change.py | 788 | 4.1875 | 4 | """
#####From [Geeksforgeeks](http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/)
Similar to CC150, just allow coin with 1, 3, 5 right now
Several ways to ask
1. How many ways?
2. What are the ways?
3. Minimum coin number?
"""
# This is same to Combination Sum I
def coin_change(value):
res = [0,... | true |
7453a346480da9046278fb4f146b14c87bd9efa3 | Triballian/simprad | /src/main.py | 2,935 | 4.1875 | 4 | '''
Created on Mar 19, 2016
insprired by Curious Cheetah and Sergio
http://curiouscheetah.com/BlogMath/simplify-radicals-python-code/
http://stackoverflow.com/questions/31217274/python-simplifying-radicals-not-going-well
@author: Noe
'''
from math import modf
from math import sqrt
#from os import system
#... | true |
5b0fd08acefba8f2d7d2a934a1dcba2d34aa0cf0 | deepcloudlabs/dcl162-2020-sep-09 | /module02-functional.programming.in.python/exercise05.py | 369 | 4.125 | 4 | numbers = [3, 5, 7, 9, 4, 8, 15, 16, 23, 42]
is_there_any_odd_number = False
is_odd = lambda num: num % 2 == 1
def fun(num):
print(f"fun({num})")
return num % 2 == 1
for num in numbers:
if is_odd(num):
is_there_any_odd_number = True
break
print(is_there_any_odd_number)
# print(any(map(... | false |
ad1dad840114284987b3e4a9f3aadaf8aa3b1c97 | managorny/python_basic | /homework/les04/file1.py | 834 | 4.25 | 4 | """
1. Реализовать скрипт, в котором должна быть предусмотрена функция расчета заработной платы сотрудника.
В расчете необходимо использовать формулу: (выработка в часах * ставка в час) + премия.
Для выполнения расчета для конкретных значений необходимо запускать скрипт с параметрами.
"""
from sys import argv
def fu... | false |
a863fd271a218cd39128ad624985bf64cc22c7b1 | rogerlinh/MindXSchool.github.io | /Teachingteam/Gen12X/VuongTranLuc_8/q6.py | 351 | 4.25 | 4 | # Add number at the end of a list
numberList = [1, 2, 3, 4,5]
print('Hi there, this is our sequences: ')
for number in numberList:
print(number, end=' ')
print()
newNumber = int(input('what do you want to add: '))
numberList.append(newNumber)
print('This is our new sequence: ')
for number in numberList:
... | true |
1b9e709c6242628f43f892a6ed12e260f35dcfad | dishantsethi1/python-practise | /regularexpression.py | 885 | 4.125 | 4 | import re
s="take 5 one 1-13-2020 idea .one idea 2 5 at a time"
#result=re.search(r'o\w\w',s) #\w means any character means after o any two characters
#print(result.group()) #re.search shows only first one
result=re.findall(r'o\w\w',s) #re.findall will shoe every ehi... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.