blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
d6846c5fdeaf0b2680e0ab99ab31480a1bf093aa | manchenkoff/geekbrains-python-homework | /lesson01/task04.py | 634 | 4.1875 | 4 | """
Пользователь вводит целое положительное число.
Найдите самую большую цифру в числе.
Для решения используйте цикл while и арифметические операции.
"""
user_input = input("Введите число >>> ")
if not user_input.isdigit():
print("Неверный формат числа")
exit()
number = int(user_input)
max_num = 0
while num... | false |
de7f58a8084ee33e834c6487c65ef0cf13a19913 | Md-Hiccup/Problem-Solving | /HackerRank/Rank/easy/symmetric_difference.py | 2,623 | 4.125 | 4 | """
a new data type: sets.
Concept:
If the inputs are given on one line separated by a space character, use split() to get the separate values in the form of a list:
>> a = raw_input()
5 4 3 2
>> lis = a.split()
>> print (lis)
['5', '4', '3', '2']
If the list values are all integer types, use the map() method to conve... | true |
acfbd6ce55de265ead5aa37b15d13d6ad78c6060 | Md-Hiccup/Problem-Solving | /HackerRank/Rank/easy/any_or_all.py | 719 | 4.125 | 4 | """
any():
This expression returns True if any element of the iterable is true.
If the iterable is empty, it will return False.
all():
This expression returns True if all of the elements of the iterable are true. If the iterable is empty, it will return True.
Prob: Print True if all the conditions of the problem s... | true |
1ef078d6c92399bc43e5737112cf6d41105963de | Md-Hiccup/Problem-Solving | /HackerRank/Rank/easy/collection_namedtuple.py | 924 | 4.4375 | 4 | """
collections.namedtuple()
Basically, namedtuples are easy to create, lightweight object types.
They turn tuples into convenient containers for simple tasks.
With namedtuples, you don’t have to use integer indices for accessing members of a tuple.
Example:
>>> from collections import namedtuple
>>> Point = namedtu... | true |
c2c0745b71a66464daf21d104a2831c38de9d9bb | ErenBtrk/Python-Fundamentals | /Numpy/NumpyStrings/Exercise16.py | 313 | 4.125 | 4 | '''
16. Write a NumPy program to count the lowest index of "P" in a given array, element-wise.
'''
import numpy as np
np_array = np.array(['Python' ,'PHP' ,'JS' ,'examples' ,'html'])
print("\nOriginal Array:")
print(np_array)
print("count the lowest index of ‘P’:")
r = np.char.find(np_array, "P")
print(r) | true |
339a24e71cbd4b32a815332c1ad9426a1d99c335 | ErenBtrk/Python-Fundamentals | /Python Operators/4-ComparisonOperatorsExercises.py | 1,368 | 4.34375 | 4 | #1 - Prompt user to enter two numbers and print larger one
number1 = int(input("Please enter a number : "))
number2 = int(input("Please enter a number : "))
result = number1 > number2
print(f"number1 : {number1} is greater than number2 : {number2} => {result}")
#2 - Prompt user to enter 2 exam notes and calculate avera... | true |
b9d440a9aafd661b1d1ed641cc8921e5e24ebd02 | ErenBtrk/Python-Fundamentals | /Numpy/NumpyLinearAlgebra/Exercise14.py | 256 | 4.1875 | 4 | '''
14. Write a NumPy program to compute the condition number of a given matrix.
'''
import numpy as np
m = np.array([[1,2],[3,4]])
print("Original matrix:")
print(m)
result = np.linalg.cond(m)
print("Condition number of the said matrix:")
print(result) | true |
b99c2578051bef4298f3c7110ac76b9b3c0c9063 | ErenBtrk/Python-Fundamentals | /Numpy/NumpyLinearAlgebra/Exercise10.py | 270 | 4.125 | 4 | '''
10. Write a NumPy program to find a matrix or vector norm.
'''
import numpy as np
v = np.arange(7)
result = np.linalg.norm(v)
print("Vector norm:")
print(result)
m = np.matrix('1, 2; 3, 4')
print(m)
result1 = np.linalg.norm(m)
print("Matrix norm:")
print(result1) | true |
d888cf76ca3c466760c7c6397a7c056aa44f9368 | ErenBtrk/Python-Fundamentals | /Python Conditional Statements/4-IfElseExercises2.py | 2,940 | 4.46875 | 4 | #1- Prompt the user to enter a number and check if its between 0-100
number1 = int(input("Please enter a number : "))
if(number1>0) and (number1<100):
print(f"{number1} is between 0-100")
else:
print(f"{number1} is NOT between 0-100")
#2- Prompt the user to enter a number and check if its positive even number
... | true |
31e0a2c1b41f587b63bb213ebda6c68d96d83d36 | ErenBtrk/Python-Fundamentals | /Pandas/PandasDataSeries/Exercise13.py | 289 | 4.15625 | 4 | '''
13. Write a Pandas program to create a subset of a given series based on value and condition.
'''
import pandas as pd
pd_series = pd.Series([1,2,3,4,5])
print(pd_series)
relationalVar = pd_series > 3
new_series = pd_series[relationalVar]
new_series.index = [0,1]
print(new_series) | true |
66c7b75d33b882e78fc35a61720bd25ded68c7cf | ErenBtrk/Python-Fundamentals | /Numpy/NumpyStatistics/Exercise13.py | 515 | 4.4375 | 4 | '''
13. Write a Python program to count number of occurrences of each value
in a given array of non-negative integers.
Note: bincount() function count number of occurrences of each value
in an array of non-negative integers in the range of the array between
the minimum and maximum values including the values that did ... | true |
a8f9a363b9710a8f7c3941e34a99ef9c9da89bd8 | ErenBtrk/Python-Fundamentals | /Pandas/PandasDataframe/Exercise21.py | 362 | 4.34375 | 4 | '''
21. Write a Pandas program to iterate over rows in a DataFrame.
'''
import pandas as pd
import numpy as np
import pandas as pd
import numpy as np
exam_data = [{'name':'Anastasia', 'score':12.5}, {'name':'Dima','score':9}, {'name':'Katherine','score':16.5}]
df = pd.DataFrame(exam_data)
for index, row in df.iterro... | false |
dd07c492b76d1079edc9f2e76dbd71de44c55f9e | ErenBtrk/Python-Fundamentals | /Pandas/PandasDataframe/Exercise61.py | 453 | 4.3125 | 4 | '''
61-Write a Pandas program to get topmost n records within each group of a DataFrame.
'''
import pandas as pd
d = {'col1': [1, 2, 3, 4, 7, 11], 'col2': [4, 5, 6, 9, 5, 0], 'col3': [7, 5, 8, 12, 1,11]}
df = pd.DataFrame(data=d)
print("Original DataFrame")
print(df)
print("\ntopmost n records within each group of a... | false |
2461f2c598528a6a45b35da2708517717532fd3a | ErenBtrk/Python-Fundamentals | /Pandas/PandasDataframe/Exercise53.py | 425 | 4.5 | 4 | '''
53. Write a Pandas program to insert a given column at a specific column index in a DataFrame.
'''
import pandas as pd
d = {'col2': [4, 5, 6, 9, 5], 'col3': [7, 8, 12, 1, 11]}
df = pd.DataFrame(data=d)
print("Original DataFrame")
print(df)
new_col = [1, 2, 3, 4, 7]
# insert the said column at the beginning in ... | true |
789d52f7c4e9b6fd3a91586d188bd06fec4da709 | ErenBtrk/Python-Fundamentals | /Numpy/NumpyRandom/Exercise13.py | 288 | 4.4375 | 4 | '''
13. Write a NumPy program to find the most frequent value in an array.
'''
import numpy as np
x = np.random.randint(0, 10, 40)
print("Original array:")
print(x)
print("Most frequent value in the above array:")
print(np.unique(x))
print(np.bincount(x))
print(np.bincount(x).argmax()) | true |
dcecd4f5f65e24e8bcf2bb130d180b590c3aae74 | ErenBtrk/Python-Fundamentals | /Pandas/PandasDataSeries/Exercise24.py | 311 | 4.25 | 4 | '''
24. Write a Pandas program convert the first and last character
of each word to upper case in each word of a given series.
'''
import pandas as pd
import numpy as np
pd_series = pd.Series(["kevin","lebron","kobe","michael"])
print(pd_series.map(lambda x: x[0].upper() + x[1:-1] + x[-1].upper() ))
| true |
5feffbf991ad5558f23181cdce21396930a98fb5 | ErenBtrk/Python-Fundamentals | /Python Object-Oriented Programming/3-ClassMethods.py | 1,428 | 4.1875 | 4 | #class
class Person:
#pass #keyword for classes without attributes or methods
#class attributes
adress = "No information"
#constructor
def __init__(self,name,year):
#object attributes
self.name = name
self.year = year
print("init method is working.")
#inst... | false |
68131c94887ff1da6069d0a22c3a07352769ea24 | ErenBtrk/Python-Fundamentals | /Numpy/NumpyLinearAlgebra/Exercise1.py | 304 | 4.40625 | 4 | '''
1. Write a NumPy program to compute the multiplication of two given matrixes.
'''
import numpy as np
np_matrix1 = np.arange(0,15).reshape(5,3)
print(np_matrix1)
np_matrix2 = (np.ones(9,int)*2).reshape(3,3)
print(np_matrix2)
print(f"Multiplication of matrixes :\n{np.dot(np_matrix1,np_matrix2)}")
| true |
5802078b29d8753c500cf7d3793bc5e9cf76742b | ErenBtrk/Python-Fundamentals | /Python Object-Oriented Programming/4-Inheritance.py | 1,295 | 4.1875 | 4 | # Inheritance :
# Person => name , lastname , age , eat() , run() , drink()
# Student(Person),Teacher(Person)
#Animal => Dog(Animal),Cat(Animal)
class Person():
def __init__(self,firstName,lastName):
self.firstName = firstName
self.lastName = lastName
print("Person created")
def who... | false |
a82bd7fba196142b95745e0fef2c83054557c2cb | ErenBtrk/Python-Fundamentals | /Numpy/NumpySortingAndSearching/Exercise1.py | 407 | 4.5 | 4 | '''
1. Write a NumPy program to sort a given array of shape 2
along the first axis, last axis and on flattened array.
'''
import numpy as np
a = np.array([[10,40],[30,20]])
print("Original array:")
print(a)
print("Sort the array along the first axis:")
print(np.sort(a, axis=0))
print("Sort the array along the last ax... | true |
58663499fffaf60cef97fe20896338a49cf40112 | ErenBtrk/Python-Fundamentals | /Pandas/PandasDataSeries/Exercise8.py | 468 | 4.3125 | 4 | '''
8. Write a Pandas program to convert the first column of a DataFrame as a Series.
'''
import pandas as pd
dict1 = {
"First Name" : ["Kevin","Lebron","Kobe","Michael"],
"Last Name" : ["Durant","James","Bryant","Jordan"],
"Team" : ["Brooklyn Nets","Los Angeles Lakers","Los Angeles Lakers","... | false |
924527cad45d7f7c910fc4658a0b60b50517dbc3 | anshu9/LeetCodeSolutions | /easy/add_digits.py | 796 | 4.21875 | 4 | """
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
Follow up:
Could you do it without any loop/recursion in O(1) runtime?
"""
def add_digits_... | true |
d8601e88783790f690dfa9dd73aee6bc2f7d4527 | damiangene/Practice-assignments | /2. Control, For, If, While/Firstday.py | 900 | 4.125 | 4 | year1= int(input("What is the first year?"))
year2= int(input("What is the second year?"))
for year in range(year1,year2+1):
#day = R(1 + 5R(Year − 1, 4) + 4R(Year − 1, 100) + 6R(Year − 1, 400), 7)
day6 = 6*((year - 1)%400)
#print (day6)
day4 = 4*((year - 1)%100)
#print (day4)
day5 = 5*(... | false |
67334c8d4146f1c8ba8580a5c95039a163e4bec2 | juliancomcast/100DaysPython | /Module1/Day09/day09_indexing.py | 1,121 | 4.5 | 4 | #specific items can be retrieved from a list by using its indicies
quotes = ["Pitter patter, let's get ar 'er", "Hard no!", "H'are ya now?", "Good-n-you", "Not so bad.", "Is that what you appreciates about me?"]
print(quotes[0])
print(f"{quotes[2]}\n\t {quotes[3]}\n {quotes[4]}")
#slicing uses the format [start:stop:s... | true |
4fe297d8354295929f95c9f78e80dd4c90e131d1 | juliancomcast/100DaysPython | /Module1/Day11/day11_augAssign.py | 811 | 4.59375 | 5 | #An augmented assignment improves efficiency because python can iterate a single variable instead of using a temporary one.
#There are several types of augmented assignment operators:
# += : Addition
# -= : Subtraction
# *= : Multiplication
# /= : Division
# //= : Floor Division
# %= : Remainder/Modulus
# **= : Exponen... | true |
dc853f47647cfa8185eeded8b7b4abd458463413 | jpike/PythonProgrammingForKids | /BasicConcepts/Functions/FirstFunction.py | 828 | 4.4375 | 4 | # This is the "definition" of our first function.
# Notice the "def" keyword, the function's name ("PrintGreeting"),
# the parentheses "()", and the colon ":".
def PrintGreeting():
# Here is the body of our function, which contains the block
# or lines of code that will be executed when our function is
# ca... | true |
5a63befb4bb2b1b00552c54b2416ad8c1da0b99e | jpike/PythonProgrammingForKids | /BasicConcepts/SyntaxErrors/Volume1_Chapter3_SyntaxErrors.py | 689 | 4.125 | 4 | # String variable statements with syntax errors.
string variable = 'This line should have a string variable.'
1string_variable_2 = "This line should have another string variable."
another_string_variable = 'This line has another string variable."
yet_another_string_variable = "This line has yet another string variable.... | true |
4cf02d87043e701ed04156a935e710a10f54e7a0 | techacker/Hackerank | /commandlistchallenge.py | 1,279 | 4.21875 | 4 | print('The program performs the given function on a list in a recursive manner.')
print('First enter an "Integer" to tell how many functions you would like to do.')
print('Then enter the command with appropriate values.')
print()
print('Enter an integer.')
N = int(input())
z = []
def operation(inst, item, ind):
if... | true |
68571bcf57eaa90a749cfbeaa39e613e6aeaa7f6 | techacker/Hackerank | /calendarModule.py | 392 | 4.125 | 4 | # Task
# You are given a date. Your task is to find what the day is on that date.
# Input Format
# A single line of input containing the space separated month, day and year, respectively, in MM DD YYYY format.
import calendar
s = input().split()
m = int(s[0])
d = int(s[1])
y = int(s[2])
day = calendar.weekday(y,m,d... | true |
3215b0ada68e50621452d257cac18e767d0239e6 | techacker/Hackerank | /alphabetRangoli.py | 811 | 4.25 | 4 | # You are given an integer, N.
# Your task is to print an alphabet rangoli of size N.
# (Rangoli is a form of Indian folk art based on creation of patterns.)
#
# Example : size 5
#
# --------e--------
# ------e-d-e------
# ----e-d-c-d-e----
# --e-d-c-b-c-d-e--
# e-d-c-b-a-b-c-d-e
# --e-d-c-b-c-d-e--
# ---... | true |
0b0dcbc0b619f5ce51dd55a65a7ede07dfbb5695 | Joeshiett/beginner-python-projects | /classes_example.py | 633 | 4.125 | 4 | class Person: # Instantiate class person as blueprint to create john and esther object
def __init__(self, name, age):
self.name = name
self.age = age
def walking(self): #defining of behaviour inside of class indentation
print(self.name +' ' + 'is walking...')
def speaking(self)... | true |
7d890451efc7b5a59dbf4e0a774223033e2f8aec | Rosa-Palaci/computational-thinking-for-engineering | /semana-3/class-11/mayores-prueba1.py | 1,103 | 4.125 | 4 | #INSTRUCCIONES:
# Define una función que recibe tres números
# enteros y regresa los número ordenados de
# menor a mayor.
# Haz la prueba con dos tercias de números
def orden_asc(a, b, c):
if a > b and a > c:
mayor = a
if b > c:
medio = b
menor = c
else: #Signific... | false |
3f8cd4a99aeffc1420bf4dd4c9af2f1b487914f7 | Jonie23/python-calculator | /calculator.py | 2,095 | 4.375 | 4 | #welcome user
def welcome():
print('''
Welcome to Jones's calculator built with python
''')
welcome()
# calculator()
#define a function to run program many times
def calculator():
#ask what operation user will want to run
operation = input('''
Please type in the calculator operation you will want... | true |
4d7a1ccf22595544dfedd57e7cc2181d18013d5c | milan-crypto/PRACTICE_PYTHON | /Divisors.py | 503 | 4.3125 | 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.)
number = int(input("Please choose a n... | true |
68247317c0145405a949c82d10f08dd4d535bd52 | dhirajMaheswari/findPhoneAndEmails | /findPhonesAndEmails.py | 1,853 | 4.4375 | 4 | '''this code makes use of the command line to find emails and/or phones from supplied text file
or text using regular expressions.
'''
import argparse, re
def extractEmailAddressesOrPhones(text, kKhojne = "email"):
''' this function uses the regular expressions to extract emails from the
supplie... | true |
04f9b9e623652aff89ff6261069df137c4e48c25 | ManishVerma16/Data_Structures_Learning | /python/recursion/nested_recursion.py | 226 | 4.125 | 4 | # Recursive program to implement the nested recursion
def nestedFun(n):
if (n>100):
return n-10
else:
return nestedFun(nestedFun(n+11))
number=int(input("Enter any number: "))
print(nestedFun(number)) | true |
88db8f87b369d7626c0f2e0466e60cc73b1d11cc | BrettMcGregor/coderbyte | /time_convert.py | 499 | 4.21875 | 4 | # Challenge
# Using the Python language, have the function TimeConvert(num)
# take the num parameter being passed and return the number of
# hours and minutes the parameter converts to (ie. if num = 63
# then the output should be 1:3). Separate the number of hours
# and minutes with a colon.
# Sample Test Cases
#
# Inp... | true |
6eb3619bec8465aab552c5ad9043447217d81334 | BrettMcGregor/coderbyte | /check_nums.py | 578 | 4.1875 | 4 | # Challenge
# Using the Python language, have the function CheckNums(num1,num2)
# take both parameters being passed and return the string true if num2
# is greater than num1, otherwise return the string false. If the
# parameter values are equal to each other then return the string -1.
# Sample Test Cases
#
# Input:3 &... | true |
1645c0e1b348decce12680b6e3980b659f87c82a | RahulBantode/Pandas_python | /Dataframe/application-14.py | 702 | 4.40625 | 4 | '''
Write a program to delete the dataframe columns by name and index
'''
import pandas as pd
import numpy as np
def main():
data1 = [10,20,30,40]
data2 = ["a","b","c","d"]
data3 = ["jalgaon","pune","mumbai","banglore"]
df = pd.DataFrame({"Int":data1,"Alpha":data2,"city":data3})
print(df)
... | true |
717593f18f04b22e4a10c90c6ae6328ab3bd42df | RahulBantode/Pandas_python | /Dataframe/application-7.py | 732 | 4.15625 | 4 | #Write a program to create a dataframe using pandas series.
import pandas as pd
import matplotlib.pyplot as plt
def main():
Author = ["Rahul","Nitin","Kunal","Mohit"]
b_price = [900,450,740,100]
Article = ["C-lang","Java-lang","Flutter","Native-core"]
auth_series = pd.Series(Author)
book_series ... | false |
141abe7dfe844acd5ce5f999880197ce266a2865 | ziyadedher/birdynet | /src/game/strategy.py | 2,091 | 4.1875 | 4 | """This module contains strategies used to play the game."""
import random
import pygame
from game import config
class Strategy:
"""Defines an abstract strategy that can be built on."""
def __init__(self) -> None:
"""Initialize this abstract strategy.
Do not initialize an abstract strateg... | true |
28287d94a090ac3b9643a8d652896bd534211c0d | k501903/pythonstudy | /C01_dict.py | 771 | 4.125 | 4 | # -*- coding: utf-8 -*-
# 字典dict
grades = {'Michael': 95, 'Bob': 75, 'Tracy': 85}
print(grades['Tracy'])
# 添加
grades['Adam'] = 67
print(grades['Adam'])
# 修改
grades['Adam'] = 66
print(grades['Adam'])
# 删除
grades.pop('Adam')
print(grades)
# 判断是否存在
if 'Thomas' in grades:
print(grades['Thomas'])
else:
grades['Thoma... | false |
c65710674d3194cd7a5453a490660d898118f7b8 | k501903/pythonstudy | /C03_Iteration.py | 832 | 4.25 | 4 | # -*- coding: utf-8 -*-
# 迭代器
# 迭代对象Iterable
from collections import Iterable
print('[]是Iterable吗? ', isinstance([], Iterable))
print('{}是Iterable吗? ', isinstance({}, Iterable))
print('abc是Iterable吗? ', isinstance('abc', Iterable))
print('(x for x in range(10))是Iterable吗? ', isinstance((x for... | false |
dadaab812f4ce7ee2e0a5a95436088f109a0a63d | saadhasanuit/Lab-04 | /question 11.py | 487 | 4.125 | 4 | print("Muhammad Saad Hasan 18B-117-CS Section:-A")
print("LAB-04 -9-NOV-2018")
print("QUESTION-11")
# Program which calculates the vowels from the given string.
print("This program will count total number of vowels from user defined sentence")
string=input("Enter your string:")
vowels=0
for i in string:
if(... | true |
877a89267774f79b7b4516e112c8f73a1ebad162 | MariyaAnsi/Python-Assignments | /Assignment_5.py | 363 | 4.34375 | 4 | #Write a program that prompts for a file name, then opens that file and reads through the file,
#and print the contents of the file in upper case.
fname = input("Enter file name: ")
fh = open(fname)
print("fh___", fh)
book = fh.read()
print("book___", book)
bookCAPITAL = book.upper()
bookCAPITALrstrip = boo... | true |
e23db0c2b2df63611d1066b76cf1606fd40852ba | TewariUtkarsh/Python-Programming | /Tuple.py | 553 | 4.1875 | 4 | myCars = ("Toyota","Mercedes","BMW","Audi","BMW") #Tuple declared
print("\nTuple: ",myCars)
# Tuple has only 2 built in functions:
# 1.count()- To count the number of Element ,that is passed as the Parameter, in the Tuple
print("\nNumber of times BMW is present in the Tuple: ",myCars.count("BMW"))
print("Number... | true |
6717306792716cbc062e400eeb7c6d434f28544a | gorkememir/PythonProjects | /Basics/pigTranslator.py | 1,160 | 4.21875 | 4 | # Take a sentence from user
original = input("Please enter a sentence: ").strip().lower()
# Split it into words
splitted = original.split()
# Define a new list for storing the final sentence
new_words = []
# Start a for loop to scan all the splitted words one by one
for currentWord in splitted:
# If the first l... | true |
a23034a6ada538ad5c35ec45b514900a68183d1f | GospodinJovan/raipython | /Triangle.py | 1,234 | 4.5625 | 5 | """""
You are given the lengths for each side on a triangle. You need to find all three angles for this triangle. If the given side lengths cannot form a triangle
(or form a degenerated triangle), then you must return all angles as 0 (zero). The angles should be represented as a list of integers in ascending order.
Eac... | true |
6681c74eed15a86ce699efb6e28cbf1e98630cfb | bipuldev/US_Bike_Share_Data_Analysis | /Bike_Share_Analysis_Q4a.py | 2,117 | 4.4375 | 4 | ## import all necessary packages and functions.
import csv # read and write csv files
from datetime import datetime # operations to parse dates
from pprint import pprint # use to print data structures like dictionaries in
# a nicer way than the base print function.
def number_of_trips(fil... | true |
d59a3a58b3cc73976c685c0e634fea373283868c | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day05/集合/demo01_集合的定义.py | 1,731 | 4.4375 | 4 | """
集合: set
python的基础数据类型之一;
定义: 用于存储一组无序的不重复的数据;
特点:
1. 集合是无序的;
2. 集合中的元素是不重复的, 唯一的;
3. 集合中存储的数据必须是不可变的数据类型;
4. 集合是可变的数据类型;
语法:
set1 = {1, 2, 3} # int --> 不可变
增加:
add()
update() 参数: 可迭代对... | false |
d5cb46d19ae0577089f571658d80240e5237ca21 | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day05/集合/demo02_集合中的数学运算.py | 917 | 4.25 | 4 | """
集合中的数学运算
交集: 取的公共部分 & intersection
并集: 取的是所有部分,不包括重复数据 | union
差集: 第一个集合有的,第二个集合没有的 - difference
反交集: 跟交集反着 取的非公共部分 ^ symmetric_difference
子集: 判断某个集合是不是另一个集合的子集 set1 < set2 issubset
超集:
"""
set1 = {1, 2, 3, 4}
set2 = {3, 4, 5, 6}
print(set1 & set2) # {3... | false |
22b535c891b0c5a719870142dc9a765417f963f5 | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day09/demo07_类属性练习.py | 1,108 | 4.21875 | 4 | """
1. 写一个类, 这个可以记录产生对象的个数
2. 写个游戏类:
1. 记录历史最高分
2. 传入当前玩家姓名, 随机玩家分数
3. 获取历史最高分
"""
import random
class Person:
count = 0 # 不可变数据类型的类属性, 记录产生对象的个数
def __init__(self):
Person.count += 1
p1 = Person()
p2 = Person()
p3 = Person()
print(p2.count)
class Game:... | false |
c4cc79727967ed588676506a3a865445f06682cb | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day09/demo03_init方法初始化实例变量.py | 1,135 | 4.46875 | 4 | """
1. 创建对象的过程:p1 = Person()
1. 开辟内存,存储对象
2. 自动调用了init方法
2. 实例变量:
初始化实例变量, 初始化对象的属性;
实例变量: 对象的变量 --> 对象属性;
实例变量 归对象所有, 每个对象都有一份, 对象之间互不影响;
self.变量名 --> 表示实例变量(实例属性)
3. init
默认情况下啥事也没干;
一般情况下,会在init... | false |
266ad53bb1950c25ff582bfe6bb710290947c8f8 | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day10/demo08_多层继承.py | 743 | 4.15625 | 4 | """
多继承:
子类具有多个父类的情况; 子类可以继承多个父类的功能;
python: (继承的传递)
多层继承: 子类 --> 父类 --> 爷爷类 --> 祖先类 ---> object类
"""
class A:
def func1(self):
print("我是A中func1中的方法...")
class B(A):
def func2(self):
print("我是B中的func2的方法...")
# def func1(self):
# print("我是B中的fun... | false |
67a7ca9faf0d06210928aa7da6ed28a3e47dc8f6 | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day04/demo03_字符串的切片.py | 1,710 | 4.34375 | 4 | """
1. 字符串的拼接
+ : "abc" + "def" ---> "abcdef"
* : "李现" * 3 ---> "李现李现李现"
2. 字符串的长度
容器: 字符元素
python的内置函数len(): 获取变量的长度;
3. 切片:slice
通过切片操作获取字符串中的一部分数据;
格式:
字符串[start : stop : step]
start: 起始值, 索引值
stop: 结束值, 索引值
... | false |
006d4318ecc5f77efd912464de98ef2cf852dd42 | NataliaBeckstead/cs-module-project-recursive-sorting | /src/searching/searching.py | 1,278 | 4.40625 | 4 | # TO-DO: Implement a recursive implementation of binary search
def binary_search(arr, target, start, end):
if start > end:
return -1
mid = (start + end) // 2
if arr[mid] == target:
return mid
elif target < arr[mid]:
return binary_search(arr, target, start, mid-1)
else:
... | true |
70dcd1ee1a606f67646d7e8f7f3862908e3a0c76 | JannickStaes/LearningPython | /TablePrinter.py | 1,061 | 4.21875 | 4 | #! python3
# prints a table of a list of string lists
tableDataExample = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]
def determineMaxColumnWidths(tableData):
columnWidths = [] #a list to store the max length of ea... | true |
af175e0913b72d5c984cd90490f8405d8843d258 | Hubert51/pyLemma | /Database_sqlite/SecondPart_create class/Test_simplify_function/class2.py | 1,440 | 4.125 | 4 | import sqlite3
class DatabaseIO:
l12 = [1, 2, 3]
d_table = {}
def __init__(self, name):
"""
In my opinion, this is an initial part. If I have to use variable from
other class, I can call in this part and then call to the following
part.
Some variable must be renamed... | true |
5a2dd5cb914cdbd397847ab8d77521e0612580e0 | shubhranshushivam/DSPLab_22-10-2020 | /ques8.py | 605 | 4.1875 | 4 | # 8. Find the Union and Intersection of the two sorted arrays
def union(arr1,arr2):
res=arr1+arr2
res=set(res)
return list(res)
def intersection(arr1, arr2):
res=[]
for i in arr1:
if i in arr2:
res.append(i)
return res
n1=int(input("Enter size of 1st array="... | true |
fd8b7a3eb61438223ca6563de920c9e7f8eab7a4 | jadenpadua/Data-Structures-and-Algorithms | /efficient/validParenthesis/validParenthesis.py | 1,772 | 4.125 | 4 | #Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
#imports functions from our stack data structure file
from stack import Stack
#helper method checks if our open one and closed are the same
def is_match(p1, p2):
if p1 == "(" and p2 == ")":
... | true |
3b98b69d8a5182fca01f3ceea90444eff427a5a6 | jadenpadua/Data-Structures-and-Algorithms | /bruteforce/largest_swap.py | 370 | 4.21875 | 4 | Write a function that takes a two-digit number and determines if it's the largest of two possible digit swaps.
To illustrate:
largest_swap(27) ➞ False
largest_swap(43) ➞ True
def largest_swap(num):
original = num
d = 0
rev = 0
while num > 0:
d = num % 10
num = int(num/10)
rev = rev*10 + d
if rev > origin... | true |
d6404fac5d7e72741972ade1038e83de849ac709 | jadenpadua/Data-Structures-and-Algorithms | /bruteforce/needleInHaystack.py | 564 | 4.25 | 4 | # Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
def strStr(haystack,needle):
for i in range(len(haystack) - len(needle) + 1):
if haystack[i:i+len(needle)] == needle:
return i
return - 1
haystack = "Will you be able to find the ne... | true |
3702a2e59ec372033ed9f0f3cb2aa2af7bc4653b | jadenpadua/Data-Structures-and-Algorithms | /bruteforce/alternating_one_zero.py | 626 | 4.46875 | 4 | Write a function that returns True if the binary string can be rearranged to form a string of alternating 0s and 1s.
Examples
can_alternate("0001111") ➞ True
# Can make: "1010101"
can_alternate("01001") ➞ True
# Can make: "01010"
can_alternate("010001") ➞ False
can_alternate("1111") ➞ False
def can_alternate(s):
... | true |
0ccbe214b5bc91d4c53e4f16218b0835b1b9d513 | jadenpadua/Data-Structures-and-Algorithms | /bruteforce/digits_in_list.py | 689 | 4.3125 | 4 | #Create a function that filters out a list to include numbers who only have a certain number of digits.
#Examples
#filter_digit_length([88, 232, 4, 9721, 555], 3) ➞ [232, 555]
# Include only numbers with 3 digits.
#filter_digit_length([2, 7, 8, 9, 1012], 1) ➞ [2, 7, 8, 9]
# Include only numbers with 1 digit.
#filter... | true |
84d5fef5a0c4f7de4606fcfb9ed1ee4909d00420 | ankitniranjan/The-Complete-Data-Structure-and-Algorithms-Course-in-Python-Udemy | /1.Recursion/fibonacci.py | 239 | 4.1875 | 4 | #!/usr/bin/env python3
def fibonacci(n):
assert n >= 0 and int(n) == n, "Input should be of integer type"
if n in [0, 1]:
return n
else:
return fibonacci(n-1) + fibonacci(n-2)
print(fibonacci(4))
#Output
3
| false |
80b15569f8adf836485424359c93bfaf7f87cfd3 | giovic16/Python | /solo9.py | 256 | 4.1875 | 4 | #Faça um Programa que peça a temperatura em graus Farenheit, transforme e mostre a temperatura em graus Celsius.
fahrenheit = int(input('Entre com a temperatura:'))
celsius = (fahrenheit-32)//1.8
print('A temperatura transofrmada é {}' .format(celsius)) | false |
67c62395c49f7327da7f66d2ab1d04b96886b53a | UnicodeSnowman/programming-practice | /simulate_5_sided_die/main.py | 565 | 4.1875 | 4 | # https://www.interviewcake.com/question/simulate-5-sided-die?utm_source=weekly_email
# You have a function rand7() that generates a random integer from 1 to 7.
# Use it to write a function rand5() that generates a random integer from 1 to 5.
# rand7() returns each integer with equal probability. rand5() must also ret... | true |
7443a894f9ca0f6e6276d36e49a12f27dbd76b80 | JITHINPAUL01/Python-Assignments | /Day_5_Assignment.py | 1,654 | 4.25 | 4 | """
Make a generator to perform the same functionality of the iterator
"""
def infinite_sequence(): # to use for printing numbers infinitely
num = 0
while True:
yield num
num += 1
for i in infinite_sequence():
print(i, end=" ")
"""
Try overwriting some default dunder methods and manipu... | true |
b461bf0edc931efe39b3f6a00dcf5f86e3dd2cf8 | lijianzwm/leetcode | /101.py | 1,021 | 4.125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 18/11/9 14:05
# @Author : lijian
# @Desc : https://leetcode.com/problems/symmetric-tree/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
clas... | false |
36a3aa0df6425f0876442c374eca48c0c709d592 | shahasifbashir/LearnPython | /ListOver/ListOverlap.py | 591 | 4.28125 | 4 | import random
#This Examples gives the union of two Lists
A = [1,2,3,4,5,6,7,8,5,4,3,3,6,7,8]
B=[6,7,8,9,4,3,5,6,78,97,2,3,4,5,5,6,7,7,8]
# we will use the set becouse a set contains unique elemets only ann then use an and operator
print(list(set(A)&set(B)))
# The same example using Random Lists
A= range(1,random.r... | true |
57992d8e576a9c5df264083e74d67b6d29ae00c9 | susanbruce707/Virtual-Rabbit-Farm | /csv_mod.py | 1,205 | 4.125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 13 00:27:26 2020
@author: susan
Module to read CSV file into nested dictionary and
write nested dictionar to CSV file
rd_csv requires 1 argument file, as file name for reading
wrt_csv requires 2 arguments file name and dictionary name to write CSV file.
"""
imp... | true |
29e7fdf995e4f6245899f4a61aac03ac1cac6426 | fadhilmulyono/cp1404practicals | /prac_09/sort_files_1.py | 910 | 4.25 | 4 | """
CP1404/CP5632 Practical
Sort Files 1.0
"""
import os
def main():
"""Sort files to folders based on extension"""
# Specify directory
os.chdir('FilesToSort')
for filenames in os.listdir('.'):
# Check if there are any files in directory
if os.path.isdir(filenames):
conti... | true |
6e6569c90097c6ae65b39aa6736e234fbf6f4bdf | BruderOrun/PY111-april | /Tasks/a0_my_stack.py | 798 | 4.1875 | 4 | """
My little Stack
"""
stak = []
def push(elem) -> None:
"""
Operation that add element to stack
:param elem: element to be pushed
:return: Nothing
"""
stak.append(elem)
def pop():
"""
Pop element from the top of the stack
:return: popped element
"""
if stak == []:
... | true |
7f72b1120e1a02c17ccc9113866e32cab1164830 | tjgiannhs/Milisteros | /GreekBot/greek_preprocessors.py | 1,609 | 4.15625 | 4 | """
Statement pre-processors.
"""
def seperate_sentences(statement):
'''
Adds a space after commas and dots to seperate sentences
If this results in more than one spaces after them another pre-processor will clean them up later
:param statement: the input statement, has values such as text
... | true |
24409c8cc7b6c497409449e8327e5f16a2162020 | qufeichen/Python | /asciiUni.py | 352 | 4.15625 | 4 | # program that prints out a table with integers from decimal 0 to 255, it's hex number, and the character corresponding to the unicode with UTF-8 encoding
# using a loop
for x in range(0, 256):
print('{0:d} {0:#04x} {0:c}'.format(x))
# using list comprehension
ll = [('{0:d} {0:#04x} {0:c}'.format(x)) for x in range(... | true |
859c35f9a9bcdcfbe3da843f8296b00f23c37f95 | ZhuXingWuChang/CollegePython | /pythonCrashCourse/chapter3/cars.py | 602 | 4.34375 | 4 | # 给sort()方法传入reverse=True参数,会使列表本身被修改(可变对象)
cars = ['bmw', 'audi', 'toyota', 'subaru']
cars.sort(reverse=True)
print(cars)
cars.sort()
print(cars)
# 使用sorted(ListName)方法,会返回一个新的排序后的列表(不可变对象)
cars = ['bmw', 'audi', 'toyota', 'subaru']
print("\nHere is the original list: ")
print(cars)
print("\nHere is the sorted list... | false |
f2a34668c27bc15c17545666e077ad857937c554 | PravinSelva5/LeetCode_Grind | /Dynamic Programming/BestTimetoBuyandSellaStock.py | 1,006 | 4.125 | 4 | '''
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit.
Note that you cannot sell a stock before you buy one.
-------
RES... | true |
e238362a9fe70015b725ea93b7d4ea60663dfcab | PravinSelva5/LeetCode_Grind | /RemoveVowelsFromAString.py | 1,081 | 4.21875 | 4 | '''
Given a string S, remove the vowels 'a', 'e', 'i', 'o', and 'u' from it, and return the new string.
Example 1:
Input: "leetcodeisacommunityforcoders"
Output: "ltcdscmmntyfrcdrs"
Example 2:
Input: "aeiou"
Output: ""
Runtime: 28 ms, faster than 75.93% of Python3 online submissions for Remove Vowels from a Stri... | true |
1f5c2a31e43d65a1bb470666f432c53b1e0bd8c9 | PravinSelva5/LeetCode_Grind | /SlidingWindowTechnique.py | 1,204 | 4.125 | 4 | # It is an optimization technique.
# Given an array of integers of size N, find maximum sum of K consecutive elements
'''
USEFUL FOR:
- Things we iterate over sequentially
- Look for words such as contiguous, fixed sized
- Strings, arrays, linked-lists
- Minimum, maximum, longest, shortest, co... | true |
41fa5b705be4a2f44f143a811186796fa94f9e01 | PravinSelva5/LeetCode_Grind | /Trees and Graphs/symmetricTree.py | 1,008 | 4.28125 | 4 | '''
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
-------------------
Results
-------------------
Time Complexity: O(N)
Space Complexity: O(N)
Runtime: 28 ms, faster than 93.85% of Python3 online submissions for Symmetric Tree.
Memory Usage: 14.4 MB, less than 52.06% ... | true |
7cabf6be4d6c2b465dcdcdfb75e83441fb8c1fd5 | PravinSelva5/LeetCode_Grind | /Linked_Lists/RemoveNthNodeFromEndOfList.py | 1,247 | 4.1875 | 4 | '''
Given the head of a linked list, remove the nth node from the end of the list and return its head.
BECASUE THE GIVEN LIST IS SINGLY-LINKED, THE HARDEST PART OF THIS QUESTION, IS FIGURING OUT WHICH NODE IS THE Nth ONE THAT NEEDS TO BE REMOVED
--------
RESULTS
--------
Time Complexity: O(N)
Space Complexity: O(1)
... | true |
9ee562a0c867c164558a362629732cd514632ca5 | PravinSelva5/LeetCode_Grind | /Array_101/MergeSortedArray.py | 1,051 | 4.21875 | 4 | '''
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Notes
The number of elements initialized in nums1 and nums2 are m and n respectively.
You may assume that nums1 has enough space (size that is equal to m + n) to hold additional elements from nums2.
Unfortunately had to r... | true |
4d8c4cd3b1005c20887c69c87e0b127c1b0189d5 | PravinSelva5/LeetCode_Grind | /Linked_Lists/MergeTwoSortedLists.py | 1,762 | 4.25 | 4 | '''
Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists.
Runtime: 40 ms, faster than 39.21% of Python3 online submissions for Merge Two Sorted Lists.
Memory Usage: 14.3 MB, less than 8.31% of Python3 online submissions for ... | true |
480fbd431ed529d6cc8b30ed2e902d271cea3d84 | dwkeis/self-learning | /day3_strategy_pattern/fries.py | 869 | 4.15625 | 4 | """is a test for factory model"""
class Fries():
"""define fries"""
def describe(self):
pass
class NoSalt(Fries):
"""define fries without salt"""
def __init__(self,flavor):
self.__name = flavor
def describe(self):
print("i am " + self.__name + " fries")
class Default(Fries)... | true |
146b1098deab1d4334990e51bfde7e2d75c8419c | IyvonneBett/Data-Science | /Lesson 3.py | 520 | 4.25 | 4 | # Looping...repeating a task n times eg playing music, generating payslip n times
# two types of while/ for loop
x = 1
while x <= 10: # n times
print('Increment..',x) # 1 to 10
x = x + 1 # Loop works with this update
#int(input('Enter some money'))
# another to print 10 to 1
y = 10
while y >= 1:
... | false |
bff349b3cf94bd9cf6fd561259023d81318d9773 | R0YLUO/Algorithms-and-Data-Structures | /data_structures/queue.py | 1,384 | 4.1875 | 4 | """Implementation of a queue using a python list"""
from typing import Generic, TypeVar
T = TypeVar('T')
class Queue(Generic[T]):
def __init__(self) -> None:
"""Instantiates an empty list"""
self.length = 0
self.list = []
def __len__(self) -> int:
"""Length of our queue"""
... | true |
36131e269728e7573a366ecde5bb68178834c161 | pranaymate/100Plus_Python_Exercises | /21.py | 1,152 | 4.25 | 4 | #~ 21. A website requires the users to input username and password to register. Write a program to check the validity of password input by users.
#~ Following are the criteria for checking the password:
#~ 1. At least 1 letter between [a-z]
#~ 2. At least 1 number between [0-9]
#~ 1. At least 1 letter between [A-Z]
#~ ... | true |
cb085973dc8a164bcdb82b3beb80310303f0ceee | pranaymate/100Plus_Python_Exercises | /04.py | 569 | 4.40625 | 4 | #~ 04. Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number.
#~ Suppose the following input is supplied to the program:
#~ 34,67,55,33,12,98
#~ Then, the output should be:
#~ ['34', '67', '55', '33', '12', '98']
#~ ('34', '67', '55'... | true |
3a6da2770d72955dd5330363f7a126a033e49d0e | pranaymate/100Plus_Python_Exercises | /12.py | 632 | 4.4375 | 4 | #~ 12. Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
#~ Suppose the following input is supplied to the program:
#~ Hello world
#~ Practice makes perfect
#~ Then, the output should be:
#~ HELLO WORLD
#~ PRACTICE MAKES PERFECT
#~ Hin... | true |
f67dc2f0ab519d287974c0c6ddc403eed51a59fe | Nmeece/MIT_OpenCourseware_Python | /MIT_OCW/MIT_OCW_PSets/PS3_Scrabble/Test_Files/is_word_vaild_wildcard.py | 1,979 | 4.15625 | 4 | '''
Safe space to try writing the is_word_valid function.
Modified to accomodate for wildcards. '*' is the wildcard character.
should a word be entered with a wildcard, the wildcard shall be replaced
by a vowel until a word found in the wordlist is created OR no good word
is found.
Nygel M.
29DEC2020
'''
VOWELS = '... | true |
691af67d856274a7c8e1027e27e48eceae5e8181 | wilcer1/War-assignment | /cardhand.py | 1,352 | 4.15625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Class for cards in hand."""
import random
class Cardhand:
"""cardhand class."""
def __init__(self):
"""Initialize class."""
self.hand = []
def cards_remaining(self):
"""Check how many cards remain in hand."""
return len(... | false |
082b03fc887f3cf806c335df90a15c8b4252d491 | heikoschmidt1187/DailyCodingChallenges | /day05.py | 1,095 | 4.53125 | 5 | #!/bin/python3
"""
cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and
last element of that pair. For example, car(cons(3, 4)) returns 3, and
cdr(cons(3, 4)) returns 4.
Given this implementation of cons:
def cons(a, b):
def pair(f):
return f(a, b)
return pair
Implement c... | true |
0d2eb22e96d280be6ebb47a615a4802696fe8fed | Peter-John88/ConquerPython | /009dict_and_set.py | 1,371 | 4.15625 | 4 | # -*- coding:utf-8 -*-
####dict
d={'Michael':95, 'Bob':75, 'Tracy':85}
print d
print d['Michael']
d['Adam']=67
print d['Adam']
d['Jack']=90
print d['Jack']
d['Jack']=88
print d['Jack']
print d
#d['Thomas'] KeyError
print 'Thomas' in d
print d.get('Thomas')
print d.get('Thomas',-1)
print d
d.pop('Bob')
print... | false |
3666c2e7decfaa73e0a10daa76cdd23a1aa89379 | Achew-glitch/python_homework | /hw01_normal_02.py | 817 | 4.40625 | 4 | # Задача-2: Исходные значения двух переменных запросить у пользователя.
# Поменять значения переменных местами. Вывести новые значения на экран.
# Решите задачу, используя только две переменные.
# Подсказки:
# * постарайтесь сделать решение через действия над числами;
# * при желании и понимании воспользуйтесь синтакси... | false |
c401e5a8cde94a8accd7480f97d201b8a7e01f8c | Mahler7/udemy-python-bootcamp | /errors-and-exceptions/errors-and-exceptions-test.py | 965 | 4.1875 | 4 | ###Problem 1 Handle the exception thrown by the code below by using try and except blocks.
try:
for i in ['a','b','c']:
print(i**2)
except TypeError:
print('The data type is not correct.')
###Problem 2 Handle the exception thrown by the code below by using **try** and **except** blocks. Then use a **f... | true |
5acbcdc262bf5e6a07f4b938dc4cb17599c45df4 | Michael37/Programming1-2 | /Lesson 9/Exercises/9.3.1.py | 683 | 4.34375 | 4 | # Michael McCullough
# Period 4
# 12/7/15
# 9.3.1
# Grade calculator; gets input of grade in numbers and converts info to a letter value
grade = float(input("what is a grade in one of your classes? "))
if grade > 0.0 and grade < 0.76:
print ("You have an F")
elif grade > 0.75 and grade < 1.51:
print ("You h... | true |
d15526a594a6593a328f8200607616c128eb4296 | bozy15/mongodb-test | /test.py | 1,245 | 4.21875 | 4 | def welcome_function():
"""
This function is the welcome function, it is called
first in the main_program_call function. The function
prints a welcome message and instructions to the user.
"""
print("WELCOME TO LEARNPULSE")
print(
"Through this program you can submit and search for \... | true |
3e628ae24afa40165546a5ece7ed0078b620a2e3 | mattjhann/Powershell | /001 Multiples of 3 and 5.py | 342 | 4.21875 | 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.
# Find the sum of all the multiples of 3 or 5 below 1000.
numbers = []
for i in range(1000):
if i % 3 == 0 or i % 5 == 0:
numbers.append(i)
j = 0
for i in numbers:
... | true |
e2b2c9b2c24413046ea0a66011ac651c68736a7e | EmilyJRoj/emoji27 | /anothernewproj/anothernewproj.py | 607 | 4.1875 | 4 | # starting off
print(22 / 7)
print(355 / 113)
import math
print(9801 / (2206 * math.sqrt(2)))
def archimedes(numsides, numSides):
innerAngleB = 360.0 / numSides
halfAngleA = innerAngleB / 2
oneHalfSides = math.sin(math.radians(halfAngleA))
sideS = oneHalfSideS * 2
polygoncircumference = numSides ... | true |
acdb0ee0f25254591fac1875be103230231f2acd | starxfighter/Python | /pythonoop/animalOOP.py | 1,594 | 4.34375 | 4 | # Set definition of the parent animal class
class Animal():
def __init__(self, name, health):
self.name = name
self.health = health
def walk(self):
self.health -= 1
return self
def run(self):
self.health -= 5
return self
def display_health(self):
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.