blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
0ce57fc5296a09864fb1e75080a20c684bceef98 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Inheritance/car_truck_suv_demo.py | 1,521 | 4.1875 | 4 | # This program creates a Car object, a truck object, and an SUV object
import vehicles
import pprint
def main():
# Create a Car object
car = vehicles.Car('Bugatti', 'Veyron', 0, 3000000, 2)
# Create a truck object
truck = vehicles.Truck('Dodge', 'Power Wagon', 0, 57000, '4WD')
# Create... | false |
d2e06b65113045bf009e371c53cc73750f8184a7 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/Recursion/Practice/7.py | 1,181 | 4.21875 | 4 | """
7. Recursive Power Method
Design a function that uses recursion to raise a number to a power. The function should
accept two arguments: the number to be raised and the exponent. Assume that the exponent is a
nonnegative integer.
"""
# define main
def main():
# Establish vars
int1 = int... | true |
f149ee1bf7a78720f53a8688d83d226cb00dc5eb | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Practice/Cars.py | 2,383 | 4.8125 | 5 | """
2. Car Class
Write a class named Car that has the following data attributes:
• __year_model (for the car’s year model)
• __make (for the make of the car)
• __speed (for the car’s current speed)
The Car class should have an __init__ method that accept the car’s year model ... | true |
eaa53c820d135506b1252749ab50b320d11d53b5 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Practice/5 - RetailItem.py | 1,427 | 4.625 | 5 | """
5. RetailItem Class
Write a class named RetailItem that holds data about an item in a retail store. The class
should store the following data in attributes: item description, units in inventory, and price.
Once you have written the class, write a program that creates three RetailItem objects
and stores the fol... | true |
b046b95c144bbe51ac2c77b5363814b8b5d2b5cc | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/LoopsPractice/6.py | 503 | 4.46875 | 4 | # 6. Celsius to Fahrenheit Table
# Write a program that displays a table of the Celsius temperatures 0 through 20 and theirFahrenheit equivalents.
# The formula for converting a temperature from Celsius toFahrenheit is
# F = (9/5)C + 32 where F is the Fahrenheit temperature and C is the Celsius temperature.
# You... | true |
9e6bdd3adc3e850240f3c9a94dd766ecdd4abe97 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/FileExercises/9.py | 1,013 | 4.28125 | 4 | # 9. Exception Handing
# Modify the program that you wrote for Exercise 6 so it handles the following exceptions:
# • It should handle any IOError exceptions that are raised when the file is opened and datais read from it.
# Define counter
count = 0
# Define total
total = 0
try:
# Display first 5 line... | true |
2118efbe7e15e295f6ceea7b4a4c26696b22edb1 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/Unit Testing and Multithreading/MultiThreading/Multithreadingclassdemo1/multithreading.py | 1,434 | 4.15625 | 4 | '''
RUnning things concurrently is known as multithreading
Running things in parallel is known as multiprocessing
I/O bound tasks - Waiting for input and output to be completed
reading and writing from file system, network
operations.
These all benefit... | true |
f1923bf1fc1a3ab94a7f5d32c929cd6914fc7605 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Test Stuff/First Test/shapes1.py | 2,305 | 4.25 | 4 | class GeometricObject:
def __init__(self, color = "green", filled = True):
self.color = color
self.filled = filled
def getColor(self):
return self.color
def setColor(self, color):
self.color = color
def isFilled(self):
... | true |
cd2b8237503c74dfc7864dd4ec64d7f334c9ecb0 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Practice/8 - trivia.py | 2,521 | 4.4375 | 4 | """
8. Trivia Game
In this programming exercise you will create a simple trivia game for two players. The program will
work like this:
• Starting with player 1, each player gets a turn at answering 5 trivia questions. (There
should be a total of 10 questions.) When a question is displayed,... | true |
1658b421c637ec8ab3524446baccd8f30da4470c | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/Lists/tuples.py | 394 | 4.25 | 4 | # tuples are like an immutable list
my_tuple = (1, 2, 3, 4, 5)
print(my_tuple)
# printing items in a tuple
names = ('Holly', 'Warren', 'Ashley')
for n in names:
print(n)
for i in range(len(names)):
print (names[i])
# Convert between a list and a tuple
listA = [2, 4, 5, 1, 6]
type(... | false |
8b72f14467bc40821bc0fb0c7c2ad9f05be58cd0 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Inheritance/Practice/Inheritance Exercises - 3.py | 2,460 | 4.46875 | 4 | """
3. Person and Customer Classes
Write a class named Person with data attributes for a person’s name, address, and
telephone number. Next, write a class named Customer that is a subclass of the
Person class. The Customer class should have a data attribute for a customer
number and a Boolean da... | true |
ab93e5065c94a86f8ed6c812a3292100925a1bb5 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/IfElsePractice/5.py | 1,575 | 4.4375 | 4 | # 5. Color Mixer
# The colors red, blue, and yellow are known as the primary colors because they cannot be
# made by mixing other colors. When you mix two primary colors, you get a secondary color,
# as shown here:
# When you mix red and blue, you get purple.
# When you mix red and yellow, you get orange.
# When ... | true |
d63f59488d65ba81d647da41c15424a0901d18b4 | DimitrisMaskalidis/Python-2.7-Project-Temperature-Research | /Project #004 Temperature Research.py | 1,071 | 4.15625 | 4 | av=0; max=0; cold=0; count=0; pl=0; pres=0
city=raw_input("Write city name: ")
while city!="END":
count+=1
temper=input("Write the temperature of the day: ")
maxTemp=temper
minTemp=temper
for i in range(29):
av+=temper
if temper<5:
pl+=1
if temper>maxTe... | true |
4d1e19c830d0f41e51c4837a8792b8a054ee6655 | viniciuskurt/LetsCode-PracticalProjects | /1-PythonBasics/aula04_Operadores.py | 1,578 | 4.40625 | 4 | '''
OPERADORES ARITMETICOS
Fazem operações aritméticas simples:
'''
print('OPERADORES ARITMÉTICOS:\n')
print('+ soma')
print('- subtração')
print('* multiplicacao')
print('/ divisão')
print('// divisão inteira') #não arredonda o resultado da divisão, apenas ignora a parte decimal
print('** potenciação')
print('% resto... | false |
431e4b3687f6e41381331f315f13108fc029d396 | wangyunge/algorithmpractice | /eet/Check_Completeness_of_a_Binary_Tree.py | 1,354 | 4.21875 | 4 | """
Given the root of a binary tree, determine if it is a complete binary tree.
In a complete binary tree, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h.
Example 1:
Input:... | true |
597bdffceea740761f6280470d81b9deaf73f400 | wangyunge/algorithmpractice | /int/517_Ugly_Number.py | 926 | 4.125 | 4 | '''
Write a program to check whether a given number is an ugly number`.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Notice
Note that 1 is typically treated as an ugly number.
Have you met this ... | true |
2e3a39178816c77f9f212cb1629a8f17950da152 | wangyunge/algorithmpractice | /int/171_Anagrams.py | 692 | 4.34375 | 4 | '''
Given an array of strings, return all groups of strings that are anagrams.
Notice
All inputs will be in lower-case
Have you met this question in a real interview? Yes
Example
Given ["lint", "intl", "inlt", "code"], return ["lint", "inlt", "intl"].
Given ["ab", "ba", "cd", "dc", "e"], return ["ab", "ba", "cd", ... | true |
e3ee7499abf955e0662927b7341e93fa81843620 | wangyunge/algorithmpractice | /eet/Arithmetic_Slices.py | 960 | 4.15625 | 4 | """
An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
For example, [1,3,5,7,9], [7,7,7,7], and [3,-1,-5,-9] are arithmetic sequences.
Given an integer array nums, return the number of arithmetic subarrays of nums.
A ... | true |
3859966faca648ffe0b7e83166049c07676ba93b | wangyunge/algorithmpractice | /eet/Maximum_Units_on_a_Truck.py | 2,304 | 4.125 | 4 | """
You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]:
numberOfBoxesi is the number of boxes of type i.
numberOfUnitsPerBoxi is the number of units in each box of the type i.
You are also given an integer truckSize... | true |
d620071842e6003015b2a9f34c72b85a64e00a04 | wangyunge/algorithmpractice | /eet/Multiply_Strings.py | 1,183 | 4.125 | 4 | """
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1... | true |
bdfc9caa3090f7727fd227548a83aaf19bf66c14 | wangyunge/algorithmpractice | /eet/Unique_Binary_Search_Tree_II.py | 1,269 | 4.25 | 4 | '''
Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
1 3 3 2 1
\ / / / \ \
3 2 1 1 3 2
/ / ... | true |
9eba4c97143250a68995688a62b41145ab39485f | wangyunge/algorithmpractice | /int/165_Merge_Two_Sorted_Lists.py | 944 | 4.125 | 4 | '''
Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the two lists and sorted in ascending order.
Have you met this question in a real interview? Yes
Example
Given 1->3->8->11->15->null, 2->null , return 1->2->3->8->11->1... | true |
ba2b9d296a98edfb414c89aba262142b031014ea | tasver/python_course | /lab7_4.py | 782 | 4.375 | 4 |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
def input_str() -> str:
""" This function make input of string data"""
input_string = str(input('Enter your string: '))
return input_string
def string_crypt(string: str) -> str:
""" This function make crypt string"""
result_string = str()
string = string.lower()
for ... | true |
e18e81c8986c383ac6d6cec86017d3bf948af5b3 | tasver/python_course | /lab6_1.py | 719 | 4.21875 | 4 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
import math
def input_par() -> list:
""" This function make input of data"""
a, b, c = map(float, input('Enter 3 numbers: ').split())
return [a, b, c]
def check_triangle(a:list) -> bool:
""" This function check exists triangle"""
if (((a[0] + a[1]) > a[2]) and ((a[0] +... | true |
3a5ee700dce71d3f72eb95a8d7b5900e309270ec | ahmetYilmaz88/Introduction-to-Computer-Science-with-Python | /ahmet_yilmaz_hw6_python4_5.py | 731 | 4.125 | 4 | ## My name: Ahmet Yilmaz
##Course number and course section: IS 115 - 1001 - 1003
##Date of completion: 2 hours
##The question is about converting the pseudocode given by instructor to the Python code.
##set the required values
count=1
activity= "RESTING"
flag="false"
##how many activities
numact= int(input(" Enter ... | true |
8d07696850cc5f7371069a98351c51266b77da6b | lintangsucirochmana03/bigdata | /minggu-02/praktik/src/DefiningFunction.py | 913 | 4.3125 | 4 | Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> def fib(n): # write Fibonacci series up to n
"""Print a Fibonacci series up to n."""
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
>>... | true |
652990fdc99924c1810dddc60be12a8d81709a6e | ashwani8958/Python | /PyQT and SQLite/M3 - Basics of Programming in Python/program/module/friends.py | 379 | 4.125 | 4 | def food(f, num):
"""Takes total and no. of people as argument"""
tip = 0.1*f #calculates tip
f = f + tip #add tip to total
return f/num #return the per person value
def movie(m, num):
"""Take total and no. of the people as arguments"""
return m/num #returns the per persons value
print("The na... | true |
95e0619eeb977cefe6214f8c50017397ec35af3b | SURBHI17/python_daily | /prog fund/src/assignment40.py | 383 | 4.25 | 4 | #PF-Assgn-40
def is_palindrome(word):
word=word.upper()
if len(word)<=1:
return True
else:
if word[0]==word[-1]:
return is_palindrome(word[1:-1])
else:
return False
result=is_palindrome("MadAMa")
if(result):
print("The given word is a Palin... | true |
afdd7db2d0487b2cc2af9a6c33bcdc5c61512109 | SURBHI17/python_daily | /prog fund/src/day4_class_assign.py | 338 | 4.1875 | 4 | def duplicate(value):
dup=""
for element in value:
if element in dup: #if element not in value:
continue # dup+=element
else: #
dup+=element #return dup
return dup
value1="popeye"
print(... | false |
cdcab6d17e29620c08c0853e7b667c18e15ad1f5 | mylessbennett/reinforcing_exercises_feb20 | /exercise1.py | 247 | 4.125 | 4 | def sum_odd_num(numbers):
sum_odd = 0
for num in numbers:
if num % 2 != 0:
sum_odd += num
return sum_odd
numbers = []
for num in range(1, 21):
numbers.append(num)
sum_odd = sum_odd_num(numbers)
print(sum_odd)
| false |
114dd9807e3e7a111c6e1f97e331a7a98e6e074a | KanuckEO/Number-guessing-game-in-Python | /main.py | 1,491 | 4.28125 | 4 | #number_guessing_game
#Kanuck Shah
#importing libraries
import random
from time import sleep
#asking the highest and lowest index they can guess
low = int(input("Enter lowest number to guess - "))
high = int(input("Enter highest number to guess - "))
#array
first = ["first", "second", "third", "fourth", "fifth"]
#va... | true |
9bab6ff99aa72e668524b63523c2106181049f6f | IamBiasky/pythonProject1 | /SelfPractice/function_exponent.py | 316 | 4.34375 | 4 | # Write a function called exponent(base, exp)
# that returns an int value of base raises to the power of exp
def exponent(base, exp):
exp_int = base ** exp
return exp_int
base = int(input("Please enter a base integer: "))
exp = int(input("Please enter an exponent integer: "))
print(exponent(base, exp))
| true |
2d4cf0b46c47fad8a5cc20cdf98ebf9ab379a151 | sooryaprakash31/ProgrammingBasics | /OOPS/Exception_Handling/exception_handling.py | 1,347 | 4.125 | 4 | '''
Exception Handling:
- This helps to avoid the program crash due to a segment of code in the program
- Exception handling allows to manage the segments of program which may lead to errors in runtime
and avoiding the program crash by handling the errors in runtime.
try - represents a block of code t... | true |
79dda99fe42354f17d03eb33a1aab1ee9ebe61ab | sooryaprakash31/ProgrammingBasics | /Algorithms/Sorting/Quick/quick.py | 2,027 | 4.25 | 4 | '''
Quick Sort:
- Picks a pivot element (can be the first/last/random element) from the array
and places it in the sorted position such that the elements before the pivot
are lesser and elements after pivot are greater.
- Repeats this until all the elements are placed in the right position
- Divide and conquer strateg... | true |
4bdde3d9684f505ae85c0446465aa211a012a02d | luizfirmino/python-labs | /Python I/Assigments/Module 5/Ex-2.py | 415 | 4.3125 | 4 | #
# Luiz Filho
# 3/14/2021
# Module 5 Assignment
# 2. In mathematics, the factorial of a number n is defined as n! = 1 ⋅ 2 ⋅ ... ⋅ n (as the product of all integer numbers from 1 to n).
# For example, 4! = 1 ⋅ 2 ⋅ 3 ⋅ 4 = 24. Write a recursive function for calculating n!
def calculateN(num):
if num == 1:
... | true |
7372b7c995d2302f29b8443656b50cae298a566b | luizfirmino/python-labs | /Python I/Assigments/Module 6/Ex-4.py | 742 | 4.40625 | 4 | #
# Luiz Filho
# 3/23/2021
# Module 6 Assignment
# 4. Write a Python function to create the HTML string with tags around the word(s). Sample function and result are shown below:
#
#add_html_tags('h1', 'My First Page')
#<h1>My First Page</h1>
#
#add_html_tags('p', 'This is my first page.')
#<p>This is my first page.... | true |
c13619368c38c41c0dbf8649a3ca88d7f2788ee8 | luizfirmino/python-labs | /Python Networking/Assignment 2/Assignment2.py | 564 | 4.21875 | 4 | #!/usr/bin/env python3
# Assignment: 2 - Lists
# Author: Luiz Firmino
list = [1,2,4,'p','Hello'] #create a list
print(list) #print a list
list.append(999) #add to end of list
print(list)
print(list[-1]) #print the last element
list.pop() #remove last element
pr... | true |
51d1e3a48b954c1de3362ea295d4270a884fea98 | luizfirmino/python-labs | /Python I/Assigments/Module 7/Ex-3.py | 1,042 | 4.3125 | 4 | #
# Luiz Filho
# 4/7/2021
# Module 7 Assignment
# 3. Gases consist of atoms or molecules that move at different speeds in random directions.
# The root mean square velocity (RMS velocity) is a way to find a single velocity value for the particles.
# The average velocity of gas particles is found using the root mean s... | true |
47d783748c562dd3c3f8b7644dda166f37b5f11e | luizfirmino/python-labs | /Python I/Assigments/Module 5/Ex-6.py | 238 | 4.5 | 4 | #
# Luiz Filho
# 3/14/2021
# Module 5 Assignment
# 6. Write a simple function (area_circle) that returns the area of a circle of a given radius.
#
def area_circle(radius):
return 3.1415926535898 * radius * radius
print(area_circle(40)) | true |
6ca6fbf8e7578b72164ab17030f1c01013604b04 | luizfirmino/python-labs | /Python I/Assigments/Module 5/Ex-4.py | 549 | 4.28125 | 4 | #
# Luiz Filho
# 3/14/2021
# Module 5 Assignment
# 4. Explain what happens when the following recursive functions is called with the value “alucard” and 0 as arguments:
#
print("This recursive function is invalid, the function won't execute due an extra ')' character at line 12 column 29")
print("Regardless any value... | true |
796c8bb615635d769a16ae12d9f27f2cfce4631c | luizfirmino/python-labs | /Python I/Assigments/Module 2/Ex-2.py | 880 | 4.53125 | 5 | #
# Luiz Filho
# 2/16/2021
# Module 2 Assignment
# Assume that we execute the following assignment statements
#
# length = 10.0 , width = 7
#
# For each of the following expressions, write the value of the expression and the type (of the value of the expression).
#
# width//2
# length/2.0
# length/2
# ... | true |
2dcdbed4df8b0608780c4d3a226c4f25d0de2b38 | Zetinator/just_code | /python/leetcode/binary_distance.py | 872 | 4.1875 | 4 | """
The distance between 2 binary strings is the sum of their lengths after removing the common prefix. For example: the common prefix of 1011000 and 1011110 is 1011 so the distance is len("000") + len("110") = 3 + 3 = 6.
Given a list of binary strings, pick a pair that gives you maximum distance among all possible pa... | true |
308f485babf73eec8c433821951390b8c2414750 | Zetinator/just_code | /python/leetcode/pairs.py | 966 | 4.1875 | 4 | """https://www.hackerrank.com/challenges/pairs/problem?h_l=interview&playlist_slugs%5B%5D%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D%5B%5D=search
You will be given an array of integers and a target value. Determine the number of pairs of array elements that have a difference equal to a target value.
Complete... | true |
e823b273ed44482d8c05499f66bf76e78b06d842 | Zetinator/just_code | /python/leetcode/special_string_again.py | 2,477 | 4.21875 | 4 | """https://www.hackerrank.com/challenges/special-palindrome-again/problem?h_l=interview&playlist_slugs%5B%5D%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D%5B%5D=strings
A string is said to be a special string if either of two conditions is met:
All of the characters are the same, e.g. aaa.
All characters excep... | true |
e2b8fe6ba7d4d000b5ef8578aae3caf1847efc9d | Zetinator/just_code | /python/leetcode/unique_email.py | 1,391 | 4.375 | 4 | """
Every email consists of a local name and a domain name, separated by the @ sign.
For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name.
Besides lowercase letters, these emails may contain '.'s or '+'s.
If you add periods ('.') between some characters in the local name p... | true |
ca54ebba62347e2c3a4107872889e4746c51a922 | malbt/PythonFundamentals.Exercises.Part5 | /anagram.py | 497 | 4.375 | 4 | def is_anagram(first_string: str, second_string: str) -> bool:
"""
Given two strings, this functions determines if they are an anagram of one another.
"""
pass # remove pass statement and implement me
first_string = sorted(first_string)
second_string = sorted(second_string)
if first_string... | true |
e777115b8048caa29617b9b0e99d6fbac3beef99 | Vipulhere/Python-practice-Code | /Module 8/11.1 inheritance.py | 643 | 4.3125 | 4 | #parent class
class parent:
parentname=""
childname=""
def show_parent(self):
print(self.parentname)
#this is child class which is inherites from parent
class Child(parent):
def show_child(self):
print(self.childname)
#this object of child class
c=Child()
c.parentname="BOB"
c.childname=... | true |
4380cb3cb4bbdace75f27ff7059a0505e17687b7 | ToxaRyd/WebCase-Python-course- | /7.py | 1,757 | 4.3125 | 4 | """
Данный класс создан для хранения персональной (смею предположить, корпоративной) информации.
Ниже приведены doc тесты/примеры работы с классом.
>>> Employee = Person('James', 'Holt', '19.09.1989', 'surgeon', '3', '5000', 'Germany', 'Berlin', 'male')
>>> Employee.name
James Holt
>>> Employee.age
29 years ... | false |
347460f3edf3af4e5601a45b287d1a086e1a3bc3 | bopopescu/PycharmProjects | /Class_topic/7) single_inheritance_ex2.py | 1,601 | 4.53125 | 5 | # Using Super in Child class we can alter Parent class attributes like Pincode
# super is like update version of parent class in child class
'''class UserProfile(Profile): # Child Class
def __init__(self,name,email,address,pincode): # constructor of child Class
super(UserProfile, self).__init__(name,email... | true |
6a6b1394a960ba09ff2c97fa71e61b78a1c45858 | bopopescu/PycharmProjects | /shashi/10) functions_1( lambda) .py | 1,902 | 4.25 | 4 | #Nested function
'''def func1():
def func2():
return "hello"
return func2
data = func1()
print(data())'''
#global function
'''a = 100
def test():
global a # ti use a value in function
a = a + 1
print(a)
#print(a)
test()'''
'''a = 100
def test():
global a # ti use a value in function... | false |
1f6a9e033c3a3b8c5c278cb4a96d5900ef8a994e | pjz987/2019-10-28-fullstack-night | /Assignments/pete/python/optional-labs/roadtrip/roadtrip-v1.py | 1,130 | 4.15625 | 4 | city_dict = {
'Boston': {'New York', 'Albany', 'Portland'},
'New York': {'Boston', 'Albany', 'Philadelphia'},
'Albany': {'Boston', 'New York', 'Portland'},
'Portland': {'Boston', 'Albany'},
'Philadelphia': {'New York'}
}
city_dict2 = {
'Boston': {'New York': 4, 'Albany': 6, 'Portland': 3},
'New York': {'... | false |
7c693a0fe73b2fe3cbeeddf1551bf3d2f0250ab2 | pjz987/2019-10-28-fullstack-night | /Assignments/pete/python/lab12/lab12-guess_the_number-v3.py | 694 | 4.34375 | 4 | '''
lab12-guess_the_number-v3.py
Guess a random number between 1 and 10.
V3
Tell the user whether their guess is above ('too high!') or below ('too low!') the target value.'''
import random
x = random.randint(1, 10)
guess = int(input("Welcome to Guess the Number v3. The computer is thinking of a number between 1 and ... | true |
82ef1519965203526bf480fc9b989e73fb955f54 | pjz987/2019-10-28-fullstack-night | /Assignments/jake/Python_Assignments/lab17-palidrome_anagramv2.py | 312 | 4.5625 | 5 | # Python Program to Check a Given String is Palindrome or Not
string = input("Please enter enter a word : ")
str1 = ""
for i in string:
str1 = i + str1
print("Your word backwards is : ", str1)
if(string == str1):
print("This is a Palindrome String")
else:
print("This is Not a Palindrome String") | true |
81ff46e99809f962f6642b33aa03dd274ac7a16e | mohasinac/Learn-LeetCode-Interview | /Strings/Implement strStr().py | 963 | 4.28125 | 4 | """
Implement strStr().
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Example 1:
Input: haystack = "hello", needle = "ll"
Output: 2
Example 2:
Input: haystack = "aaaaa", needle = "bba"
Output: -1
Clarification:
What should we return when needle is an empt... | true |
997f0d32c5609f5e9dac7fb94b933f4e28d64809 | jonathansilveira1987/EXERCICIOS_ESTRUTURA_DE_REPETICAO | /exercicio11.py | 410 | 4.15625 | 4 | # 11. Altere o programa anterior para mostrar no final a soma dos números.
# Desenvolvido por Jonathan Silveira - Instagram: @jonathandev01
num1 = int(input("Digite o primeiro número inteiro: "))
num2 = int(input("Digite o segundo número inteiro: "))
for i in range (num1 + 1, num2):
print(i)
for i in range (num2 ... | false |
16cbb114d0a13ac1c2a25c4be46dd7c14db6584c | Divyendra-pro/Calculator | /Calculator.py | 761 | 4.25 | 4 | #Calculator program in python
#User input for the first number
num1 = float(input("Enter the first number: "))
#User input for the operator
op=input("Choose operator: ")
#User input for the second number
num2 = float(input("Enter the second number:" ))
#Difine the operator (How t will it show the results)
if op == '... | true |
8a3f462060774d17383f404bf97467015cd94489 | NathanaelV/CeV-Python | /Exercicios Mundo 2/ex053_detector_de_palindromo.py | 1,157 | 4.15625 | 4 | # Class Challenge 13
# Ler uma frase e verificar se é um Palindromo
# Palindromo: Frase que quando lida de frente para traz e de traz para frente
# Serão a mesma coisa
# Ex.: Apos a sopa; a sacada da casa; a torre da derrota; o lobo ama o bolo;
# Anotaram a data da maratona.
# Desconsiderar os espaços e acentos. Progr... | false |
4d7ae2dfa428ee674fdd151230a36c39c09e7055 | NathanaelV/CeV-Python | /Aulas Mundo 3/aula19_dicionarios.py | 2,623 | 4.21875 | 4 | # Challenge 90 - 95
# dados = dict()
# dados = {'nome':'Pedro', 'idade':25} nome é o identificador e Pedro é o valor
# idade é o identificador e 25 é a idade.
# Para criar um novo elemento
# dados['sexo'] = 'M'. Ele cria o elemento sexo e adiciona ao dicionario
# Para apagar
# del dados['idade']
# print(dados.valu... | false |
8e28da8e0eb769a6a9735bb6edf36567011b2a0a | NathanaelV/CeV-Python | /Aulas Mundo 3/aula20_funçoes_parte1.py | 1,450 | 4.1875 | 4 | # Challenge 96 - 100
# Bom para ser usado quando um comando é muito repetido.
def lin():
print('-' * 30)
def título(msg): # No lugar de msg, posso colocar qualquer coia.
print('-' * 30)
print(msg)
print('-' * 30)
print(len(msg))
título('Im Learning Python')
print('Good Bye')
lin()
def soma(... | false |
560596b12e9cda1ebdadfb4ab2b5c945ad0265d1 | NathanaelV/CeV-Python | /Exercicios Mundo 3/ex103_ficha_do_jogador.py | 1,173 | 4.21875 | 4 | # Class Challenge 21
# Montar a função ficha():
# Que recebe parametros opcionais: NOME de um jogador e quantos GOLS
# O programa deve mostrar os dados, mesmo que um dos valores não tenha sido informado corretamente
# jogador <desconhecido> fez 0 gols
# Adicionar as docstrings da função
def ficha(name='<unknown>', go... | false |
5d86ca4b127b79be2a7edc2a93e45dfc0502ccd7 | JiJibrto/lab_rab_12 | /individual2.py | 1,358 | 4.34375 | 4 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# Реализовать класс-оболочку Number для числового типа float. Реализовать методы
# сложения и деления. Создать производный класс Real, в котором реализовать метод
# возведения в произвольную степень, и метод для вычисления логарифма числа.
import math
class Number:
... | false |
c80bffe95bc94308989cec03948a4a91239d13aa | rbngtm1/Python | /data_structure_algorithm/array/remove_duplicate_string.py | 398 | 4.25 | 4 | # Remove duplicates from a string
# For example: Input: string = 'banana'
# Output: 'ban'
##########################
given_string = 'banana apple'
my_list = list()
for letters in given_string:
if letters not in my_list:
my_list.append(letters)
print(my_list)
print (''.join(my_list))
## poss... | true |
bed107a24a36afeb2176c3200aec2c525a24a55a | Silicon-beep/UNT_coursework | /info_4501/home_assignments/fraction_class/main.py | 1,432 | 4.21875 | 4 | from fractions import *
print()
#######################
print('--- setup -----------------')
try:
print(f'attempting fraction 17/0 ...')
Fraction(17, 0)
except:
print()
pass
f1, f2 = Fraction(1, 2), Fraction(6, 1)
print(f'fraction 1 : f1 = {f1}')
print(f'fraction 2 : f2 = {f2}')
####################... | false |
3474489ac3abf4439f4af04a6f2a69a743e168d6 | divanescu/python_stuff | /coursera/PR4E/assn46.py | 348 | 4.15625 | 4 | input = raw_input("Enter Hours: ")
hours = float(input)
input = raw_input("Enter Rate: ")
rate = float(input)
def computepay():
extra_hours = hours - 40
extra_rate = rate * 1.5
pay = (40 * rate) + (extra_hours * extra_rate)
return pay
if hours <= 40:
pay = hours * rate
print pay
elif hours >... | false |
a6dd4e5cf972068af342c8e08e10b4c7355188e6 | DivyaRavichandr/infytq-FP | /strong .py | 562 | 4.21875 | 4 | def factorial(number):
i=1
f=1
while(i<=number and number!=0):
f=f*i
i=i+1
return f
def find_strong_numbers(num_list):
list1=[]
for num in num_list:
sum1=0
temp=num
while(num):
number=num%10
f=factorial(numbe... | true |
4f32d0b2293ff8535a870cd9730528ecf4874190 | comedxd/Artificial_Intelligence | /2_DoublyLinkedList.py | 1,266 | 4.21875 | 4 | class LinkedListNode:
def __init__(self,value,prevnode=None,nextnode=None):
self.prevnode=prevnode
self.value=value
self.nextnode=nextnode
def TraverseListForward(self):
current_node = self
while True:
print(current_node.value, "-", end=" ")
... | true |
76348acf643b1cd9764e1184949478b3b888b014 | jdipendra/asssignments | /multiplication table 1-.py | 491 | 4.15625 | 4 | import sys
looping ='y'
while(looping =='y' or looping == 'Y'):
number = int(input("\neneter number whose multiplication table you want to print\n"))
for i in range(1,11):
print(number, "x", i, "=", number*i)
else:
looping = input("\nDo you want to print another table?\npress Y/y for yes and... | true |
e6e94d3d50a56f104d1ad9993d78f8c44394b753 | jdipendra/asssignments | /check square or not.py | 1,203 | 4.25 | 4 | first_side = input("Enter the first side of the quadrilateral:\n")
second_side = input("Enter the second side of the quadrilateral:\n")
third_side = input("Enter the third side of the quadrilateral:\n")
forth_side = input("Enter the forth side of the quadrilateral:\n")
if float(first_side) != float(second_side) and flo... | true |
24b16e3a48c7688365a31738ad2e12f2f41bc5dc | jocelinoFG017/IntroducaoAoPython | /01-Cursos/GeekUniversity/Seção06-Estruturas_Repetição/Exs_1_ao_21/S06_Ex03.py | 247 | 4.1875 | 4 | """
.3. Faça um algoritmo utilizando o comando while que mostra uma contagem regres-
siva na tela, iniciando em 10 e terminando em 0. Mostrar uma mensagem 'FIM!'
após a contagem.
"""
i = 10
while i >= 0:
print(i)
i = i - 1
print('FIM')
| false |
12b0ad3a799b83888c413ba1499b78b3cbe05170 | jocelinoFG017/IntroducaoAoPython | /01-Cursos/GeekUniversity/Seção05-Estruturas_Lógicas_e_Condicionais/Exs_1_ao_21/S05_Ex08.py | 725 | 4.15625 | 4 | """
Faça um programa que leia 2 notas de um aluno, verifique se as notas são
válidas e exiba na tela a média destas notas. Uma nota válida deve ser,
obrigatoriamente, um valor entre 0.0 e 10.0, onde caso a nota possua um
valor válido, este fato deve ser informado ao usuário e o programa termina.
"""
nota1 = float(inpu... | false |
677274c5c2e5ef86e3090e5501182c28e1d7acf3 | jocelinoFG017/IntroducaoAoPython | /01-Cursos/GeekUniversity/Seção05-Estruturas_Lógicas_e_Condicionais/Exs_1_ao_21/S05_Ex21.py | 1,216 | 4.15625 | 4 | """
Escreva o menu de opções abaixo. Leia a opção do usuário e execute a operação
escolhida. Escreva uma mensagem de erro se a opção for inválida.
Escolha a opção:
1 - Soma de 2 números.
2 - Diferença entre 2 números. (maior pelo menor).
3 - Produto entre 2 números.
4 - Divisão entre 2 números (o denominador não pode ... | false |
6bdaa9fca5f74779af13721837fc1bf30625af36 | jocelinoFG017/IntroducaoAoPython | /01-Cursos/GeekUniversity/Seção05-Estruturas_Lógicas_e_Condicionais/Exs_22_ao_41/S05_Ex28.py | 1,237 | 4.15625 | 4 | """
.28. Faça um programa que leia três números inteiros positivos e efetue o cálculo de uma das
seguintes médias de acordo com um valor númerico digitado pelo usuário.
- (a) Geométrica : raiz³(x * y * z)
- (b) Ponderada : (x + (2 * y) + (3 * z)) / 6
- (c) Harmônica : 1 / (( 1 / x) + (1 / y) + (1 / z))
- (d) Aritm... | false |
ab98f9c6ff4f60984dba33b33038588020bae6bc | jocelinoFG017/IntroducaoAoPython | /01-Cursos/GeekUniversity/Seção05-Estruturas_Lógicas_e_Condicionais/Exs_1_ao_21/S05_Ex13.py | 645 | 4.21875 | 4 | """
Faça um algoritmo que calcule a média ponderada das notas de 3 provas.
A primeira e a segunda prova tem peso 1 e a terceira tem peso 2. Ao
final, mostrar a média do aluno e indicar se o aluno foi aprovado ou
reprovado. A nota para aprovação deve ser igual ou superior a 60 pontos.
"""
nota1 = float(input("nota1: ")... | false |
d80274fec662b690fff77f8900d4c6b5c25bb132 | jocelinoFG017/IntroducaoAoPython | /01-Cursos/GeekUniversity/Seção10-Expressões_Lambdas_e_Funções_Integradas/MinAndMax.py | 1,784 | 4.28125 | 4 | """
Min() e Max()
max() -> retorna o maior valor ou o maior de dois ou mais elementos
# Exemplos
lista = [1, 2, 8, 4, 23, 123]
print(max(lista))
tupla = (1, 2, 8, 4, 23, 123)
print(max(tupla))
conjunto = {1, 2, 8, 4, 23, 123}
print(max(conjunto))
dicionario = {'a': 1, 'b': 2, 'c': 8, 'd': 4, 'e': 23, 'f': 123}
p... | false |
79b58db5b932f19b7f71f09c37c3942554507803 | RjPatil27/Python-Codes | /Sock_Merchant.py | 840 | 4.1875 | 4 | '''
John works at a clothing store. He has a large pile of socks that he must pair by color for sale.
Given an array of integers representing the color of each sock,
determine how many pairs of socks with matching colors there are.
For example, there are n = 7 socks with colors arr = [1,2,1,2,3,2,1] . There is one pa... | true |
05432b48af09dc9b89fded6fb53181df2645ee53 | Mat4wrk/Working-with-Dates-and-Times-in-Python-Datacamp | /1.Dates and Calendars/Putting a list of dates in order.py | 569 | 4.375 | 4 | """Print the first and last dates in dates_scrambled.""
# Print the first and last scrambled dates
print(dates_scrambled[0])
print(dates_scrambled[-1])
"""Sort dates_scrambled using Python's built-in sorted() method, and save the results to dates_ordered."""
"""Print the first and last dates in dates_ordered."""
# Pr... | true |
619f65ba890f6fa2e891f197581b739f02baae40 | Jmwas/Pythagorean-Triangle | /Pythagorean Triangle Checker.py | 826 | 4.46875 | 4 | # A program that allows the user to input the sides of any triangle, and then
# return whether the triangle is a Pythagorean Triple or not
while True:
question = input("Do you want to continue? Y/N: ")
if question.upper() != 'Y' and question.upper() != 'N':
print("Please type Y or N")
elif question... | true |
6273ea18be6a76f5d37c690837830f34f7c516e4 | cahill377979485/myPy | /正则表达式/命名组.py | 1,351 | 4.46875 | 4 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Python 2.7的手册中的解释:
(?P<name>...)
Similar to regular parentheses, but the substring matched by the group is accessible within the rest of the regular
expression via the symbolic group name name. Group names must be valid Python identifiers, and each group name must be
defin... | true |
0c6fcfa855bc02ebc378e1f5d0c1e5bc5014d5b1 | HeloiseKatharine/Bioinformatica | /Atividade 1/3.py | 821 | 4.125 | 4 | '''
Crie um programa em python que receba do usuário uma sequência de DNA e retorne a quantidade de possíveis substrings de tamanho 4 (sem repetições).
Ex.: Entrada: actgactgggggaaa
Após a varredura de toda a sequência achamos as substrings actg, ctga, tgac, gact, ctgg, tggg, gggg, ggga, ggaa, gaaa, logo a saída do pro... | false |
c3912498bdd7197cd60c10943fefc448909f27f5 | EstephanoBartenski/Aprendendo_Python | /Exercícios_parte_1/exercício__037.py | 628 | 4.125 | 4 | # conversor de bases numéricas
n = int(input('Digite um número inteiro: '))
print('''Escolha umda das bases para a conversão:'
[ 1 ] converter para BINÁRIO
[ 2 ] converter para OCTAL
[ 3 ] converter para HEXADECIMAL''')
opção = int(input('Sua opção: '))
if opção == 1:
print('{} convertido para BINÁRIO é igu... | false |
b27eb11a268eb165af970993edad89d4f4c7694a | EstephanoBartenski/Aprendendo_Python | /Exercícios_parte_1/exercício__059.py | 1,526 | 4.15625 | 4 | # criando um menu de opções
from time import sleep
n1 = float(input('Digite um número qualquer: '))
n2 = float(input('Digite mais um número: '))
print(' [ 1 ] somar\n'
' [ 2 ] multiplicar\n'
' [ 3 ] maior\n'
' [ 4 ] novos números\n'
' [ 5 ] sair do programa')
opção =... | false |
5c5199249efa2ba277218ed47e4ae2554a0bbf7e | Adi7290/Python_Projects | /improvise_2numeric_arithmetic.py | 660 | 4.21875 | 4 | #Write a program to enter two integers and then perform all arithmetic operators on them
num1 = int(input('Enter the first number please : \t '))
num2 = int(input('Enter the second number please :\t'))
print(f'''the addittion of {num1} and {num2} will be :\t {num1+num2}\n
the subtraction of {num1} and {num2} will b... | true |
4cc7aabb1e5e2b48cc90c607acce1b67f9fac93d | Adi7290/Python_Projects | /Herons formula.py | 350 | 4.28125 | 4 | #Write a program to calculate the area of triangle using herons formula
a= float(input("Enter the first side :\t"))
b= float(input("Enter the second side :\t"))
c= float(input("Enter the third side :\t"))
print(f"Side1 ={a}\t,Side2 = {b}\t,Side3={c}")
s = (a+b+c)/2
area=(s*(s-a)*(s-b)*(s-c))**0.5
print(f"Semi = ... | true |
ea0b627a1ee97b93acd9087b18e36c3fa5d10b4d | Adi7290/Python_Projects | /singlequantity_grocery.py | 942 | 4.1875 | 4 | '''Write a program to prepare a grocery bill , for that enter the name of items , quantity in which it is
purchased and its price per unit the display the bill in the following format
*************BILL***************
item name item quantity item price
********************************
total amount to be paid ... | true |
2b786c15f95d48b9e59555d2557cc497d922d948 | Adi7290/Python_Projects | /Armstrong_number.py | 534 | 4.40625 | 4 | """Write a program to find whether the given number is an Armstrong Number or not
Hint:An armstrong number of three digit is an integer such that the sum of the cubes of its digits is equal
to the number itself.For example 371 is the armstrong number since 3**3+7**3+1**3"""
num = int(input('Enter the number to che... | true |
503700558831bf7513fc8987bb669f0e17d144c0 | deepika7007/bootcamp_day2 | /Day 2 .py | 1,301 | 4.1875 | 4 | #Day 2 string practice
# print a value
print("30 days 30 hour challenge")
print('30 days Bootcamp')
#Assigning string to Variable
Hours="Thirty"
print(Hours)
#Indexing using String
Days="Thirty days"
print(Days[0])
print(Days[3])
#Print particular character from certin text
Challenge="I will win"
print(challenge[... | true |
5571025882b22c9211572e657dd38b1a9ecdfa74 | martinkozon/Martin_Kozon-Year-12-Computer-Science | /Python/extra_sum_of_two.py | 342 | 4.1875 | 4 | #Program which will add two numbers together
#User has to input two numbers - number1 and number2
number1 = int(input("Number a: "))
number2 = int(input("Number b: "))
#add numbers number1 and number2 together and print it out
print(number1 + number2)
#TEST DATA
#Input 1, 17 -> output 18
#Input 2, 5 -> output 7
#Inp... | true |
fa98a79e66cd7e8575c857dabad5877c3b78cd87 | martinkozon/Martin_Kozon-Year-12-Computer-Science | /Python/06_input-validation.py | 816 | 4.25 | 4 | #User has to input a number between 1 and 10
#eg. if user inputs 3, the result will be as follows: 3 -> 3*1=3, 3*2=6, 3*3=9
#ask a user to input a number
number = int(input("Input number between 1 and 10: "))
#if the input number is 99 than exit the program
if number == 99:
exit()
# end if
#if the number isn't t... | true |
15e022eb2fbc2d17ee9dd7787a5c301d43dbb89a | GitLeeRepo/PythonNotes | /basics/sort_ex1.py | 777 | 4.59375 | 5 | #!/usr/bin/python3
# Examples of using the sorted() function
# example function to be used as key by sorted function
def sortbylen(x):
return len(x)
# List to sort, first alphabetically, then by length
a = [ 'ccc', 'aaaa', 'd', 'bb']
# Orig list
print(a)
# Sorted ascending alphabetic
print(sorted(a))
# sorte... | true |
8da7f3ba63ae287850cb95fdaf6991da36855947 | GitLeeRepo/PythonNotes | /basics/python_sandbox01.py | 1,833 | 4.1875 | 4 | #!/usr/bin/python3
# Just a sandbox app to explore different Python features and techniques for learning purposes
import sys
def hello(showPrompt=True):
s = "Hello World!"
print (s)
#using slice syntax below
print (s[:5]) #Hello
print (s[6:-1]) #World
print (s[1:8]) #ello wo
print (s[1:-4]... | true |
66d407d714258a6aceea8e800a10ba5994af040a | ecastillob/project-euler | /101 - 150/112.py | 1,846 | 4.40625 | 4 | #!/usr/bin/env python
# coding: utf-8
"""
Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number;
for example, 134468.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.
We shall call a positive ... | true |
6a442bcbc6464c0e325b859b78633111ae48a649 | al0fayz/python-playgrounds | /fundamental/1-variabel.py | 1,045 | 4.3125 | 4 | #example variabel in python
x = 5
y = 2
kalimat = "hello world"
kalimat1 = 'hai all!'
print(x)
print(y)
print(kalimat)
print(kalimat1)
a , b , c = 1, 2, 3
text1, text2, text3 = "apa", "kabar", "indonesia?"
print(a, b, c)
print(text1, text2, text3)
result1 = result2 = result3 = 80
print(result1, result2, result3)
... | false |
cfcbe016443d6a8fa6bd958d56d8e49705269b81 | al0fayz/python-playgrounds | /fundamental/6-tuples.py | 726 | 4.3125 | 4 | #contoh tuples
"""
tuples bersifat ordered, tidak bisa berubah, dan dapat duplicate
"""
contoh = ("satu", "dua", "tiga", "tiga")
print(contoh)
#acces tuples
print(contoh[0])
print(contoh[-1])
print(contoh[1:4])
#loop tuples
for x in contoh:
print(x)
#check if exist
if "satu" in contoh:
print("yes exist")
#... | false |
7643854c54690814e2744e3cd80bc02ec02770e1 | aaryanredkar/prog4everybody | /L1C2_Fibonacci.py | 229 | 4.28125 | 4 | Value = int(input("Please enter MaxValue for Fibonacci sequence : "))
print ("The fibonacci sequence <=",Value, "is: ")
a, b = 0, 1
temp = 0
print ("0 ")
while (b <= Value):
print (b)
temp = a+b
a = b
b = temp
| false |
3ef7c91a7f379e5b8f4f328c0e79a9238d6bce08 | aaryanredkar/prog4everybody | /project 2.py | 327 | 4.3125 | 4 | first_name = input("Please enter your first name: ")
last_name = input("Please enter your last name: ")
full_name = first_name +" " +last_name
print("Your first name is:" + first_name)
print("Your last name is:" + last_name)
print ("Your complete name is ", full_name)
print("Your name is",len(full_name) ,"characters ... | true |
dd6b6c00d59cb5a26089744badf9ac3e3588e7c7 | davronismoilov/pdp-1-modul | /task 6_2.py | 489 | 4.1875 | 4 | """Standart kiruvchi ma'lumotdagi vergul bilan ajratilgan so'zlar ketma-ketligini teskari tartibda chiqaradigan dastur tuzing
Masalan: Ismlar: john, alice, bob
Natija: bob, alice, john"""
words = input("Vergul bilan ajratib so'zlar kiriting:\n Ismlar: ").split(sep=",")
#First metod sl... | false |
b8ab12a52930764e694596ad1c4ec4346fb82590 | pankajmore/AI_assignments | /grid.py | 1,243 | 4.15625 | 4 | #!/usr/bin/python
class gridclass(object):
"""Grid class with a width, height"""
def __init__(self, width, height,value=0):
self.width = width
self.height = height
self.value=value
def new_grid(self):
"""Create an empty grid"""
self.grid = []
row_grid = []
... | false |
6cd1676e716a609f138136b027cbe6655c7292a4 | obrienadam/APS106 | /week5/palindrome.py | 1,178 | 4.21875 | 4 | def is_palindrome(word):
return word[::-1] == word
if __name__ == '__main__':
word = input('Enter a word: ')
if is_palindrome(word):
print('The word "{}" is a palindrome!'.format(word))
else:
print('The word "{}" is not a palindrome.'.format(word))
phrase = input('What would you li... | true |
ab1df5f6495bf2de81da4b47c6f82acf8b9645ae | aaskorohodov/Learning_Python | /Обучение/Set (множество).py | 477 | 4.15625 | 4 | a = set()
print(a)
a = set([1,2,3,4,5,"Hello"])
print(a)
b = {1,2,3,4,5,6,6}
print(b)
a = set()
a.add(1)
print(a)
a.add(2)
a.add(10)
a.add("Hello")
print(a)
a.add(2)
print(a)
a.add("hello")
print(a)
for eo in a:
print(eo)
my_list = [1,2,1,1,5,'hello']
my_set = set()
for el in my_list:
my_set.add(el)
... | false |
e0dd4c5a6ead7cd585d9d4cf387e6d4c8849accb | riterdba/magicbox | /cl11.py | 283 | 4.125 | 4 | #!/usr/bin/python3
class Square():
def __init__(self, a):
self.a = a
def __repr__(self):
return ('''{} на {} на {} на {}'''.format(self.a, self.a, self.a, self.a))
sq1 = Square(10)
sq2 = Square(23)
sq3 = Square(77)
print(sq1)
print(sq2)
print(sq3)
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.