blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
b73a34f8f888832ca2cbb635f9a6224f817cd0ad | Harry-003/Python_programs | /Q1.py | 340 | 4.25 | 4 | """
Write Python Program (WPP) to enter length and breadth of a rectangle and calculate area and perimeter of the rectangle.
"""
length = int(input("Enter length of rectangle : "))
width = int(input("Enter width of rectangle : "))
print("Area of Rectangle : ",length*width)
print("Perimeter of Rectangle : "... | true |
fd1d2e3977059ca1e86fd5b737c59d071adce2ce | Harry-003/Python_programs | /Q10.py | 442 | 4.1875 | 4 | """
WPP to enter principal amount, time and interest rate. Create simple_interest(principal, time, rate) function to calculate simple interest.
"""
amount = int(input("Enter principal amount: "))
time = int(input("Enter time period: "))
interest = float(input("Enter interest rate: "))
simple_interest(amount... | true |
4009f92fb3d3736b251a9d8fed74ed764b2165f1 | jobfb/Python_introdution | /diagonal_negativos.py | 708 | 4.125 | 4 | #Fazer um programa para ler um numero inteiro N (no maximo 10 ) e uma matriz quadrada de ordem N contendo numeros inteiros
#Em seguida mostrar a diagonal principal
#Dizer quantos valores negativos a matriz possui
N: int
neg: int
N = int(input("Qual a ordem da matriz? "))
mat: int = [[0 for x in range(N)] f... | false |
53f738d22b7635743d2727d49bce37e3efe3d271 | DianaBelePublicRepos/PythonBasics | /Challenges/Anagrams.py | 337 | 4.15625 | 4 | #Check if a string is an anagram or not - use sorted to sort the string, then compare
def check(s1, s2):
# The sorted strings are checked
if (sorted(s1) == sorted(s2)):
print("The strings are anagrams.")
else:
print("The strings aren't anagrams.")
# Driver code
s1 = "listen"
s2 = "sile... | true |
53811f309fabe46e1dfc343046983a1befe95f97 | duttasamd/pylearn | /05_features.py | 1,075 | 4.125 | 4 | # GENERATORS
# Generators are more efficient than lists.
#list comprehension
# this is a list object
squares_list = [x * x for x in range(10)]
print(squares_list)
#this is a generator
squares_gen = (x*x for x in range(10))
print(squares_gen)
for square in squares_gen:
print(square)
# Performance enhancement de... | true |
364b97fa0fadea89bea705ec340699e549091303 | Miguelzm2001/introprogamacion | /Clases/clasesyobjetivos.py | 2,147 | 4.3125 | 4 | class Humano():
'''
Esta es la clase Humano exige atributos
nombreEntrada: Hace referencia al nombre del usuario
edadEntrada: Hace referencia al edad del usuario
estaturaEntrada: Hace referencia al estatura del usuario
Tiene las siguientes acciones:
*hablar(mensaje):
... | false |
2ce22e64173151b7603f1089718ffb153e9233a2 | artOfThePigeon/RealPython_Projects | /Algorithms/2_main.py | 2,070 | 4.46875 | 4 | from random import randint
from timeit import repeat
def bubble_sort(array):
n = len(array)
for i in range(n):
#start looking at each item of the list one by one, comparing it with
#its adjacent value. With each iteration, the portion of the array that
#that you look at shrinks because... | true |
50929ac315ab9dea49c9bb134901bc945329fbcc | Utuska/Python_unit2_3 | /Unit2_3.py | 2,567 | 4.21875 | 4 | month = input("Введите месяц:")
if month:
date = int(input("Введите дату"))
if 1 <= date <= 31:
if 22 <= date <= 31 and month.lower() == 'декабрь':
print("Козерог")
elif 1 <= date <= 19 and month.lower() == 'январь':
print("Козерог")
elif 22 <= date <= 31 and mont... | false |
bb184a33455cb393128ecc7e30ea3104477c75a5 | samsharpy/odd-or-even-_-fizzbuss | /odd or even.py | 377 | 4.34375 | 4 | #created on 22/09/2019
#author: samuvel
a=int(input('enter the number to be found:'))#getting input
if(a%2==0 and a!=0):# wherther its even
print("the given number is even")
elif(a==0):# or 0
print ("the given number is neither odd nor even")
else:# if its not both its odd
print ("t... | true |
ed3b39932960c070388e691696cc97760591490e | shubhendutiwari/P_SomeLearningCode | /Overlapping.py | 870 | 4.1875 | 4 | """Define a function overlapping() that takes two lists and returns True if they have at least one member in common, False otherwise.
You may use your is_member() function, or the in operator, but for the sake of the exercise, you should (also) write it using two
nested for-loops."""
def overlapping(lst1, lst2):
... | true |
a3c58c1795bb7aa71bb490e1a85e4f6adb5997ab | MitenTallewar/Hacktoberfest2021_beginner | /Python3-Learn/get_seat_type.py | 947 | 4.40625 | 4 | def seat_type(seat_number = int(input("Enter the seat number: "))):
"""
input : - seat number (int)
return : - seat type (string)
Given a railway seat number, the task is to check whether it is a valid seat number or not.
Also print its berth type i.e lower berth, middle berth, upper berth, side low... | true |
942b796938f987092fa5fcd2b20356ef17b02c05 | edanyliuk/python-programming | /unit-3/func.py | 2,008 | 4.4375 | 4 | def add(num1, num2):
return num1 + num2
#you write a function to do something. Something it will return something and sometimes it doesn't.
#Use return for a function that calculates something - it gives you the answer
#this function adds two integers
print(add(5, 10)) #pass to print function
result = add(50, 20)... | true |
320f7189bac2eec0eb884a30a4630525f5dfe803 | edanyliuk/python-programming | /unit-2/strings.py | 782 | 4.28125 | 4 | #strings are immutable. We cannot change a string
#strings are iterable
movie_title = "Thor, the Dark World"
#print(movie_title[0])
#movie_title[5] = " - " #this is not allowed
#Once the string has been declared you cannot change it. You can re-assign movie_title
movie_title = "The Avengers"
#this is reassignment
... | true |
40716570b086a89c8a00ad893fc41055510855f3 | cgj333/46-Simple-Python-Exercises | /Simple exercises including I:O/36 - Hapax Legomenon.py | 813 | 4.21875 | 4 | '''
A hapax legomenon (often abbreviated to hapax) is a word which occurs only once in
either the written record of a language, the works of an author, or in a single text.
Define a function that given the file name of a text will return all its hapaxes.
Make sure your program ignores capitalization.
'''
import re
def ... | true |
02fd4c2cb3f7b69a83cb3175d529942edb7077fb | RaviC19/Rock-Paper-Scissors-Python | /rps_with_randint.py | 2,488 | 4.3125 | 4 | from random import randint
computer_wins = 0
player_wins = 0
winning_score = 5
while computer_wins < winning_score and player_wins < winning_score:
player = input("What is your choice? ").lower()
computer = randint(0, 2)
if computer == 0:
computer = "Rock"
elif computer == 1:
computer... | true |
06d6c817d9d80510b2c57535396565b1770da24a | yi-mei-wang/boggle | /boggle_dictionary.py | 1,604 | 4.5625 | 5 | def binary_search(target, my_list):
""" Searches for a target in a sorted list recursively.
Uses the binary search algorithm. Target is compared to the midpoint. If the former is not found, compare it to the latter. Depending on whether the target is smaller or larger than the midpoint, the irrelevant portion ... | true |
87643d55fcc9ef5676e8a23fac85eea467de119a | surfer190/fixes | /calculate_age.py | 874 | 4.28125 | 4 | def get_age_in_days(age_in_years: int) -> int:
'''
Calculate the age in days
'''
return age_in_years * 365
def get_age_in_hours(age_in_years: int) -> int:
'''
Calculate the age in hours
'''
return age_in_years * 365 * 24
def get_age_in_seconds(age_in_years: int) -> int:
'''
Cal... | false |
954daabc6726320661a914cb8ac2274452136788 | shiden/Fundamentals-of-Computing-Python | /scripts/wk1b_prac06.py | 1,442 | 4.1875 | 4 | #Write a Python function name_and_age that take as input the parameters name
#(a string) and age (a number) and returns a string of the form "% is % years
#old." where the percents are the string forms of name and age. The function
#should include an error check for the case when age is less than zero. In this
#case, t... | true |
e25d7289cb317ac1b113e9e0c1ec9807c1b020e9 | shiden/Fundamentals-of-Computing-Python | /scripts/wk1_prac01.py | 1,207 | 4.53125 | 5 | # Compute the number of feet corresponding to a number of miles.
##Write a Python function miles_to_feet that takes a parameter miles and
#returns the number of feet in miles miles. Miles to feet template --- Miles
#to feet solution --- Miles to feet (Checker)
#There are 5280 feet in a mile, because one mile is defin... | true |
0de5ba0c7108aa7cb12999eab3996a5bde3f4144 | shiden/Fundamentals-of-Computing-Python | /scripts/wk1_prac09.py | 1,229 | 4.21875 | 4 | #Write a Python function name_and_age that takes as input the parameters name
#(a string) and age (a number) and returns a string of the form "% is % years
#old." where the percents are the string forms of name and age. Reference the
#test cases in the provided template for an exact description of the format of
#the re... | true |
df1de6157d40997931980aa3a079cb4e7bad68f2 | techkids-c4e/c4e5 | /MinhQuang(c4e)/BTVN 6-7-2016/wave1.py | 548 | 4.125 | 4 | hanoi = {"name":"Hanoi",
"longt":50,
"lat": 75}
haiduong = {"name" : "HaiDuong",
"longt" : 25,
"lat":10}
class City:
def __init__(self,name,longt,lat):
self.name = name
self.longt = longt
self.lat = lat
def calculateDistance(self, other):
... | false |
d09a5f5fd329573e8d3abcce043a6314132baa85 | techkids-c4e/c4e5 | /Minh Đức/BTVN 26.6/Session 5-3.py | 434 | 4.1875 | 4 | from turtle import*
shape('turtle')
speed(0)
def draw_star(x,y,length):
penup()
forward(x)
left(90)
forward(y)
right(90)
pendown()
for a in range(5):
forward(length)
right(144)
x=float(input('Please enter x for the location of the star: '))
y=float(input('Please enter y... | true |
ada0c491f7fe246f2d45f314d089315c6d5d8a73 | ibreezzy/Calculating-Areas | /assignment4.py | 1,298 | 4.21875 | 4 | #This program is designed to calculate the area of a square
print('This calculator helps you calculate the area of a square')
Length = float(input('What is the length?: '))
Area = Length ** 2
print('Area',(round(Area,2)))
#This program is designed to calculate the area of a trapezoid
print('This calculator help... | true |
64fd6ba274469c08aa1bb70cca66d3b46923d7a3 | congxinxu0116/CMU15112 | /Week 2/GraphicsPart1.py | 1,028 | 4.3125 | 4 | # Graphics in Tkinter Part 1
# Create an Empty Canvas
from tkinter import *
def draw(canvas, width, height):
# create_line (x1, y1, x2, y2) draws a line
# from (x1, y1) to (x2, y2)
canvas.create_line(25, 50, width/2, height/2)
def runDrawing(width=300, height=300):
root = Tk()
root.resizable(w... | true |
2afcaddebc7cbfbeb2898a0ac8190cfcf6f18fbf | zhangpenghui1122/warehouse | /123/02_第二周-周测题目(1).py | 2,604 | 4.25 | 4 | """
选择题(每题10分 ,共50分)
1. 关于面向过程描述正确的是:( C )
A: 根据需求划分职责,然后交给不同程序员完成。
B:根据职责划分任务,然后专人实现。
C:根据解决问题步骤,然后逐步实现。
D:使用函数屏蔽过程,彰显实现细节。。
2. 关于面向对象描述正确的是:( A )
A:使用封装、继承、多态的特点解决问题
B:使用分而治之、变则疏之、高内聚、低耦合的理念解决问题
C:主要考虑算法+数据结构
D:根据需求,划分给多个程序员共同完成。
3. class MyClass:( D )
def __init__(qtx,a,b=””):
qtx.a = a
qtx.b = b
qtx.c = 100
关... | false |
8c222dd730d84b29c382da7b854387d83520ee1e | Chen-Wei-Ming/Python-Learn | /lesson1.py | 331 | 4.5 | 4 | # 變數建立
# create a var
# var is a integer
var = 1
print(var)
# var is a float
var = 1.0
print(var)
# var is a character
var = '1'
print(var)
# var is a String
var = 'string'
print(var)
# var is a Array
var = ['array1' , 'array2' , 'array3']
print(var)
# print item which in var array
for item in var :
print(ite... | false |
6f69325321dc16a417bd2c4ce3dffb7093a17dcb | henrylin2015/python | /fun.py | 1,376 | 4.5 | 4 | #!/usr/bin/env python3
# _*_ coding: utf-8 _*_
r'''
learning.py
A Python 3 tutorial from http://www.liaoxuefeng.com
Usage:
python3 learning.py
'''
import sys
def check_version():
v = sys.version_info
if v.major == 3 and v.minor >= 4 :
return True
print('Your current python is %d.%d.Please use P... | false |
cab76a4130e1086f188dd21acecf89de713d0c4f | ferasmis/Volume-of-a-Sphere | /Exercise2.2.1.py | 222 | 4.65625 | 5 | ## Author: Feras
## Description: Find the volume of a sphere using a radius from user input
radius = float(input('Enter a radius of a sphere:\n'))
pi = 3.14
volume = (4/3) * pi * radius**3
print('Volume is %.2f' % volume) | true |
853eda5e2b9223cd378c3d226bfe37ebf63f240a | vinayakasg18/algorithms | /InsertionSortSwap.py | 719 | 4.1875 | 4 | class InsertionSort:
""" Function to sort the input array using Insertion Algorithm """
def insertionsort(self, a):
if not a:
return []
# 0 1 2 3 4 5
# [5, 2, 4, 1, 0, 2]
# [2, 5, 4, 1, 0, 2]
# [2, 4, 5, 1, 0, 2]
for index in range(1, len(a)):
... | true |
b5d5c25d75cced8bdfd281754ed0bd0fe3735d48 | leo-skinner/CursoEmVideoPython | /CursoEmVideo/Mundo1/Exercicios/Exe022_Upper_Lower_Split.py | 767 | 4.28125 | 4 | #Crie programa que leia o nome completo e mostre:
#- O nome com Uppercase
#- O nome com Lowercase
#- Quantas letras ao no total, sem considerar espaços
#- Quantas letras tem o primeiro nome.
nome = str(input('Digite seu nome completo: ')).strip() #para eliminar possíveis espaços no início e final da string.
p... | false |
263289f824eb0bf43a79195cdb8117b6ff90f921 | sdsunjay/interviews | /battleship/script.py | 2,023 | 4.15625 | 4 | # import random module
import random
def create_board():
board = []
for i in range(0, 5):
board.append(["0"] *5)
return board
def print_board(board):
for i in board:
print(" ".join(i))
def random_row(board):
return random.randint(0,len(board)-1)
def random_col(board):
return... | false |
25080e32b5e28b89120d552832cd3994ecd5c1f6 | ryanedmonds2000/VizualizeSorts | /Sorts/utils.py | 206 | 4.125 | 4 | # Helper functions
def swap(list, i, j):
""" Swaps the elements in indexes i and j in the given list. Updates
list without returning """
temp = list[j]
list[j] = list[i]
list[i] = temp
| true |
db879c56aae573f4992b56471cca3deb6c4725e3 | varghesetom/Sweigart_Inspired_Games | /pygameHelloWorld.py | 2,145 | 4.3125 | 4 | '''The following is directly from the Al Sweigart book. I typed out the commands for practice on using pygame '''
import pygame, sys
from pygame.locals import *
## set up pygame
pygame.init()
# set up window
windowSurface = pygame.display.set_mode((500,400), 1, 8)
pygame.display.set_caption("Hello World!")
# Set up... | true |
642ba2a0b4ca733364d96c89e629e51d017c2ca1 | conanchiao/Ling-Ji-Chu-Xue-Python-Yu-Yan-CAP | /Unit 4 Python编程之控制结构/maxn.py | 380 | 4.1875 | 4 | # maxn.py
# 寻找一组数中的最大值
def main():
n=eval(input("How many numbers are there?"))
max=eval(input("Enter a number >> ")) #将第一个值赋值给max
for i in range(n-1):
x=eval(input("Enter a number >> ")) #连续与后边n-1个值比较
if x>max:
max=x
print("The largest value is ", max)
ma... | false |
e2ef90c5f2b66c44c6f3189dd6257ea1182b4cfa | DvC99/Ahoy-Capitan | /main.py | 2,456 | 4.21875 | 4 | """ Programa para apoyar al marinero Seijo
Daniel Valencia Cordero
Mayo 3-2021 """
import utilidades as util
#======================================================================
# Algoritmo principal Punto de entrada a la aplicación (Conquistar)
# =========================================================... | false |
e24920a841c579ae46d74a759d9148c858222ea4 | johnson365/python | /Design Pattern/Observer.py | 1,986 | 4.1875 | 4 | """Implementation of Observer pattern"""
from abc import ABCMeta, abstractmethod
class Subject:
"""The abstract class of Subject put all Observer object in a collection!"""
def __init__(self):
self.observers = []
def attachObserver(self, observer):
"""add a observer into obser... | true |
49e7315a2a6e91ade9a8a35d7be559f715f0cea4 | MashinaSSokom/Geek | /Ashimov_Sultan_dz_2/task_2_4.py | 436 | 4.15625 | 4 | names = ['инженер-конструктор Игорь', 'главный бухгалтер МАРИНА', 'токарь высшего разряда нИКОЛАй', 'директор аэлита']
for name in names:
temp = name.split()
print(f'Привет, {temp[-1].capitalize()}!')
print(f'Твоя должность {" ".join(temp[:-1])}?') #Решил не выкидывать должности и немного усложнить задание... | false |
d37eec249f9eae3f11d1eff5939199c62054ffaf | JSheldon3488/Daily_Coding_Problems | /Chapter6_Trees/6.3_Evaluate_Arithmetic_Tree.py | 2,033 | 4.15625 | 4 | """
Date: 7/7/20
6.3: Evaluate Arithmetic Tree
"""
class Node():
""" Node class used for making trees """
def __init__(self, val, left = None, right = None):
self.val = val
self.left = left
self.right = right
'''
Problem Statement: Suppose an arithmetic expression is given as a binary t... | true |
4ec43707554a617f2211609ec94ab0fbc756e70f | JSheldon3488/Daily_Coding_Problems | /Chapter4_Stacks_and_Queues/Stack.py | 1,565 | 4.21875 | 4 | class Stack:
"""
A basic Stack class following "last in, first out" principle. Supports methods push, pop, peek, and size. The stack is
initialized as empty.
Attributes:
Size: Keeps track of the size of the stack
"""
def __init__(self):
"""
Initializes the stac... | true |
ef6fa04462315f367b3d91186bbf2f3ed48fb559 | JSheldon3488/Daily_Coding_Problems | /Chapter8_Tries/8.2_PrefixMapSum.py | 2,066 | 4.25 | 4 | """
Date: 7/26/20
8.2: Create PrefixMapSum Class
"""
'''
Problem Statement:
Implement a PrefixMapSum class with the following methods:
def insert(key: str, value: int) Set a given key's value in the map. If the key already exists overwrite the value.
def sum(prefix: str) Return the sum of all values of keys th... | true |
608ed5c38e186df1ef955933bf6c77a3aa340ef1 | ARON97/Desktop_CRUD | /backend.py | 1,676 | 4.28125 | 4 | import sqlite3
class Database:
# constructor
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS book (id INTEGER PRIMARY KEY, title text, author text, year integer, isbn integer)")
self.conn.commit()
def insert(self, title, au... | true |
67dac92e4e07eba726e5a200454f12b1656945e4 | VittorLF/progr1ads | /Lista 5/Lista 5 Ex1.py | 369 | 4.125 | 4 | # 1 - Faça um programa que peça uma nota, entre zero e dez. Mostre uma mensagem casoo valor seja inválido e continue pedindo até que o usuário informe um valor válido.
while True:
user = float(input('Insira um numero entre zero e dez: '))
if user >= 0 and user <= 10:
print(user)
break
else... | false |
83b5a4195d0edbeb10c0693f7f68bb63d2430386 | sun1day/leetcode | /lt_2020_6_16/square_root.py | 1,182 | 4.4375 | 4 | """
实现 int sqrt(int x) 函数。
计算并返回 x 的平方根,其中 x 是非负整数。
由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。
示例 1:
输入: 4
输出: 2
示例 2:
输入: 8
输出: 2
说明: 8 的平方根是 2.82842...,
由于返回类型是整数,小数部分将被舍去。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/sqrtx
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
def square_root(x: int) -> int:
# todo pas... | false |
35541f5ca6badb364ae278e121a7b82155188361 | sun1day/leetcode | /lt_2020_4_20/shou_suo_cha_ru_wei_zi.py | 1,186 | 4.125 | 4 | """
给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
你可以假设数组中无重复元素。
示例 1:
输入: [1,3,5,6], 5
输出: 2
示例 2:
输入: [1,3,5,6], 2
输出: 1
示例 3:
输入: [1,3,5,6], 7
输出: 4
示例 4:
输入: [1,3,5,6], 0
输出: 0
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/search-insert-position
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
fro... | false |
5990428dbea6421d99b43c21c6c83c55f2617a59 | matthewmuccio/Assessment1 | /q1/run.py | 1,969 | 4.28125 | 4 | #!/usr/bin/env python3
import random
# Helper function that gets the number of zeroes in the given list.
def get_num_zeroes(x):
num = 0
for i in x:
if i == 0:
num += 1
return num
# Moves all the 0s in the list to the end while maintaining the order of the non-zero elements.
def move_zeroes(x):
length = le... | true |
95ba120923b093a6af9636f643f12719e0dee77e | angelinka/programming4DA | /week5/lab5DatastrTuple.py | 588 | 4.4375 | 4 | #Program creates a tuple that stores the months of the year, from that tuple create
#another tuple with just the summer months (May, June, July), print out the
#summer months one at a time.
#Author: Angelina B
months = ("January",
"February",
"March",
"April",
"May",
"... | true |
2bcf78b22555bc9db039525d2afb2fecae2fcce6 | caoxiang104/algorithm | /data_structure/Linked_List/Singly_Linked_List.py | 2,847 | 4.1875 | 4 | # coding=utf-8
# 实现带哨兵的单链表
class LinkedList(object):
class Node(object):
def __init__(self, value, next_node):
super(LinkedList.Node, self).__init__()
self.value = value
self.next = next_node
def __str__(self):
super(LinkedList.Node, self).__str__()... | true |
62540e1e6192619838f134c1499907cbf03cf019 | XuQiao/codestudy | /python/pythonSimple/list_comprehension.py | 309 | 4.1875 | 4 | listone = [2,3,4]
listtwo = [2*i for i in listone if i>3]
print (listtwo)
def powersum(power, *args):
'''Return the sum of each arguments raised to specified power'''
total = 0
for i in args:
total = total + pow(i,power)
return total
print (powersum(1,23,34))
print (powersum(2,10))
| true |
80fd1179076556a77d87ebe6aae78c2edd03ddf5 | jhobaugh/password_generator | /password_generator.py | 822 | 4.1875 | 4 |
# import random, define a base string for password, name, and characters in password
import random
password = ""
name = ""
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!#$%&"
# while loop to ensure a password is outputted
while password == "":
# limit input
limit = int... | true |
49a2f2e2c4b0da26013b635c66045373ad9e2654 | xchmiao/Leetcode | /Tree/145. Binary Tree Postorder Traversal.py | 2,366 | 4.15625 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
## Solution-1
'''
1.1 Create an empty stack
2.1 Do following while root is not NULL
a) Push root's right child and then root to stack.
b) Set... | true |
ec8e857911afcc4b2e7c74377913639f5a4b964c | zheguang/fun-problems | /longest_common_sequence.py | 1,503 | 4.21875 | 4 | #!/usr/bin/env python
# Longest common sequence
# Given two strings, the task is to find the longest common sequence of letters among them.
# The letters do not have to be next to each other in the original string.
# E.g. C D E F G A B
# D E G B R T Z
# output: D E G B
#
# It is interesting to compare this proble... | true |
62715dc8bbb9f658cb9f6db7318614dc4843b630 | trianglesis/myRefferences | /languages/python/datetime/working_hours.py | 728 | 4.125 | 4 | import datetime
now = datetime.datetime.now().replace(second=0, microsecond=0)
morning = now.replace(hour=7)
evening = now.replace(hour=19)
print(f'Dates: {morning} - {now} - {evening}')
print(f'now > morning = {now > morning}')
print(f'now < morning = {now < morning}')
print(f'morning > now = {morning > now}')
prin... | false |
a2da9360fd828ab92db4f8f4b7d13c25327309e4 | ruslanfun/Python_learning- | /if_elif3.py | 360 | 4.25 | 4 | # Ask the user to enter a number between 10 and 20 (inclusive).
# If they enter a number within this range, display the message “Thank you”,
# otherwise display the message “Incorrect answer”
number = int(input("enter a number between 10 and 20: "))
if number >= 10 and number <= 20:
print('thank you')
else:
p... | true |
1223e8cd384e5be4bf36329a22e85c3b538522b7 | Priya-Mentorship/Python4Everybody | /arrays/adding.py | 427 | 4.1875 | 4 | import array as arr
numbers = arr.array('i', [1, 2, 3, 5, 7, 10])
# changing first element
numbers[0] = 34
print(numbers) # Output: array('i', [0, 2, 3, 5, 7, 10])
# changing 3rd to 5th element
numbers[2:5] = arr.array('i', [4, 6, 8])
print(numbers) # Output: array('i', [0, 2, 4, 6, 8, 10])
numbers.ap... | true |
8f6d3c5ab8ca31a8aaba3fb47e7234f0fa0c95c6 | onuratmaca/Data-Analysis-w-Python-2020 | /compliment.py | 583 | 4.6875 | 5 | #!/usr/bin/env python3
"""
Exercise 2 (compliment)
Fill in the stub solution to make the program work as follows.
The program should ask the user for an input, and the print an answer as the examples below show.
What country are you from? Sweden
I have heard that Sweden is a beautiful country.
What country are you ... | true |
bb24c91663b4d3b52360a20fe35942c92daf7904 | erarpit/python_practise_code | /secondprogram.py | 324 | 4.125 | 4 | print('A program for print list function')
list = [ 2,4,5,5,5,6,'hello','ratio' ]
print(list)
print(list[4])
list.remove('hello')
print(list)
list.append('my')
print(list)
print(list[3:8])
newlist = list.copy()
print(newlist)
print(newlist.count(6))
print(newlist)
list.index('my')
print("printlist:",list)... | true |
4c9449f99ddf27fc6ae1ec687531231321e9f70d | luc14/coding_practice | /fizzbuzz.py | 1,310 | 4.28125 | 4 | '''generates, translates and prints Fibonacci numbers
'''
def generate_fibonacci(n):
'''yields n fibonacci numbers.
'''
for i in range(n):
if i < 2:
yield 1
continue
if i == 2:
f1, f2 = 1, 1
f1, f2 = f2, f1+f2
yield f2
def is_prime(n):
... | false |
9573ba807776f8906f1da9e66a0f5c9ec2d6979f | blackviking27/Projects | /text_based_adventure.py | 2,162 | 4.25 | 4 | # text based adventure game
print("Welcome to text adventure")
print("You can move in two directions left and right and explore the rooms")
print("but you cannot go beyond the rooms since it is not safe for you as of now")
print("r or right to go in right direction")
print("l or left to go in left direction")
room=[1,2... | true |
e3e5eeb60adb1ad74935c816db64847c71e7bf98 | khadley312/NW-Idrive | /Exercise Files/Ch2/variables_start.py | 564 | 4.3125 | 4 | #
# Example file for variables
#
# Declare a variable and initialize it
f=0
print(f)
# # re-declaring the variable works
f="abc"
print(f)
# # ERROR: variables of different types cannot be combined
print("this is a string" + str(123))
# Global vs. local variables in functions
def someFunction():
global f #this m... | true |
2e003018aa4a1511f5cb3a1e18202e5c2e47b0b5 | marsbarmania/ghub_py | /codingbat/Logic-1/near_ten.py | 464 | 4.125 | 4 | # -*- coding: utf-8 -*-
# Given a non-negative number "num",
# return True if num is within 2 of a multiple of 10.
# Note: (a % b) is the remainder of dividing a by b,
# so (7 % 5) is 2.
def near_ten(num):
remainder = num
while remainder > 10:
remainder %= 10
# print "remainder: ",remainder
return True if... | true |
155580584152bc4acf0d52f76e7ee6491b4739dc | ananyapoc/CPSC230 | /CPSC230/APochiraju_2/newvolume.py | 459 | 4.3125 | 4 | #this is to calculate the volume of a cylinder
import math
#asking the user for inputs
r=int(input("give me a length for the radius of the cylinder"))
#stating conditions for radius
if(r==0):
print("please do not give zero")
elif(r!=0):
h=int(input("give me a length for the height of the cylinder"))
#stating co... | true |
39d4e818838bb596e46ed641193a64392a3f25e0 | barbmarques/HackerRank-Python-Practice | /Basic_Python_Challenges.py | 1,285 | 4.4375 | 4 | # Print Hello, World!
print("Hello, World!")
# Given an integer,n, perform the following conditional actions:
-- If n is odd, print Weird
-- If n is even and in the inclusive range of 2 to 5, print Not Weird
-- If n is even and in the inclusive range of 6 to 20, print Weird
-- If n is even and greater than 20, print ... | true |
d0bf27b5664a52879314a298c25e0d17e1e613d5 | luizfelipe-on/Python_intro | /Exercicios/Aula8/exercicio5_aula8.py | 1,410 | 4.1875 | 4 | class Ponto:
""" Cria um Ponto com coordenadas x, y """
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __str__(self):
return "({0}, {1})".format(self.x, self.y)
class Retangulo:
""" Cria um Retângulo com altura, largura e vértices """
def __init__(self, largura=0... | false |
bf747305bacb8c2e43dbe99c1cbc3ac6177fc808 | luizfelipe-on/Python_intro | /Exercicios/Aula9_Listas/exercicio1a_listas.py | 438 | 4.15625 | 4 | # Função modificadora que dobra o valor dos elementos de uma lista:
def dobrar_elementos(lista):
clone_lista = lista[:]
for (i, valor) in enumerate(clone_lista):
valor_dobrado = 2 * valor
clone_lista[i] = valor_dobrado
print('lista de entrada:', lista)
print('lista dobrada:', clone_lista... | false |
08d1d54fb84923904a94599150c528974fe86b3c | adid1d4/timer | /timer.py | 1,114 | 4.15625 | 4 | '''
what should it do?
it should decrease the seconds on the same line
after the seconds go to 0, it should decrease a minute and get 59 on the seconds
after this the iteration should repeat itself for the seconds
when the minutes get to 0, the hour should decrease by 1, the minutes to 59, seconds to 59
and the i... | true |
6a3afca3067a704a06be3892fdc773b16054bc69 | njounkengdaizem/eliteprogrammerclub | /capitalize.py | 962 | 4.34375 | 4 | # write a simple program that takes a sentence as input,
# returns the capitalized for of the sentence.
#############################################################
result = "" # an empty string to hold the resulting string
sentence = input("Enter a word: ") # gets inputs from the ... | true |
c24e526cf07e7c920a5c17e277d1730235438d95 | vvp-lab/GB-VVP | /lesson1/task6.py | 1,135 | 4.40625 | 4 | # 6. Спортсмен занимается ежедневными пробежками. В первый день его результат составил a километров. Каждый день спортсмен увеличивал результат на 10 % относительно предыдущего. Требуется определить номер дня, на который результат спортсмена составит не менее b километров. Программа должна принимать значения параметров... | false |
532d97e98be271d59021622e0273c57447a50cc9 | vvp-lab/GB-VVP | /lesson2/task2.py | 945 | 4.1875 | 4 | # 2. Для списка реализовать обмен значений соседних элементов, т.е. Значениями обмениваются элементы с индексами 0 и 1, 2 и 3 и т.д.
# При нечетном количестве элементов последний сохранить на своем месте. Для заполнения списка элементов необходимо использовать функцию input().
text = input('Введи список значений и раз... | false |
43f899162d4df281c17ff7cb00f75a6e0506483f | vvp-lab/GB-VVP | /lesson8/task2.py | 1,100 | 4.21875 | 4 | #Lesson 8 task 2
"""
Создайте собственный класс-исключение, обрабатывающий ситуацию деления на нуль.
Проверьте его работу на данных, вводимых пользователем.
При вводе пользователем нуля в качестве делителя программа
должна корректно обработать эту ситуацию и не завершиться с ошибкой.
"""
class OopsDivisionByZero(Exc... | false |
7d2ca4711e013e5493e0532ad89d5c10380d73c3 | mikestrain/PythonGA | /firstPythonScript.py | 349 | 4.28125 | 4 |
print("this should be printed out")
#this is a comment
# print("The number of students is "+str(number_of_students))
# print(3**3)
number_of_students = 6
number_of_classes = 10
total = number_of_students + number_of_classes
print('number of students + number of classes = ' + str(total))
print('number of students +... | true |
725e62fb19f409922b89b8cbfc94669976130255 | 17c23039/The-Unbeatable-Game | /main.py | 2,939 | 4.375 | 4 | from time import sleep
import random
score = int(0)
print("Rock Paper Scissors, Python edition! This project is to see how complicated and advanced I can make a RPS game.")
sleep(3)
print("When it is your turn, you will have three options. [R]ock, [P]aper and [S]cissors! For a loss you will lose a point, a tie it will... | true |
c92a73c69f718e8cf44b3ea989ef34a401513bc1 | ArtemKhmyrov/Python | /Циклы3-12.py | 1,098 | 4.125 | 4 | n = int(input("Введите размерность массива NxN: "))#ввод
X = int(input("Введите X: "))#ввод
a = []#создаем пустой список
for i in range(n):#генерируем
b = []#создаем временную переменную
for j in range(n):#генерируем столбец
x = input()#вводим столбец
b.append(x)#заносим в список
... | false |
a95825d0e3dc02402740bfaf5edb01235682e24a | talhatepe/pyhton-lectures | /week1/hw1.py | 686 | 4.28125 | 4 | while True:
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
print("Select operation.")
choice = input("Enter choice('+' '-' '/' '*'):")
num1 = int(input("Enter first number: "))
num2 = int(... | false |
79b98689566b207db2031eb5b883f6d1a78b9dd3 | siyer13/Python | /hacker_rank/list_commands.py | 1,357 | 4.1875 | 4 | # https://www.hackerrank.com/challenges/python-lists/problem
my_list = []
def insert(lst, a, e):
i = int(a)
lst.insert(i, e)
return lst
def append(lst, e):
lst.append(e)
return lst
def sort(lst):
lst.sort()
return lst
def print_list(lst):
print(lst)
def remove(lst, e):
lst... | false |
7250d2b24e69dce512edb4f99cb2710e770c1d80 | buggy213/ML-120_Materials | /Unit-035/traditional_five_starter.py | 2,620 | 4.1875 | 4 | import random
import sys
# We will be using the following encoding for rock, paper, scissors, lizard, and Spock:
# Rock = 0
# Paper = 1
# Scissors = 2
# Lizard = 3
# Spock = 4
#
# Fill in the below method with the rules of the game.
# determineWinner is a structure called a method. The code in th... | true |
ac65076020ab2a9aa50ee4ea7f31679a90cdf949 | The-SS/parallel_python_test | /parallel_py_test.py | 2,517 | 4.25 | 4 | # Author:
# Sleiman Safaoui
# Github:
# The-SS
# Email:
# snsafaoui@gmail.com
# sleiman.safaoui@utdallas.edu
#
# Demonstrates how to use the multiprocessing.Process python function to run several instances of a function in parallel
# The script runs the same number of instance of the function in series and parallel ... | true |
ce8c2b43b52665cb4c391dd30b8b088a7192916c | nicholasinatel/Python-Snippets | /00 - Basico/04_ObjectsInMemory.py | 832 | 4.34375 | 4 | # Objetos e Referencias Na Memoria
# Em Python Strings Sao Imutaveis
# Portanto a && b estao apontando para o mesmo bloco de memoria
a = "banana"
b = "banana"
test = a is b # Retorna True Por Estar Apontando para o mesmo bloco de memoria ja que strings sao imutaveis
print(test)
#__________________________________
d... | false |
a6bda81a2698b6e44e5a693e4b9c4797e481949a | lsifang/python | /python变量/python基础_集合交并.py | 743 | 4.125 | 4 | #--------------------#
# 1、set.intersection(otherset) 注意注意:与&运算符一样&&&&&&&
# 另外:返回的交际集合与最前边的集合类型一样如可变或不可变
#新知识:Intersection()可与其他可迭代对象起作用如字符串\元组\列表.注意的是把这些可迭代对象先转换为集合在进行运算
# &
# &
# &
# 2、set.intersectionupdate(otherset)...把交集付给原集合(set)
s1={1,2,3,4,5}
s2={4,5,8,6,12}
s=s1.intersection(s2)
s3=s1 & s2
print(s)
print(s3)
... | false |
f00e5943faeff177c285ca990e8f6a51be585ec3 | manickaa/CodeBreakersCode | /Recursion/fibonacci.py | 544 | 4.125 | 4 | def fibonacciMemo(n, fib_dict):
if n in fib_dict:
return fib_dict[n]
else:
result = fibonacciMemo(n-1, fib_dict) + fibonacciMemo(n-2, fib_dict)
fib_dict[n] = result
return result
def fibonacciBottomUp(n):
dp = [0] * (n+1)
dp[0] = 1
dp[1] = 1
for i in range(2, n+1... | false |
21dc4be25dccbeef4651870eee09042c189427be | paulyun/python | /Schoolwork/Python/To Be Graded/Project3/TestScoreAverage.py | 707 | 4.21875 | 4 | #Test Score Average
#Paul_Yun CS_902 Spring 2016
test_score_one = float(input("Enter your first test score"))
test_score_two = float(input("Enter your second test score"))
test_score_three = float(input("Enter your three test score"))
test_score_average = (test_score_one + test_score_two + test_score_three) / 3
... | false |
cef145f7edee15add71fd819ba64d39c7cb2f052 | paulyun/python | /Schoolwork/Python/In Class Projects/3.10.2016/InClassActivity_3.10.2016.py | 390 | 4.1875 | 4 | #In class Activity for 3/10/2016
totalTime = int(input ("Enter a time in seconds"))
resultMinutes = int(totalTime / 60) #this function divides the users totaltime by 60 to get the minute value
resultSeconds = totalTime % 60 #this function gets the remainder value of the totaltime divided by 60 to get the remaining se... | true |
27e0fcf49ea15c5bccf24a5858c85809fe5f022e | paulyun/python | /Schoolwork/Python/In Class Projects/5.17.2016/Palindrome.py | 268 | 4.21875 | 4 | def isPalindrome():
word = input("Please enter a word to see if it is Palindrome")
reverse = ""
for letter in range(len(word)-1, -1, -1): #range(start, stop, sequence)
reverse+=word[letter]
return reverse == word
print(isPalindrome()) | true |
1ac8cbf4abb9d670f1e38bb7cfb706f0f8326308 | Saksham-Bhardwaj/Password-Validation | /ValidationModule.py | 1,105 | 4.25 | 4 | #regex module
import re
#function to validate each password input
def checkPass(str):
if(len(str)<6 or len(str)>12):
print(str + " Failure password must be 6-12 characters.\n")
return
if not re.search("[a-z]", str):
print(str + " Failure password must contain at least one letter... | true |
2505d32f0cea8d1d6813edfcf2d87973e8524b77 | IMDCGP105-1819/text-adventure-Barker678 | /Player.py | 1,132 | 4.25 | 4 | class Player(object): #we create a Player class that affects the inventory of the player, the players name and given direction to the player.
def __init__ (self):
self.Player = Player
self.Name = "" #empty - for the players name
self.inventory = [] #we define the inventory/we need it for... | true |
112ead1004333cd0b246109dd25103e7e579820b | SpadinaRoad/Python_by_Examples | /Example_114/Example_114.py | 1,019 | 4.15625 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_114
# $ python3 Example_114.py
# $ python3 Example_114.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
114
Using the Books.csv fi... | true |
67e75bf152ecf46e74dfd00fcdfc7fa44523f85c | SpadinaRoad/Python_by_Examples | /Example_035/Example_035.py | 599 | 4.125 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_035
# $ python3 Example_035.py
# $ python3 Example_035.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
035
Ask the user to enter
... | true |
af64d3f5ecf4e84e40a4d58eeaf5112f12bf5595 | SpadinaRoad/Python_by_Examples | /Example_058/Example_058.py | 1,125 | 4.5 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_058
# $ python3 Example_058.py
# $ python3 Example_058.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
058
Make a maths quiz that... | true |
17110747677a3be407ce36d3a27a5d415d7d9432 | SpadinaRoad/Python_by_Examples | /Example_022/Example_022.py | 870 | 4.5 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_022
# $ python3 Example_022.py
# $ python3 Example_022.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
022
Ask the user to enter ... | true |
7603e32d8a1590523d33d29d2e331968e6881de0 | SpadinaRoad/Python_by_Examples | /Example_121/Example_121.py | 2,486 | 4.84375 | 5 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_121
# $ python3 Example_121.py
# $ python3 Example_121.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
121
Create a program that ... | true |
949e7b0d24b836761e0b5f326349dadd404c91c5 | SpadinaRoad/Python_by_Examples | /Example_120/Example_120.py | 2,377 | 4.59375 | 5 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_120
# $ python3 Example_120.py
# $ python3 Example_120.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
120
Display the following ... | true |
89696d06bfc3e0760c8fa983b4bdffa34a54a6a7 | SpadinaRoad/Python_by_Examples | /Example_087/Example_087.py | 628 | 4.71875 | 5 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_087
# $ python3 Example_087.py
# $ python3 Example_087.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
087
Ask the user to type i... | true |
59d41de6a817138dd30562aab81ef9e878ced7f1 | SpadinaRoad/Python_by_Examples | /Example_008/Example_008.py | 768 | 4.34375 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_008
# $ python3 Example_008.py
# $ python3 Example_008.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
008
Ask for the total pric... | true |
b674a22cbac308660674199958dda064260eeb78 | SpadinaRoad/Python_by_Examples | /Example_118/Example_118.py | 781 | 4.4375 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_118
# $ python3 Example_118.py
# $ python3 Example_118.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
118
Define a subprogram th... | true |
4cdf1d1b109601376c4046cd58fc940ba8a67ac0 | SpadinaRoad/Python_by_Examples | /Example_073/Example_073.py | 1,079 | 4.4375 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_073
# $ python3 Example_073.py
# $ python3 Example_073.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
073
Ask the user to
enter ... | true |
122071acd8cdcdb643aeb24d40edeb5bf00e5f72 | SpadinaRoad/Python_by_Examples | /Example_005/Example_005.py | 792 | 4.40625 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_005
# $ python3 Example_005.py
# $ python3 Example_005.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
005
Ask the user to enter ... | true |
7acfe740b3794bfb3667c2012f8cad14ee51e14a | SpadinaRoad/Python_by_Examples | /Example_054/Example_054.py | 1,300 | 4.3125 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_054
# $ python3 Example_054.py
# $ python3 Example_054.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
054
Randomly choose either... | true |
862410ffce316943c47de2b0ab155f6549182f71 | SpadinaRoad/Python_by_Examples | /Example_033/Example_033.py | 1,029 | 4.5 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_033
# $ python3 Example_033.py
# $ python3 Example_033.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
033
Ask the user to enter ... | true |
9f61ce54a78450b8cd1151a94c177b3330e6b1f1 | SpadinaRoad/Python_by_Examples | /Example_117/Example_117.py | 2,151 | 4.4375 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# To run in terminal
# $ cd /home/james/Documents/Edoc/3Nohtyp/Python_By_Example/Example_117
# $ python3 Example_117.py
# $ python3 Example_117.py <Input.txt >Output.txt
"""
Python by Example: Learning to Program in 150 Challenges by Nichola Lacey
117
Create a simple maths ... | true |
b5e95bb07b2cb89f23c172c8af483b6bf595fa36 | ooladuwa/cs-problemSets | /Week 1/07-SchoolYearsAndGroups.py | 2,132 | 4.34375 | 4 | Imagine a school that children attend for years. In each year, there are a certain number of groups started, marked with the letters. So if years = 7 and groups = 4For the first year, the groups are 1a, 1b, 1c, 1d, and for the last year, the groups are 7a, 7b, 7c, 7d.
Write a function that returns the groups in the sc... | true |
56c7032089bdb28b37620aa15a03faf782e67f26 | ooladuwa/cs-problemSets | /Week 3/033-insertValueIntoSortedLinkedList.py | 2,081 | 4.3125 | 4 | # Singly-linked lists are already defined with this interface:
# class ListNode(object):
# def __init__(self, x):
# self.value = x
# self.next = None
#
"""
- create function to insert a node
- create new link node with value provided
- set up a current variable pointing to the head of the list and set a ref ... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.