blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
b5baca210b64490ab2c2f36ff5e160b74741dd75 | MomoeYoshida/cp1404practicals | /prac_05/hex_colours.py | 625 | 4.25 | 4 | """
Create a program that allows you to look up hexadecimal colour codes.
"""
# Don't worry about matching the case
COLOUR_CODES = {"aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "antiquewhite1": "#ffefdb", "cyan1": "#00ffff",
"darkgoldenrod3": "#cd950c", "aquamarine1": "#7fffd4", "deeppink1": "#ff... | true |
09b9b885c2b61134421aad0b6224f1d2ccb27f54 | TrystanDames/Python | /Crash Course/chap06/TryItYourself_Page163.py | 1,313 | 4.25 | 4 | #6-4
language_means = {
'for': 'This is to allow us to create a loop',
'.pop': 'This allows us to delete something at the end of a list',
'del': 'This allows us to delete something specific',
'sum()': 'This allows us to sum up all the values in a variable',
'print()': 'This allows us to see the info we put into ou... | true |
04e090efd2337c753ca5d9d64aae9b85270313d2 | baburajk/python | /practice/mergesort.py | 1,343 | 4.375 | 4 | #!/usr/local/bin/python3
import argparse
class MergeSort:
""" Merge sort example """
def mergesort(self,unsortedlist):
if len(unsortedlist) < 2:
return unsortedlist
#Step:1 Divide list in half
midindex = int(len(unsortedlist) / 2)
unsortedleft = unsortedlist[:midindex]
unsortedright = unsortedlis... | true |
8ed12fbd48c437b2baf749207976fb08a2d5004a | suzytoussaint98/tp-Geometrie2D | /dossier_code/Polygon.py | 814 | 4.15625 | 4 | class Polygon:
"""
A class used to represent a Polygon
Attributes
----------
x_list : list
horizontal coordinates of Polygon points
y_list : list
vertical coordinates of Polygon points
Methods
-------
add_point(point)
Add the provided point to the polygon
... | true |
b72973deca28929df927b32123d96310d85888f2 | Sudoka/CSE-231 | /10/turtle_example.py | 1,240 | 4.1875 | 4 | # lkd: 04/10.
# a couple of functions to illustrate turtle graphics
# these functions do not perform error checking.
# call them with reasonable arguments, or suffer the consequences.
import turtle
def drawSquare(pen, size = 50, fillcolor=""):
"""draw a square of given size using pen; fill it if fillcolor is pro... | true |
28f9fab3e39f901aa33dab1b59a11f80193058cb | pankaj-lewagon/mltoolbox | /mltoolbox/clean_data.py | 534 | 4.15625 | 4 | import string
def remove_punctuation(text):
for punctuation in string.punctuation:
text = text.replace(punctuation, '')
return text
def lowercase(text):
text = text.lower()
return text
def remove_num(text):
num_remove = ''.join(word for word in text if not word.isdigit())
return num... | true |
4620aedfda4e5c810faf6ef0cb614239b608dd5c | ankit0777/LinkedListSolvedQuestions | /Delete Middle of Linked List.py | 562 | 4.1875 | 4 | # Given a singly linked list, delete middle of the linked list. For example, if given linked list is 1->2->3->4->5 then linked list should be modified to 1->2->4->5.
def deleteMid(head):
'''
head: head of given linkedList
return: head of resultant llist
'''
temp1=head
temp2=head
t... | true |
df1af634cd9044bbc31c5b281832aa96f2ec2471 | skinder/Algos | /PythonAlgos/Done/power_of_2.py | 1,025 | 4.125 | 4 | '''
https://leetcode.com/problems/power-of-two/
Given an integer, write a function to determine if it is a power of two.
Example 1:
Input: 1
Output: true
Explanation: 20 = 1
Example 2:
Input: 16
Output: true
Explanation: 24 = 16
Example 3:
Input: 218
Output: false
'''
class Solution(object):
def isPowerOfT... | true |
a7f8495913cc7cef65a82ea1cd791c4ab359e3c0 | Szoul/Automate-The-Boring-Stuff | /Chapter 2/NumberGuessingGame.py | 2,633 | 4.15625 | 4 | #create a game where you have to guess a number; it has to be in betweeen 2
#random numbers; the Programm should give you a hint whether it is lower or
# higher than the inserted number; if the correct number is typed in, show the
# number of tries before completion of the game
#Bonuspunkte: Hinweis falls die Zahl "vi... | true |
104e756b9b40a138154e1c2f95b532c717253cec | Szoul/Automate-The-Boring-Stuff | /Chapter 10/selective_copy.py | 1,808 | 4.125 | 4 | #! python 3.8.3
# selective_copy.py - copys files of a certain suffix from the original folder(and its subfolders) to another directory
# TODO
# Loop
# walk through a directory-tree with os.walk
# regex to select files with the named suffix
# shutil.copy() files to new directory
# opti... | true |
9ad347bc8ccfdb7dce8a630dfe66fea8d327b9a2 | Szoul/Automate-The-Boring-Stuff | /Chapter 5/dictionary_test2_what_happens_if_2keys_are_the_same.py | 591 | 4.15625 | 4 | dict1 = {"key1":"value1", "key1":"value2"}
dict2 = {1:1,1:2}
for x in range(0):
print (dict1)
print (dict1.get("key1"))
print (dict2)
print (dict2.get(1))
list1 = list(dict1.items())
print (list1)
if "value1" in dict1.values():
print ("value1")
else:
print ("not value 1")
#Python doesnt supp... | true |
867028725b2664b74ad3d17d802640928dbd1642 | Szoul/Automate-The-Boring-Stuff | /Chapter 7/Regex_Version_of_strip().py | 1,448 | 4.5 | 4 | #! python 3.8.3
#Regex_Version_of_strip().py: imitate the strip() function including a regex
'''
Project description:
Write a function that takes a string and does the same thing as the strip()
string method. If no other arguments are passed other than the string to strip,
then whitespace characters will be removed ... | true |
bd7c2ae7710ea045235c97557a0b59128677f464 | GraphicalDot/Assignments | /assignment_1_nov_2014.py | 2,970 | 4.21875 | 4 | #!/usr/bin/env python
def Upto_you():
"""
Write the most fancier 10 if, else statements, Its upto you
"""
pass
def sort_list():
"""
1.Prepare a list of all alphabets
2.Prepare a list by shuffling them and joining them without spaces
3.From this list which will have 20 elements, prepare a list of dictionar... | true |
b28af486761cee99d68879c0f78539af878d10a6 | muffinsofgreg/mitx | /6.2/yieldall_iter.py | 377 | 4.25 | 4 | def powerset(items):
"""
Returns all the subsets of this set. This is a generator.
"""
if len(items) <= 0:
yield []
else:
for item in powerset(items[1:]):
yield [items[0]] + item
yield item
items = ["bucket", "driver", "mouse", "hatchet", "gourd", "bottle"]
... | true |
434e0e8d87fe692e98afa6d1f2b29a8eac0be885 | ssquirrel0911/Python-Projects | /SamanthaSquirrelAssignment20-11-13-2018PatientChargesFunction.py | 2,753 | 4.34375 | 4 | #Samantha Squirrel
#samantha.squirrel001@albright.edu
#Assignment 20 Chapter 10 Programming Exercise 6; Patient Charges
import time
from SamanthaSquirrelAssignment20PatientClass import Patient
from SamanthaSquirrelAssignment20ProcedureClass import Procedure
def main():
patient = makePatientList()
... | true |
8408e30c79142ea2f4b46dccc695f89bfc1c05a1 | ssquirrel0911/Python-Projects | /SamanthaSquirrelLabAssignment9-18-2018.py | 2,678 | 4.21875 | 4 | #Samantha Squirrel
#samantha.squirrel001@albright.edu
import time
#Lab assignments Programming Exercises
#Execise 1
dayOfWeek = int(input("Input a number in the range of 1 through 7:", )) #User should put in a number in the range of 1 through 7
if dayOfWeek == 1:
print("Monday")
elif dayOfWeek == ... | true |
7599c5fe94c1f9aea7b4ca2bc2627db2cb525344 | ssquirrel0911/Python-Projects | /SamanthaSquirrelAssignment20-11-13-2018RetailFunction.py | 1,714 | 4.375 | 4 | #Samantha Squirrel
#samantha.squirrel001@albright.edu
#Assignment 20 Chapter 10 Lab Programming Exercise 5; Retail Item
#RetailItem function
import time
from SamanthaSquirrelAssignment20RetailClass import RetailItem
def main():
#Creates a list for retail item
retailItem = makeList()
... | true |
42f3ab7a52a8aeba636bfbe2c2500de45876eb3d | Coreyh2/game-assignment | /game assignment.py | 1,727 | 4.21875 | 4 | import time
def displayIntro():
print ('You are trapped in a maze, each passageway has a set of doors')
print ('you need to find a way out')
print ('if you choose the wrong path')
print ('you fall into a trap door, and can never come out.')
print
def chooseDoor():
door = ''
while door != '1' and door != '2... | true |
468151db2249c3d8f58b61b193444e167a61383a | amber21mizuno/SpeedLimit | /nguyenSpeedLimit.py | 2,499 | 4.125 | 4 | #File: nguyenSpeedLimit.py
#Project: CSIS2101 - Assignment 3 (Final Draft)
#Author: Jenny P. Nguyen
#History: September 24, 2019
def nguyenSpeedLimit():
#The fine starts off at 0 because it hasn't been determined by the user's input
fine = 0
#A greeting from the computer then it askes the 3 questions ... | true |
02340c80ae7afa083e76b5a7024b13f33a2a2788 | kirankhandagale1/Python_training | /Excercise2/p2_4.py | 251 | 4.125 | 4 | # Write the program to break the loop if user give n as input, if y continue
a=0
while True:
c=str(raw_input("Enter your choice 'n'= break, 'y'=continue "))
if(c=='n'):
print(" break ")
break
elif(c=='y'):
print(" continue ")
continue
| true |
d9f5ce0ff23c64013e699dcc25defd6bf90df4ea | ChristianBalazs/DFESW3 | /palindrome.py | 588 | 4.25 | 4 |
#Exercise
# A palindrome reads the same forwards and backwards e.g. otto or racecar.
# ask a user to type in a string
# get then length of the string
# reverse the string by reading letter by letter
# check the reversed string against the original string
# if they are the same it is a palindrome
#SOLUTI... | true |
55c7f825475c3336e5776f98408259ca5aaef47f | CarterDennis98/LeapYearCalc | /LeapYear.py | 2,785 | 4.3125 | 4 | # This python program will tell you if a year a user enters is a leap year or not
import datetime
import tkinter as tk
from random import randint
# Function to check if a number can be cast to int
def IsInt(x):
try:
int(x)
return True
except ValueError:
return False
# Func... | true |
48127178ea2b10da71ddb3bdf66bf017cc5a8cc0 | ayodejipy/calculator | /calculator.py | 935 | 4.21875 | 4 | '''
Python Project: Magical calculator
Author: Jegede Ayodeji
Inspired by: The Complete Python 3 Course: Begineer to Advanced
'''
import re
print('Magical Calculator')
print("Type 'quit' to exit application")
previous = 0
run = True
def performMath():
global run
global previous
equation = "... | true |
21f039ce1da546bc233099ab1bdbf7cbd1d4b803 | feratur/effective-python-notes | /1_pythonic_thinking/07_enumerate_over_range.py | 1,217 | 4.15625 | 4 | # Item 7: Prefer enumerate Over range
from random import randint
random_bits = 0
for i in range(32):
if randint(0, 1):
random_bits |= 1 << i
print(bin(random_bits))
# Often, you’ll want to iterate over a list and also know the
# index of the current item in the list
flavor_list = ['vanilla', 'chocolate', ... | true |
05eee5ff43902fb33a2c18984252888ebfc1945e | AnjalBam/IWassign-data-types-functions-python | /data_types/9_exchange_fist_last_char.py | 277 | 4.28125 | 4 | """
9. Write a Python program to change a given string to a new string where the
first and last chars have been exchanged.
"""
sample_str = 'Anjal Bam'
def exchange_first_last_chars(word):
return word[-1] + word[1:-1] + word[0]
print(exchange_first_last_chars(sample_str)) | true |
b9fef56ae2bbd4516deb5acbf403efe711f97418 | AnjalBam/IWassign-data-types-functions-python | /data_types/14_create_html_strings.py | 263 | 4.34375 | 4 | """
14. Write a Python function to create the HTML string with tags around the
word(s).
"""
sample_str = 'I love programming Python.'
sample_tag = 'i'
def add_tags(tag, content):
return f"<{tag}>{content}</{tag}>"
print(add_tags(sample_tag, sample_str))
| true |
ad8b944d699587929154d0d46589785ee18e2790 | AnjalBam/IWassign-data-types-functions-python | /functions/10_even_numbers_from_list.py | 381 | 4.125 | 4 | """
10. Write a Python program to print the even numbers from a given list.
Sample List : [1, 2, 3, 4, 5, 6, 7, 8, 9]
Expected Result : [2, 4, 6, 8]
"""
sample_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def print_even_numbers(lst):
even_list = []
for item in lst:
if item % 2 == 0:
even_list.append... | true |
b34ddc7947e34af54e383a9c62c2ea92afc04f78 | AnjalBam/IWassign-data-types-functions-python | /functions/17_if_str_starts_with_char_lambda.py | 282 | 4.1875 | 4 | """
17. Write a Python program to find if a given string starts with a given
character using Lambda.
"""
sample_str = 'coding'
check_if_starts = lambda char: True if char == sample_str[0] else False
print(check_if_starts('c')) # True
print()
print(check_if_starts('d')) # False
| true |
004a21509f172e5487e2c87f6f130bca6aaf497e | AnjalBam/IWassign-data-types-functions-python | /functions/5_factorial_of_num.py | 332 | 4.34375 | 4 | """
5. Write a Python function to calculate the factorial of a number (a non-negative
integer). The function accepts the number as an argument.
"""
def fact(num):
if num > 0:
product = 1
for i in range(1, num + 1):
product *= i
return product
else:
return None
pri... | true |
388fd74deb0e8acd739d09ed4e3db43ee1c27b82 | AnjalBam/IWassign-data-types-functions-python | /data_types/23_check_if_e,pty_list.py | 275 | 4.1875 | 4 | """
23. Write a program to check if the list is empty or not.
"""
sample_list = [1, 3, 5, 6, 7]
# sample_list = []
def check_if_empty(list):
if len(list) == 0:
return 'Empty List!'
else:
return 'List Not Empty!'
print(check_if_empty(sample_list))
| true |
d0cf40b3c6253de5c2a6f64d744e527717cc40a3 | edwintcloud/cs1.3_exercises | /hash_func.py | 383 | 4.25 | 4 | def hash_str(string):
"""hash_str uses the djb2 algorithm to compute the hash
value of a string http://www.cse.yorku.ca/~oz/hash.html"""
hash = 5381
for char in string[1:]:
# (hash << 5) + hash is equivalent to hash * 33
hash = (hash << 5) + hash + ord(char)
return hash
# test
r... | true |
36a886e57528457e63b7c811808660498f3d1fae | asarfraaz/stylk | /arrange.py | 725 | 4.3125 | 4 | """program to list of random numbers in assending order"""
import random
def rinput():
"""takes a number and generates that no of random list of numbers"""
num = int(raw_input('enter number:'))
ln = random.sample(range(300,325),num)
return ln, num
def arrange(l, n):
"""Arranges highest number in the... | true |
dbb0a138b681dffec4d7350c01cfe5e0a8199d10 | asarfraaz/stylk | /user_name.py | 641 | 4.40625 | 4 | """This is a doc string
This program will take the user name and the surname. Then it will give the output on the proper formate and also write the user name in the upper case letters
"""
def get_input():
first=str(raw_input('Enter ur first name'))
last=str(raw_input('Enter ur last name'))
retur... | true |
8e67375ab245880493e84eed750a4595ad064dd9 | ldbrierley/learn_python | /index.py | 822 | 4.15625 | 4 | import random
def get_guess():
while True:
try:
guess = input("What is your guess: ")
int(guess)
return guess
except:
print("That did not work please type an number")
the_random_number = random.randint(1,20)
print("Welcome to the number guessing gam... | true |
80dc8d0e92c5181f45cf8ae70ab75cf3ce441ce5 | PARASVARMA/100-days-of-code-challenge | /metacharacter.py | 840 | 4.1875 | 4 | #Regular Expression:-
import re
pattern = r"spam"
if re.match(pattern, "spamspamspam"):
print("Match")
else:
print("No match")
#function re.search and re.findall
import re
pattern = r"spam"
if re.match(pattern, "eggspamsausagespam"):
print("Match")
else:
print("No match")
if re.s... | true |
14e9d7459eb925fa64083c7aa74c7239b087425d | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/MzKhan/lesson03/slice_sequences.py | 2,110 | 4.3125 | 4 | '''
Name: Muhammad Khan
Date: 02/28/2019
Assignment03
'''
def exchange_first_last(seq):
# The method swaps the first and the last item in the given sequence.
# parm: sequence
# return : sequence
return seq[-1:]+seq[1:-1]+seq[:1]
def remove_every_other(seq):
# The method removes the ev... | true |
50556888317ba4b3502a2d915aca31803285b383 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/ian_letourneau/Lesson02/fizz_buzz.py | 526 | 4.5 | 4 | ## Ian Letourneau
## 4/25/2018
## A script to list numbers and replace all multiples of 3 and/or 5 with various strings
def fizz_buzz():
"""A function that prints numbers in range 1-100 inclusive.
If number is divisible by 3, print "Fizz"
If number is divisible by 5, print "Buzz"
If number is divisible by bo... | true |
3e217c277829b2ec8e8b3fc9332c028f459308b8 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/luyao_xu/lesson04/dict_lab.py | 2,070 | 4.28125 | 4 | #!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
""" Basic ins and outs of python dictionaries and sets"""
"""Dictionaries 1"""
# Create a dictionary containing “name”, “city”, and “cake” for “Chris” from “Seattle” who likes “Chocolate”
diction = {'name': 'Chris', 'city': 'Seattle', 'cake': 'Chocolate'... | true |
7972d961bb6ea21126da9b9d34b4bcbc2b6eafe5 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/jeanruggiero/Lesson02/series.py | 1,374 | 4.3125 | 4 | #!/usr/bin/env python3
# This script contains functions that compute sequences.
def fibonacci(n):
"""This function returns the nth value in the fibonacci series (starting with zero index)."""
if n <= 1:
return n
else:
# Call fibonacci function recursively to determine nth value
re... | true |
51f7ba0382267d53359368ef900f184162adb104 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/Sean_Tasaki/Lesson2/fibonacci.py | 1,721 | 4.15625 | 4 | def fibonacci(n):
"""Return the nth value in the fibonacci sequence (starting with zero index.
"""
if n == 1:
return 1
if n == 0:
return 0
if n < 0:
print("Invalid data")
else:
return fibonacci(n - 2) + fibonacci(n - 1)
def lucas(n):
"""Return the nth value in the Lucas numbers series (starting with ... | true |
2a7485d2ad5be0891741db58a4de485ebfbed977 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/luyao_xu/lesson03/slicing_lab.py | 2,180 | 4.53125 | 5 | """Get the basics of sequence slicing down"""
def exchange_first_last(seq):
"""
Exchange the first item and the last item of a sequence
:param seq: the sequence
:return: The first and last item in a sequence exchanged
"""
if len(seq) <= 1:
return seq
return seq[-1:] + ... | true |
06b140475dd7b1978ee8670dbf806c357bd6edeb | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/stefan_lund/Lesson_5/a_new_file.py | 2,267 | 4.1875 | 4 | #!/usr/bin/python
"""
An exercise in playing with Exceptions.
Make lots of try/except blocks for fun and profit.
Make sure to catch specifically the error you find, rather than all errors.
"""
from except_test import fun, more_fun, last_fun
# Figure out what the exception is, catch it and while still
... | true |
ee3f09ef1c237bbd8fdb39b8e1f79c30aaa9448b | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/patchcarrier/Lesson08/index_slicing.py | 1,127 | 4.375 | 4 | #!/usr/bin/env python3
"""
examples / test code for __getindex__
Doesn't really do anything, but you can see what happens with different indexing.
"""
import operator
class IndexTest:
def __getitem__(self, index):
# print("In getindex, indexes is:", index)
if isinstance(index, slice):
... | true |
e913a2da6a229aa2db444a24952c226f828a7107 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/srepking/Lesson03/list_lab.py | 2,340 | 4.21875 | 4 |
#Start Series 1
fruits = ['Apples', 'Pears', 'Oranges', 'Peaches']
print(fruits)
response = input('What other fruit would you like? > ')
fruits += [response]
print(fruits)
response = input('\n''Which number fruit would you like? > ''\n')
print('\n'"Nice Choice! You chose {number}, which corresponds to the {fruit}"'\n'... | true |
55ecf62e2e117efc682c349ab31e36eaf47c60a4 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/SLammertink/Lesson03/mailroom_1.py | 2,878 | 4.21875 | 4 | #! /usr/bin/env python3
# Author: SLammertink
# UW Self Paced Lesson 03
# Mailroom part 1
# Initiate the lists used
don_list= [75, 25346.25, 125, 25, 200.50] # list with the donations
name_list = ['Sukhmani Travers', 'Sebastien Mayo', 'Aryan Davila', 'Zayan Langley', 'Charlotte Bates'] #list with the donor names
coun... | true |
a90f0bfe69a0a49448f0780183e6d69fb72111f2 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/paul_jurek/lesson02/fizz_buzz.py | 531 | 4.40625 | 4 | """module to run the fiz_buz excercise
Goal:
Write a program that prints the numbers from 1 to 100 inclusive.
But for multiples of three print “Fizz” instead of the number.
For the multiples of five print “Buzz” instead of the number.
For numbers which are multiples of both three and five print “FizzBuzz” instead."""
... | true |
c002c563d71788c97a82e058eb25f1d5a1867c0d | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/JeffBennett/Lesson03/slicing_lab.py | 1,955 | 4.15625 | 4 | """
Write some functions that take a sequence as an argument, and return
a copy of that sequence:
with the first and last items exchanged.
with every other item removed.
with the first 4 and the last 4 items removed, and then every other item
in between.
with the elements reversed (just with slicing).
with the middle ... | true |
46359441026ad23ecaf018142bf339814bcf7e80 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/NatalieRodriguez/Lesson08/Circle.py | 2,719 | 4.625 | 5 | #Natalie Rodriguez
# Lesson 08: Circle
# May 12, 2018
'''
Goal:
The goal is to create a class that represents a simple circle.
A Circle can be defined by either specifying the radius or the diameter, and the user can query the circle for either its radius or diameter.
Other abilities of a Circle instance:
Compute th... | true |
a4bda7040bf21690f3df4379d971f5d39f1f0fa7 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/etwum/lesson02/fizz_buzz.py | 778 | 4.1875 | 4 |
#assigns the initial value of 1 to x
x = 1
#loops while x is less than 101
while(x < 101):
#checks if the remainder of dividing x by 3 and 5 is equal to zero
if x % 3 == 0 and x % 5 == 0:
print("FizzBuzz")
#moves to this statement if the first statement doesnt pass
#checks i... | true |
b5c4d5fb3f1018e0bf7bf09e60e1ad0bee14f7e8 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/ador_yano/Lesson02/DrawGrids.py | 2,380 | 4.71875 | 5 | # DrawGrids.py implements the Lesson 2 assignment from UWPCE Python Programming
intro = '''UWPCE Python Programming: Lesson 2 Assignment
Three functions to print grid three ways
1. print_grid(): display on screen a simple 2 x 2 grid
2. print_grid1(n): display on screen a scalable 2 x 2 grid based on the size specified... | true |
3065b20a415680f3e9e1021dbaa957fccd1d1ddf | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/RoyC/Lesson03/list_lab.py | 2,716 | 4.375 | 4 | #!/usr/bin/env python3
# Lesson 03, Series lab
# Series 1
print("\nSERIES 1\n")
# Print out initial list of fruit
fruits = ["Apples", "Pears", "Oranges", "Peaches"]
print(fruits)
# Prompt for another fruit and append it to the end of list, then print
fruits.append(input("\nPlease enter a fruit to add -> "))
print(fr... | true |
8ed6c73fda1278c856fc4f9dc4fa8a9e70309d96 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/prgrover/lesson02/series.py | 2,122 | 4.40625 | 4 | def fibonacci(n):
"""
This function uses recursion to calculate a Fibonacci Series.
Args:
n: Calculate up to the nth value of the Fibonacci Series.
Returns:
The nth value in the Fibonacci Series.
"""
if n <= 1:
return n
else:
return (fibonacci(n-1) + fibonacci(n-... | true |
eaec4f4b31dd241cfe17fe26ddbf0e5943e9c32d | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/MzKhan/lesson08/circle.py | 2,837 | 4.34375 | 4 | """
Name: Muhammad Khan
Date: 04/01/2019
Assignment08
"""
import math as m
class Circle:
"""The initializer or the constructor for the Circle Class"""
def __init__(self , radius):
"""Instance attributes are initalized here"""
if radius < 0:
raise TypeError("Invalid radius < 0")
... | true |
26ae3b8dcd0f43ad92b2c81b8dcaf0ac28f07bf3 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/AlyssaHong/Lesson03_1/slicing.py | 1,976 | 4.375 | 4 | """
Author: Alyssa Hong
Date: 10/22/2018
Update: 10/24/2018
Lesson3 Assignments > Slicing Lab Exercise
"""
#Get the basics of sequence slicing downself.
#Test items:
a_string = "this is a string"
a_tuple = (2, 54, 13, 12, 5, 32)
#1 with the first and last items exchanged.
def exchange_first_last(seq):
a_new_seque... | true |
6ddb09156fa8433a5d321d97988ce7dc4e503c29 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/dominic_martin/lesson03/mailroom.py | 2,432 | 4.15625 | 4 | #!usr/bin/env Python
dnd = {'Ted Bayer': 500, 'Panfila Alvarez': 700, 'JR Reid': 330, 'Simon Laplace': 440, 'Jennifer Meyers': 800}
a = int(input("What would you like to do?\nSend a Thank You? - (1)\nCreate a Report? - (2)\nQuit? - (3)\nEnter your response:"))
def choices(a):
''' This function presents the user w... | true |
50fdc496d710ffe6b97ce06f69d04cd80fa0b459 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/Dustin_L/lesson02/grid_printer.py | 1,491 | 4.3125 | 4 | #!/usr/bin/env python3
def print_row(n, sz, bottom):
"""Print a single row
Print a single row of n cells of size sz. The bottom line of the row is only
printed if 'bottom' is True.
Args:
n (int): number of cells
sz (int): size of each cell
bottom (bool): include bottom line i... | true |
8f778c22a309b79bda9e63871edcde3234e2c8cc | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/christopher_gantt/lesson02/series.py | 1,317 | 4.1875 | 4 | def fibonacci(n):
'''Returns the nth value in the fibonacci series'''
fibonacci_list = [0,1]
for number in range(1, n):
fibonacci_list.append(fibonacci_list[number]+fibonacci_list[number-1])
return fibonacci_list[n-1]
def lucas(n):
'''Returns the nth value in the lucas series'''
luca... | true |
a8e0826f88ca36166d003d8b382bd5f05b8df82c | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/yixingxu/lesson04/trigram.py | 1,548 | 4.28125 | 4 | #!/usr/bin/env python3
import os
import random
# read in a file and convert the words into list
def readin_words(file_name = "sherlock_small.txt"):
with open(file_name, "r") as rf:
# readin file and replace all the non words with space
content = rf.read().replace('\n', ' ').replace('.','').replace... | true |
2f5a1155eb3af1ad4426419033181c57b4aec6d3 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/Matt_Hudgins/Lesson03/list_lab.py | 2,635 | 4.34375 | 4 | #!/usr/bin/env python3
'''
File Name: list_lab.py
Author: Matt Hudgins
Date created: 5/5/18
Date last modified: 5/5/18
Python Version 3.6.4
'''
# Series 1
print("Starting Series 1!")
# Fruit List
fruit = ["Apples", "Pears", "Oranges", "Peaches"]
print(fruit)
# User will add a new fruit
new_fru... | true |
b2fb5ae1da042302eef4e8b3697032d139328ce8 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/matiasli/lesson02/fizzbuzz.py | 647 | 4.375 | 4 | # fizzbuzz
# Write a program that prints the numbers from 1 to 100 inclusive.
# But for multiples of three print “Fizz” instead of the number.
# For the multiples of five print “Buzz” instead of the number.
# For numbers which are multiples of both three and five print “FizzBuzz” instead.
# to run, in the terminal, lo... | true |
3665d00ec6b524f1bec2c9d0a3ccd60329d95be3 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/cindywaldron/lesson3/list_lab.py | 1,877 | 4.5625 | 5 | #!/usr/bin/env python3
a_list = [ "Apples", "Pears", "Oranges", "Peaches"]
print(a_list)
# ask user to enter a fruit
response = input("Enter a fruit name > ")
#display user's input
print("You entered: " + response)
print(response + " is added to end of list")
# add the input to end of the list
a_list.append(response)... | true |
b5e083e33cf2b7ba7a0d47d1f589757af6b1685b | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/SLammertink/Lesson03/strformat_lab.py | 2,257 | 4.5 | 4 | #! /usr/bin/env python3
# UW Self paced Lesson 03 string lambda
# Task 1
''' Write a format string that will take the following four element tuple:
( 2, 123.4567, 10000, 12345.67)
and produce:
'file_002 : 123.46, 1.00e+04, 1.23e+04' '''
StrList = (2, 123.4567, 10000, 12345.67)
def Task1():
print(f"file_{StrLis... | true |
651789601f0720d6062045e557e226ee50fccf2d | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/ador_yano/Lesson02/Series.py | 2,197 | 4.34375 | 4 | # Series.py: implements Fibonacci Series Exercise for Lesson 2 Assignment
intro = '''UWPCE Python Programming: Lesson 2 Assignment
Fibonacci Series Exercise: fibonnaci and lucas functions to return nth value of
each series, generalized series function with three parameters
1. fib(n) - series starts with 0 and 1, retur... | true |
78a6692323c23224843718e96be5991a39cca86d | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/TinaB/lessonTwo_TB/FizzBuzz.py | 1,153 | 4.3125 | 4 | # Goal:
# Write a program that prints the numbers from 1 to 100 inclusive.
# But for multiples of three print “Fizz” instead of the number.
# For the multiples of five print “Buzz” instead of the number.
# For numbers which are multiples of both three and five print “FizzBuzz” instead.
# Fizzbuzz to 100
def fizzbuzz(... | true |
9aef7bd624c31ca29c7ea9ef05178381e9e8c0d6 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/ian_letourneau/Lesson03/slicing_lab.py | 1,825 | 4.40625 | 4 | #!/usr/bin/env python3
# Ian Letourneau
# 4/26/2018
# A script with various sequencing functions
def exchange_first_last(seq):
"""A function to exchange the first and last entries in a sequence"""
return seq[-1:] + seq[1:-1] + seq[:1]
def remove_every_other(seq):
"""A function to remove every other entr... | true |
6674a268183ec7ca465b28e57ba8b49e1ab8546c | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/AurelPerianu/Lesson4/trigrams.py | 2,662 | 4.5 | 4 | #!/usr/bin/env python3
# Lesson 4 - Trigrams
import random
import string
def main_fct():
#input_file = input("Please enter the name of a file (with extension):\n")
input_file='sherlock_small.txt'
with open(input_file, 'r') as f:
text = f.read()
#remove unprintable characters
filter(lambda x... | true |
da5e4f291652ac9ade4aa67d9932e20c79fc47e7 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/Dennis_Coffey/lesson03/list_lab.py | 2,920 | 4.28125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 5 21:07:54 2018
@author: denni
"""
"""Lesson 3 - List Lab assignment - Series of 4 steps modifying a list of fruits"""
#Series 1:
#Create list of fruits
fruits = ['Apples','Pears','Oranges','Peaches']
print(fruits)
#Copy original fruits list for ... | true |
23ff6a6c03b18dacce7e2262092f331ed56f6f5b | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/carlos_novoa/lesson03/list_lab.py | 2,955 | 4.125 | 4 | #!/usr/bin/env python3
"""
Lesson3, List Lab Excercises
"""
def is_int(str):
"""Helper function to check that input can be cast into int"""
try:
int(str)
return True
except ValueError:
return False
def series1():
print("::: Series 1 :::::::")
# print intial list
fru... | true |
0e8b5ff1fc9c1bcb1d0bf2260afc794c997ef982 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/mark_luckeroth/lesson03/list_lab.py | 1,791 | 4.15625 | 4 | #!/usr/bin/env python3
#series 1
list1 = ['Apples','Pears','Oranges','Peaches']
print(list1)
add_fruit = input("Please input the name of a fruit to add to the list: ")
list1.append(str(add_fruit))
print(list1)
while True:
list_position = input("Enter a number between 1 and 5 to select a fruit from the list: ")
... | true |
53c6eb5356e7537754f45f0e4babf3457d0a8641 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/Craig_Morton/lesson08/Circle.py | 2,109 | 4.1875 | 4 | # ------------------------------------------------- #
# Title: Lesson 8, pt 1/2 Circle
# Dev: Craig Morton
# Date: 9/23/2018
# Change Log: CraigM, 9/23/2018, pt 1/2 Circle
# ------------------------------------------------- #
from math import pi
from functools import total_ordering
import random
import time
@tota... | true |
5a7a6bf9fe258e1fdbf0009b0f08883ea90731ee | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/luyao_xu/lesson04/trigrams.py | 2,102 | 4.1875 | 4 | import random
def read_file(filename):
"""
Read file into a new list of words
:param f: filename
:returns: read file
"""
with open(filename, 'r') as f:
text = f.read()
return text
def trigram_dict(s):
"""
set up a trigram dictionary
:param s:the split word
:pa... | true |
48e5ee6bcb8c0c9fb10f54fd96f4e96e9056a5f4 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/ChelseaSmith/Lesson2/series.py | 1,524 | 4.34375 | 4 | def fibonacci(n):
if n == 0: # initializes the series
return 0
elif n == 1:
return 1
else:
return fibonacci(n-2) + fibonacci(n-1) # function recursion to calculate values beyond the first two
def lucas(n):
if n == 0: # initializes the series
return 2
elif n == 1:... | true |
dd7882ce1afedab638dc354fa42ffb62c3903f74 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/csdotson/lesson08/circle.py | 2,014 | 4.53125 | 5 | #!/usr/bin/env python3
import math
class Circle:
"""Create a Circle class representing a simple circle"""
def __init__(self, radius):
if radius < 0:
raise ValueError("radius can't be less than 0")
self._radius = radius
@property
def radius(self):
return self._radiu... | true |
c90f77973cf02908e094e2609026fb9ec39eab1b | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/TressaHood/lesson04/dict_lab.py | 1,331 | 4.15625 | 4 | #!/usr/bin/env python3
# Activity 1 Dictionary and Set lab
def main():
# Dictionaries 1
# create a dictionary
d = {"name": "Chris", "city": "Seattle", "cake": "Chocolate"}
print(d)
# remove last item
d.pop("cake")
print(d)
# add new item
d["fruit"] = "Mango"
print(d)
#... | true |
192fabca7fb01a38c0bad5f30ed010c6330c0d6c | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/srepking/Lesson04/kata.py | 1,779 | 4.1875 | 4 | import random
trigram = {}
# Read in a file line by line and create a dictionary of trigrams.
string_words = ''
with open('sherlock.txt', 'r') as from_file:
for line in from_file:
word = ''
for char in line:
if char.isalpha():
word += char.lower()
else:
... | true |
e2df6228ccc92fe905762ff250f2e235e6cde07f | Shubh250695/Python-modules | /M01.py | 1,197 | 4.34375 | 4 | # write a Python program to read data from a file which has text containing emails,
# write only the emails from the file into another file.
# You can use 're' module to extract emails from the text file.
import re
fileToRead = 'Sample01.txt'
fileToWrite = 'Output01.txt'
delimiterInFile = [',', ';']
def ... | true |
9796ce2512388ee195f7283fa67b6c69f1363dc6 | ragulkesavan/python-75-hackathon | /RECURSION/recursion.py | 406 | 4.15625 | 4 | '''PROBLEM: Calculate the total number of possible squares in a chess board of n*n size (n is got from user)'''
def chess(n):
if n==1:
return 1
else :
return (n*n)+chess(n-1)
n=int(input("give the n-chess board size : "))
print("\nthe chess board has "+str(chess(n))+" possible squares")
'''
OUT... | true |
4f881d4928f10da1ead7e189b60e6b24fed50c4a | ragulkesavan/python-75-hackathon | /TUPLES/tuple.py | 1,513 | 4.5 | 4 | #tuples
'''TUPLES ARE UNCHANGABLE ORDERED COLLECTION OF DATA VALUES
ONCE TUPLES ARE CREATED NEW VALUES CANNOT BE ADDED,EXISTING VALUES CANNOT BE
DELETED OR RE-ORDERED OR CHANGED
TUPLES ARE REPRESENTED USING ROUND BRACES () INBETWEEN VALUES ARE SEPERATED BY COMMA
TUPLES ARE IMMUTABLE'''
#TUPLE CREATION... | true |
c63fffe0abbdf509e9cd70df059b1aee770ffed5 | ragulkesavan/python-75-hackathon | /INHERITANCE/hybrid_inheritance.py | 1,454 | 4.4375 | 4 | #MULTIPLE INHERITANCE
#When a child class inherits from multiple parent classes, it is called as multiple inheritance.
class orders:#DEFINITION PARENT CLASS
l=[]
def order(self):
product_name=input("enter the name of product : ")
quantity=int(input("enter the quantity of product : "))
a... | true |
cae545f616c84d80dfad4a056af570cee0f7e3fb | ericgtkb/design-patterns | /Python/TemplateMethod/HouseBuilder/house.py | 1,052 | 4.1875 | 4 | import abc
class House(abc.ABC):
def build_house(self):
# Can be set as final in python 3.8 using the final decorator
self.build_foundation()
self.build_pillars()
self.build_walls()
self.build_windows()
print('The house is built!')
def build_foundation(self):
... | true |
a0c07a217df2219053dd65579c8eaa88af670eae | carlson9/python-washu-2014 | /day1/class1.py | 373 | 4.15625 | 4 | def is_triangle(first, second, third):
lengths = sorted([first,second,third])
if lengths[2] <= lengths[0]+lengths[1]:
print "Yes"
else: print "No"
def prompt():
first = int(raw_input("Input first side: ",))
second = int(raw_input("Input second side: ",))
third = int(raw_input("Input thi... | true |
d3dde4521bea8c8385cc0dc12a8ad01351c199d6 | carlson9/python-washu-2014 | /assignment1/school.py | 1,534 | 4.3125 | 4 | class School():
def __init__(self, school_name): #initialize instance of class School with parameter name
self.school_name = school_name #user must put name, no default
self.db = {} #initialize empty dictionary to store kids and grades
def add(self, name, student_grade): #add a kid to a... | true |
42270d36edde93effd9f08251a53bef71acb341c | agodi/Algorithms | /Python/TreeCommonAncestor.py | 248 | 4.25 | 4 | def appendsums(lst):
"""
Repeatedly append the sum of the current last three elements of lst to lst.
"""
for i in range(25):
aux = lst[-1] + lst[-2] + lst[-3]
lst.append(aux)
print(lst[20])
appendsums([0, 1, 2]) | true |
13478c287305f67d016828532cc7f5d44fcdcbec | AJohnson24/CodingPractice | /DailyCodingProblem/10.py | 585 | 4.21875 | 4 | #!/usr/bin/env python3
# Good morning! Here's your coding interview problem for today.
# This problem was asked by Apple.
# Implement a job scheduler which takes in a function f and an
# integer n, and calls f after n milliseconds.
import time
import sys
def scheduler(f, n):
print(f"waiting {n} milliseconds")
time.... | true |
558ffc3400d66cf7dca027ac72850387a047fe2e | lephdao/cracking-coding-interview | /Array and String/length_of_longest_substring.py | 980 | 4.1875 | 4 | '''
Given a string s, find the length of the longest substring without repeating characters.
Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
'''
def lengthOfLongestSubstring(s):
if len(s) == 1:
return 1
if s == "" or s == " ":
retur... | true |
6a9b1dcf902cd8beac2fdb728539bd21ddba9bfc | mambalong/Algorithm_Practice | /SlidingWindow/0438_findAnagrams.py | 1,430 | 4.125 | 4 | '''
438. Find All Anagrams in a String
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.
Strings consists of lowercase English letters only and the length of both strings s and p will not
be larger than 20,100.
The order of output does not matter.
Example 1:
Input:
s: "cb... | true |
0c06db606ee0ab3899b3ccc506113b8b88dbc273 | xsong15/codingbat | /list-1/sum3.py | 223 | 4.15625 | 4 | def sum3(nums):
"""
Given an array of ints length 3, return the
sum of all the elements.
"""
return sum(nums)
print(sum3([1, 2, 3])) #→ 6
print(sum3([5, 11, 2])) #→ 18
print(sum3([7, 0, 0])) #→ 7 | true |
138e492317b185f0b17e6d04635ff21b27c20e11 | adamcfro/practice-python-solutions | /fibonacci.py | 335 | 4.21875 | 4 | def fib_nums():
new_nums = 'yes'
while new_nums == 'yes':
number = int(input("How many Fibonacci numbers would you like to generate?: "))
a = 0
b = 1
for num in range(1, number + 1):
print(a)
a, b = b, a + b
new_nums = input("More nums? (yes or no)... | true |
5a0e316aa72b56a5e6f503a8b152ddb689076640 | jviray/python-practice | /factorial.py | 311 | 4.125 | 4 | """
Write a function that takes an integer `n` as an input;
it should return n*(n-1)*(n-2)*...*2*1. Assume n >= 0.
As a special case, `factorial(0) == 1`.
Difficulty: easy.
"""
def factorial(n):
factorial = 1
if n >= 1:
for i in range(2, n + 1):
factorial *= i
return factorial
print(factorial(7)) | true |
14fd536ebf075902e093ce736c61be10642f506a | brinsga/python-bootcamp | /Day_1/HW01_ch05_ex03.py | 2,593 | 4.625 | 5 | #!/usr/bin/env python
# HW02_ch05_ex03
# If you are given three sticks, you may or may not be able to arrange them in
# a triangle. For example, if one of the sticks is 12 inches long and the other
# two are one inch long, it is clear that you will not be able to get the short
# sticks to meet in the middle. For any t... | true |
f7ef8a44f33ee7ebbd587d5e1f4db2b171df3ac5 | MahaLakshmi0411/Circle | /area.py | 316 | 4.15625 | 4 | pi=3.14
r=float(input("Enter the radius of a circle:"))
area=pi*r*r
print("The area of the circle is =%.2f"%area)
i = input("Input the Filename: ")
extns =i.split(".")
# repr() function is used to returns a printable representation of a object(optional)
print ("The extension of the file is : " + repr(extns[-1]))
| true |
7dcf4aebff94e3c2ffce8b9ca6a3c9f5e3884cfa | loghmanb/daily-coding-problem | /facebook_ways_to_detect.py | 1,837 | 4.125 | 4 | '''
Ways to Decode
Asked in: Facebook, Amazon
https://www.interviewbit.com/problems/ways-to-decode/
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total number of ways to decode i... | true |
95378c4ed795ff4814cc9251f59ba6b32cdbdf25 | loghmanb/daily-coding-problem | /problem050_microsoft_eval_tree.py | 1,046 | 4.3125 | 4 | '''
This problem was asked by Microsoft.
Suppose an arithmetic expression is given as a binary tree. Each leaf is an integer and each internal node is one of '+', '−', '∗', or '/'.
Given the root to such a tree, write a function to evaluate it.
For example, given the following tree:
*
/ \
+ +
/ \ / \
... | true |
06f8fef593620ee02a121393ca57c85423822d93 | loghmanb/daily-coding-problem | /problem049_amazon_max_sum_contiguous_sub_arr.py | 963 | 4.21875 | 4 | '''
This problem was asked by Amazon.
Given an array of numbers, find the maximum sum of any contiguous subarray of the array.
For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements 42, 14, -5, and 86.
Given the array [-5, -1, -8, -9], the maximum sum would... | true |
8657a264fe128c104278cae2f6270143b4e0a872 | loghmanb/daily-coding-problem | /facebook_max_sum_contiguous_subarray.py | 1,563 | 4.15625 | 4 | '''
Max Sum Contiguous Subarray
https://www.interviewbit.com/problems/max-sum-contiguous-subarray/
Asked in: Facebook, Paypal, Yahoo, Microsoft, LinkedIn, Amazon, Goldman Sachs
Find the contiguous subarray within an array, A of length N which has the largest sum.
Input Format:
The first and the only argument contai... | true |
f7bbb5526b0bd0c24148857ddb37b37078dd72f8 | loghmanb/daily-coding-problem | /problem065_amazon_print_clockwise.py | 1,822 | 4.3125 | 4 | '''
This problem was asked by Amazon.
Given a N by M matrix of numbers, print out the matrix in a clockwise spiral.
For example, given the following matrix:
[[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20]]
You should print out the following:
1
2
3
4
5
10
15
20
19
18
17
16
1... | true |
85083b4f2cf7e2f2f6efb458d9e068962bf27824 | loghmanb/daily-coding-problem | /problem037_google_power_set.py | 763 | 4.59375 | 5 | '''
This problem was asked by Google.
The power set of a set is the set of all its subsets. Write a function that, given a set, generates its power set.
For example, given the set {1, 2, 3}, it should return {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
You may also use a list or array to represent a set.
... | true |
553ee8e48c3c2a5be6ed0bcdc5d8fd05c7a417be | 100121358/1CodesAndStuffs | /1CodesAndThings.py | 1,132 | 4.375 | 4 | # Strings
# data that falls within " " marks
# concatenation
# put 2 or more strings together
firstName = "Fred"
lastName = "Flintstone"
print(firstName + " " + lastName)
fullName = firstName + " " + lastName
print(fullName)
# repitition
# Repitition operator: *
print("Hip"*2 + "Hooray!")
def rowYourBoat():... | true |
59fef44ab945a24868c77d7f12e0f369b1372589 | ivoree/egg-order | /egg-order.py | 1,884 | 4.25 | 4 | #14/2/21
#Ivory Huang
#Egg order program
#V1a: create loop in get_orders function to get customers names and egg num
#functions
def get_orders(names, egg_order):
#Collects order information - name, number of eggs – in a loop. Store in 2 lists.
#Call read_int function to ensure you have a valid input
... | true |
f80812eb080aa10ee3a00ade642c68d46a0d4888 | mchen06/python_class_code | /python_projects/bubble_sort.py | 735 | 4.1875 | 4 | list = [3, 4, 1, 1, 8]
def bubble_sort(list):
# sorts in place
length_list = len(list) - 1
comparisons = 0
x = 0
has_swaped = True
while has_swaped != False:
has_swaped = False
y = 0
while y < length_list - x:
comparisons = comparisons + 1
if list... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.