instruction
stringlengths
71
95.1k
https://leetcode.com/problems/queue-reconstruction-by-height/ Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers \$(h, k)\$, where \$h\$ is the height of the person and \$k\$ is the number of people in front of this person who have a height greater than o...
I was working on a little Python challenge that was a bit more difficult than expected: format any non-negative number so 1000 turns into "1,000" , 10000000 into "10,000,000" and so forth. I managed to do it, but I find my solution not very readable: def formatting(n): m = str(n) # Turn it into string m2 = [] ...
Motivation: Partially for fun / learning, but also so I can roll out a custom JSON-like file format for a fighting game I am writing. There are two caveats: you cannot have repeated keys (requires std::unordered_multimap) and the keys are not in order (requires insertion order std::vector on the side, or some external ...
There is a follow-up question available: shell-sort-insertion-sort-bubble-sort-selection-sort-algorithms-python. Selection Sort The selection sort algorithm sorts a list (array) by finding the minimum element from the right (unsorted part) of the list and putting it at the left (sorted part) of the list. Bubble So...
svgmanip is a library that extends svgutils by providing rotation, import, and export primitives. It is available on PyPI, and was created a few years ago. Install pip install svgmanip Bugs Exporting does not work on Windows The code of the main file, _generator.py is here: from __future__ import division import re ...
I am developing this angular app and it has big forms with 100 + fields. I was thinking about using [(ngModel)] without reactive forms, so that it's easier to do validations and I only have to provide the same JSON to the web service endpoint. Is this a right approach? Reactive forms export class ProfileEditorComponent...
I have written a small and simple ThreadPool class for rather simple multithreading applications. The Threadpool class manages a vector with the actual threads. The Thread struct is used to store the thread's function. ThreadPoolElement keeps track of the thread and its state. #pragma once #include <vector> #includ...
Q: Given a list of Persons, return the first two Students having the last name starting with “C” My classes: Person class public class Person { protected String firstName; protected String lastName; protected int age; } Student class public class Student extends Person { } Method public static List<Stud...
I have the following collection : var items = new[] { new { Name = "A", Values = new [] { 20, 4, 5, 9, 3, 22 } }, new { Name = "B", Values = new [] { 10, 7, 9, 8, 42 } }, new { Name = "C", Values = new [] { 11, 103, 0 } }, new { Name = "D", Values = new [] { 7, 35, 42 } } }; I would like to find which...
I watched Robert Martin's programming 101 video. I'll explain what problem he talks about in the video for those of you who haven't watched it. Robert Martin is in his house and shows a light switch. If this switch goes up, a light is on. If switch goes down, the light is off. He wrote a code to handle it. This is simp...
Please review my BST Code 1. Class node class Node: 2. Constructor def __init__(self, data): self.left = None self.right = None self.data = data 3. Insert node def insert(self, data): if self.data: if data < self.data: if not self.left: self.left = Node(data) ...
I am currently working on an API and came across the following design. // not mandatory @ManyToOne @JoinColumn(name = "person_id") private Person person; Actually, a telephone number should belong to a company, person or a contact form. However, this is logically not possible with the current design. ...
I programmed a little in java a while back, and now I'm learning C#.This is the first exercise of "medium" or "respectable" difficulty according to Codility, so I'm pretty pleased of finding out that the approach used by me was the same Sheng followed in codesays.Writing here and in SO as a mémoire (check this if you'd...
I have an app that takes in "commands" in the form of strings that are parsed, and then passed off to a specific class based on the first word in the string. Every string command is comprised of two or three words separated by spaces, and can also have an '=' followed by more words/numbers separated by commas. Some exa...
Turtle Doodle presents several panels which arrange themselves responsively. There is a canvas where the Turtle will move, leaving a paint trail behind him. A control panel allows various commands to be sent to the Turtle such as Forward, Back, Left, Right. An "info" area shows a textual run-length-encoded listing of a...
WinAPI Timers can be quite tricky to work with, as anyone who's tried to use them and fallen foul of one of the many pitfalls probably knows. Problems such as screen freezing, crashes, uncontrolled printing to the debug window etc. will be familiar, and so I've tried to make some code to mitigate these issues, by provi...
The program is supposed to get one number n as input, and output the max value of gcd + lcm of two numbers that range from 1 to n. For example, if n == 3, the answer is 7 because gcd(3,2) == 1 and lcm(3,2) == 6. The issue is that the code works really slowly and the double loop makes it so numbers above basically 1000 ...
In my code I need a function to traverse an arbitrary JSON-like data structure with a path definition. E.g., given the structure {"root": {"inner": [{"name": "obj1"}, {"name": "obj2"}]}} and the path ("root", "inner", "0", "name"} I would obtain "obj1". I just started learning Go and to be honest I found it quite hard...
I wrote this BrainFuck interpreter in ANSI C89: /* * Copyright © 2019 James Larrowe * * This file is part of bf. * * bf is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the Licen...
This was the task (I don't know the exact wordings anymore): You get a string with operation as input: if it is a number push it to stack if it is "DUP", then duplicate the one one top and push it to the stack if it is "POP" then remove the one on top if it is "+" add the two numbers on top of the stack and replace...
The most valuable of all talents is that of never using two words when one will do. Thomas Jefferson. NuGet and GitHub I found it useful to automatically normalize string content a little bit and explicitly state what kind of content could be held in a field: [TestMethod] public void Normalize() { var name = new Na...
I am creating a user request model to pass-params for web service call toRegisterParams() is used call register web service request toLoginParams() is used call register web service request so my question is this correct way or I need to Optimise my code or I should make different models for the same. As most-of param...
I have a god-class (GodClass) which work with class-adapter. Class-adapter (OldController) work with old api-class which can't to use directly cause it has bad api with low-level parameters. God-class violates SRP principle. I want to split god-class but not sure of correct way to do it. In the future, some code will c...
I'm doing a code-challenge problem: Captain Kaban: National Treasure is a popular football simulation game which can be played on most smartphones. In this game, you put up a team of 11 players and then compete in either story mode or multi-player mode. As you might already know, a football match is played by 11 player...
This is my first rocket web-app. It serves images from a directory and thumbnails from a sub-directory. if no thumbnail is found for an existing image it is created on the fly. Before I launch this thing into production/space, it would be calming to have some experts' eyes on it and be made aware of any glaring holes a...
I've written a wrapper package for redis. The idea is to be able to provide better error reporting with the package, as well as integrating stats and logging at a later stage. For now it's just better error reporting with traces. My first iteration of the package looked nice and neat and rather simple. The problem came...
There are seven sorting algorithms in the code copied below. The first five algorithms have been previously reviewed in this link. Selection Sort The Selection Sort algorithm sorts a list by finding the element with minimum value from the right (unsorted part) of the list and putting it at the left (sorted part) o...
Goal: I want to output all non-standard FK constraints from clients DB, versus our "standard" DB (which contains, by default, 2,631 FK). Trial: I wrote this code: SELECT owner, table_name, constraint_name, r_owner, r_constraint_name, status FROM all_constraints WHERE constraint_type = 'R' -- "Referential in...
I have the following piece of code which is FSI tested and works. However, I want to trim it as much as possible (not only the comments, which are there for my own future reference) and make it as idiomatic as possible. The gist of the code is the first step of the good ole' "Robot on a grid" kata: receive a path to ...
The objective of this code is to add the first 3 cells of a column with the next 9 in another column and then to total out in 2 currencyeditor control (which is like a textbox). Here is a demonstration of what I am adding. For the 1st control it's going to be the actual + adjusted (left square). For the 2nd co...
I was recently in need of a class that checks if a computer has a valid internet connection, so I wrote one; however, I feel that there is a better way to do so and I just don't have the knowledge myself. The object I choose to wrap is the Win32_NeworkAdapter, which unfortunately forces me to use "stringly" comparisons...
I have a loop to add Recordset items to a Dictionary so I can do comparisons and retrieve specific data later in the code (not shown below). The first loop I tried takes around 17 seconds, the second takes 16 seconds, the third takes 15 seconds. It seems like a long wait to add 500-700 records. The connection is to a ...
There is a basic difference in the way C++ manages the deleter for std::unique_ptr and std::shared_ptr, mainly for allowing unique_ptr with default deleter to have the same size as a raw pointer. However, the way std::unique_ptr manages its deleter requires stating the deleter type, in case you need a custom deleter, a...
I've written the below bash script to run as a pre-commit hook. The intention is to check the git staging area for any files larger than 1mb, and prevent the commit if any are present. #!/bin/sh too_big() { bytez=$(cat "$(git rev-parse --show-toplevel)/$1" | wc -c) if [ "$bytez" -gt 1000000 ] ; then cat...
Let's say that I have a directory that looks like this: dir | File1.txt | fILE2.md | file3.tex When I execute my bash script from within the dir directory, I want to receive files with names "file1.txt", "file2.md" and "file3.tex". I have written this script: ls | xargs -n1 -I {} sh -c 'fst={}; snd=`echo $...
I submitted a technical assignment for a job interview process and I am stressing out wondering if my submission was any good. I would like to learn and be a better developer, so please give me pointers about what I could improve on. GitHub link using System; namespace ParsetheParcel { interface ICalculatable<Parc...
I run into issues where I forget to run UI changes on the main thread. I've just fixed an issue for loading and unloading an activity indicator and fixed it with the following code: if active { DispatchQueue.main.async { UIApplication.shared.keyWindow?.startIndicatingActivity() } } else { DispatchQ...
You have a file that describes historic data of the London Underground showing dates when stations have been unavailable. The file contains these fields, separated by a pipe character: Date: Format of this is mm-dd-yyyy. Line: Each line has a unique name. For example, “Northern”. Station: Each station has a unique na...
I'm learning C, and wrote this program outside of my assignments in order to practice pointer manipulation and data structures, step by step. I want to ensure that this program follows well known conventions, has excellent style and readability, and uses pointers as efficiently as possible, before I move on to more com...
I have another thread called Digitizing paper label system with Python I have added username and password class (class is called login()). I'd like to hear some feedback about my class login() is the structure okay? Should I change anything within my structure? Shall I make any other amendments, I will hear out any fee...
I've written a blog site using python and Flask. It works a little like Reddit, but instead of having some anonymous users, there are only anonymous users. This site allows users to add posts (after being filtered, of course). I'd like feedback on a couple things: Is there any way I can better filter user input for XS...
I'm trying to improve my Alternating Least Squares (ALS) model performance by testing using different model parameters, but the model performance is seemingly very low. Since the Alternating Least Squares model is relatively different from other models under the evaluation perspective, I needed to set up my custom eval...
I am supposed to find the frequency of the unique array elements of a character array via a user defined function like int *unique(char *s), which takes a pointer to a character and returns a pointer to a dynamically allocated array of integers. There are some constraints. I cannot use additional array nor any array...
Problem Statement 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 Not Weird Complete the stub code provide...
Merge Sort Merge Sort algorithm is a general-purpose comparison-based sorting algorithm. Most implementations produce a stable sort, in which the order of equal elements is preserved. Just for practicing, I've implemented the merge sort algorithm copied below and I'd appreciate it if you'd like to review any part of...
I have an HTTP endpoint for returning data directly from Azure Cosmos DB. The endpoint is basically a database access point (this seems like a common case). Since I'm returning the data unmodified, there's no need to deserialize it, even though I have an object for Project on the server that is used elsewhere. I'm wond...
I've been struggling to write a QuickSort algorithm to sort multiple columns of an Array for weeks. Finally, I decided to write a class that Implements mscorlib.IComparer and it has exceeded my expectations. Ironically, my testing reveals that mscorlib.ArrayList itself uses a QuickSort algorithm. I concluded this b...
Merge Sort Merge Sort algorithm is a general-purpose comparison-based sorting algorithm. Most implementations produce a stable sort, in which the order of equal elements is preserved. Here, our method is bottom-up merge sort algorithm, which treats the list as an array of n sublists of size 1, and iteratively doubles...
I've been on a Project Euler spree and I've been solving problems and as you might know, many of them require you to use prime numbers. I've been using the following code to generate and store primes in a vector, but was wondering if there is any non-obvious speed-ups that will make a large difference on the runtime of...
I'd like to learn how I can optimize the following byte extension methods. I'm targeting .NET Standard 2.0 but I'm curious if there are any ways to go about some of this functionality using features available in 2.1 (like Span<T>). I feel like the ShiftRight, byte.HasSamePrefix, byte[].HasSamePrefix methods could be i...
QuickSort is a Divide and Conquer algorithm, which picks an element as "pivot" and partitions a given list around the pivot. There are many different versions of Quick Sort, as to how to pick a pivot in different ways: Always pick first element as pivot (implemented below) Always pick last element as pivot Pick a ran...
I wrote a FizzBuzz program to get comfortable with C++. I haven't learned any languages before this, but I'm doing this on my own. I learned if, for, std::cout, and some operators. I wrote several questions below, but if that isn't allowed I can revise. Program uses nested for loops to evaluate whether a quotient is a ...
I programmed a few things in java and now I'm learning C#. I've been doing exercises from Codility. The first 3 or 4 were very difficult to me but now I guess I've got the hang of it. This site helped a lot at improving my style and the things I now think I should be looking at before contenting myself with the final c...
I generate a set of data based off every combination of inputs. The source range that's inputs requires headers to identify the parameters. In its present state I'm not content as it's not as straightforward as I'd like it to be. Specifically the module variables can be cleaned up but I'm not seeing how. A simple examp...
This problem is from MIT Course and I have implemented it in C++. Review this code and how can I improve it complexity-wise and with better features available in C++. Let’s say we have a whole bunch of people in line waiting to see a baseball game. They are all hometown fans and each person has a team cap and is ...
I've implemented my first data encryption / decryption methods on Node.js. Although it might look similar to hundreds of sample implementations available online, I'm curious to get a feedback. I'm particularly interested in: some flaw points, potential security, and performance issues In encrypt() I return an ENCRYPTE...
I have three lists of nodes. sources sinks pipes There is a directed weighted graph from sources to pipes to sinks. Sources are only connected to pipes and pipes only to sinks. But sources are not directly connected to sinks. Pipes are zero-sum, meaning that the sum of the weights that come to each pipe from sources ...
I'm trying to optimize my solution to this LeetCode problem: Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. My working, accepted solution: import heapq class Solution: def nthSuperUglyNumber(self, n...
What's the best way to check if a String ends with any of multiple suffixes in Rust? I have a working, naive solution: fn string_ends_with_any(s: String, suffixes: Vec<&str>) -> bool { for suffix in &suffixes { if s.ends_with(suffix) { return true; } } false } Note: suffixes cou...
I'm trying to solve this problem Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. I've come up with a solution that works correctly but times out on large inputs: from collections import defaultdict class Solution: def numSquares(self, n...
I want to learn about Design Patterns and be able to apply them in Excel VBA. So to learn about patterns I bought a book that seems promising: Head First Design Patterns; it presents the material clearly. However, the code exercises/examples are in Java 8. VBA does not have direct counterparts for some things (e.g. Ext...
I recently discovered that it is much faster to generate primes using a Sieve of Eratosthenes (SoE) with a boolean array data structure than with a heap. Since then I have been looking for fast and scalable implementations. The fastest Python version I found is here in a comment by Willy Good. But Willy's code is jus...
I'm a beginner programmer that's really motivated at the moment. I made this in two days and I'm really proud of it because I never used any tutorials or any online help. Just good ol' grey matter and for real I think I did a much better job than my last game thanks to you guys! I really appreciate the feedback on my l...
I normally use MySQLi and this is my first time trying out PDO. I am doing this because this is my first web application that is going to be used by the public, hence I want it to be secure. The code I wrote, following a W3 tutorial is working flawlessly, however due to a few other posts on Stack Overflow I have read, ...
What is it? React native Accordion Collapsible Panel. You pass the summary (always shown bit) and the detail (sometimes hidden bit). If the detail is passed as a function or promise (ie async function), it will be lazily called as it's expanded. (Questionable??) Design choices: I allow all three types of detail into th...
An office has a bathroom that can be used by both men and women, but not both at the same time. If a man is in the bathroom, other men may enter, but any women wishing to use the bathroom should wait for it to be empty. If a woman is in the bathroom, other women may enter, but any men wishing to use the bathroom should...
This problem is from MIT Course and I have implemented it in C++. Please review and suggest improvements. There is a party to celebrate celebrities that you get to attend because you won a ticket at your office lottery. Because of the high demand for tickets you only get to stay for one hour but you get to pick ...
I have currently problem with discord bot, what is in Python programming language. This commands loading take so long, and I need help with optimization of this code. from fractions import Fraction import discord from discord.ext import commands import asyncio import asyncpg import datetime from aiohttp import web imp...
This problem is from [CCC2019]: https://dmoj.ca/problem/ccc19s5/ (Canadian Computing Contest 2019) and I have implemented it in C++. I used sequence [A054237]: https://oeis.org/A054237/table to compute the indexes of sub-triangles. In a parallel universe, the most important data structure in computer science is the tr...
I am new in machine learning methods and I am trying to use a Random Forest regression. I want to explain the influence of my variables on the variable "one" and I have the following code: library (raster) library(caret) library(randomForest) facts= trainControl(method="cv", number=10,savePredictions = TRUE) in_train=...
I wrote some Java code to look up all files in a chosen directory (like it's showing in the Windows Explorer), and to display the results, but it seems to be slow. Can you tell me, how to speed up it? import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path...
I am generating a 9x9 grid on which I will play sudoku later by setting click listeners to each square on the grid. I first have a .xml file that represents a single square in the grid. This consists of the possible pencil marks someone ussually uses. The important thing I need feedback on is just the last piece of cod...
I needed a lot of data for a tensorflow project so I made a web scraper to get all of the text and links off of websites then to repeat the process at all of those links. I left it on overnight and it did not get much done, so I spent the day optimizing it. I can't find any ways to optimize it more (If anyone knows a w...
This is a problem set from the MIT online course : Suppose you want to set a particular goal, e.g. to be able to afford the down payment in three years. How much should you save each month to achieve this? In this problem, you are going to write a program to answer that question. To simplify things, assume: 3...
tl;dr I tried to write some as general and as feasible as possible code where entities are able to communicate with other entities of the same type or of different types, allowing for the recipient to reply to the sender. Details : Trying to work with some of the new contextual abstractions e.g. given and extension m...
I wanted to implement a selection sort and wanted to make sure that I'm doing it correctly. I wanted to do it in a way that's efficient and use recursion. Please let me know if I am doing this correctly or if there is a better way for me to do it. /** * selectionSort * @param toSort * @param sorted * @returns {Arr...
Instead of using the null checks I tried using Optional and safely unwrapping the optional. Approach 1 My first approach of unwrapping the Optional is using map() followed by orElseThrow(). Approach 2 My second approach if unwrapping the Optional is using orElseThrow() and setting the value to a variable and using it. ...
I am super proud of this python bingo game I wrote. I am posting it here to make get some help reviewing it to make sure I'm using the best practices. This is for a class, and my professor is a stickler for using best practices. I went above and beyond what the assignment called for so I need a little more helping maki...
I like to help people on StackOverflow, matter of fact nowadays it depends on how quick you are when answering question. With that being said, I can't always keep a tab and an eye to refresh the browser to view new questions. I made a very basic script to send me a notification (OSX) whenever there's a new question. im...
I would like to improve the naive matrix transpose algorithm by using a cache friendly algorithm. So far there are 4 variants. Iterate over the source matrix: MatrixXd transposeSrc() const { MatrixXd At(m_cols, m_rows); for (int i = 0; i < m_rows; i++) { for (int j = 0; j < m_cols; j++) { At(...
Problem Write a function that replaces the words in raw with the words in code_words such that the first occurrence of each word in raw is assigned the first unassigned word in code_words. If the code_words list is too short, raise an error. code_words may contain duplicates, in which case the function should ignore/sk...
I had some XSS protection code I wanted to add into my Web API/MVC application, the model that was used to bind was EditLocationViewModel as below. My initial plan was to add safeName = AntiXssEncoder.HtmlEncode(locationName, false) into the controller but that would leave the controller littered with AntiXssEncoder co...
The backup script itself. Make it executable and place it somewhere in your path: #!/bin/bash # Debug: # set -x # export PS4='$LINENO:' TAR_BACKUP_VERSION="1.01" # Stop on errors: set -e set -o pipefail # Run as root: if [ "$EUID" -ne 0 ] then echo "We need root (administrator) privileges to run this..." sudo ...
Q: I have a Bank class containing multiple loan accounts (LoanAccount class). I've create a LoanAccountService that have the CRUD functionalities. My concerns are about how I implemented the update functionality. Bank public class Bank { private List<LoanAccount> loanAccounts; } Loan account public class LoanAcc...
here is my issue when trying to override my equals method. this is what I have currently @Override public boolean equals(Object o) { if (this.name.equals(((Animal) o).getName())) { System.out.println("True"); return true; } else { System.out.println("False"); return false; } } I'm trying to compare the names ...
Below there is a function eating all strings and convert it to Unicode. It works fine. But is it the best way to do so? Is there maybe already an existing function for it? The reason was a German Windows version which prints German ä ö ü - error-messages which are retrieved from popen/communicate etc. There must have b...
I often have data stored in a Map that I need to retrieve by something other than the Key, so wanted to write a generic class that lets you define up to N keys (with the possibility of each key having a different class). Methods are definied to retrieve both the first matching result, and all matching results. I achiev...
I wrote a very rudimentary code that counts sentences and words in the arbitrary text. Code: class analyse(): def __init__(self,text): self.text = text def sentence_count(self): punctuation_marks = ['\.','\?','!', '\."','\.”'] space_newline_end = [' ', '\n', '$'] combine = ['...
I am having a hard time speeding up a function that I use to compute angular distances between data points in a matrix. More precisely, I want to compute $$\sum_{r=1}^n|\pi - \arccos\left(\frac{(X_{i}-X_{j})'(X_j-X_r)}{|X_{i}-X_{j}|\ |X_j-X_r|}\right) \times \frac{\pi^{(0.5k - 1)}}{\Gamma(0.5k + 1)}| $$… where \$X_i\$...
A Binary Tree Sort is an algorithm that builds a binary search tree from the elements to be sorted, and then traverses the tree (in-order) so that the elements come out in sorted order. Average Case Time Complexity : O(N log N) adding one element to a Binary Search Tree on average takes O(log N) time (height of a tree...
I'm trying to flatten a binary tree into a linked list. I have a working, correct solution: # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def insert(root, node): if root.right is None: root....
I'm working on a project where I needed to extract the indices for the headers of a CSV file to initialise objects. I thought that I should work on my documentation process and learn how to document code, seeing as I'm always reading about people not documenting code. /** * Returns the indices of searched for headers,...
I'm making an app that creates pdfs of images layed out in a grid. I know the size of each grid element and how many fit on a page, it works out to a 5x6 grid. The syntax is not the real focus, but the logic for how I determine when to start a new row or page. const pageconstants = { grid:{ x: 5, y: 4, } } con...
I'm making a simple program that generates a random password of some length with or without special characters, just for the sake of learning the C language. Finally I've got this working very well based on the outputs below: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> char *generate_...
I am working with a 3th party library which has following interface defined for a processing task: public interface IProcessor { void Execute( FileContent fileContent ); } Such an IProcessor gives me the possibility to change the FileContent before it gets written to the database. For legacy reasons, and for integ...
I have two sets of points in lists list1 and list2 given below list1 = [['a',[1.2,3.6,4.5]],['b',[3.2,-5.4,6.6]],['c',[1.1,2.2,9.9]],['d',[5.5,12.5,2.9]],['e',[3.5,6.5,22.9]]] list2 = [['v',[11.2,3.6,4.5]],['x',[13.2,-5.4,6.6]],['y',[11.1,2.2,9.9]],['z',[15.5,12.5,2.9]]] If all the points in list1 are rotated and/or t...
Sometimes some tasks can be taken a lot of time to end up. This code is created in order to play a random radio music in background while the script is running another task until to finish up and the music will stop too. The code is working well, just i'm waiting for any suggestion to improve this code, like to add a p...
I am looking for a more elegant way to validate in an input word can be created from a list of letters. # Necessary variables (change as needed to test your code). user_word = 'BANANA' letters = ['N', 'B', 'N', 'A', 'A', 'P', 'M', 'S', 'A'] # This function checks whether a word entered by the user contains appropria...
I've created a command line joke teller which makes Chuck Norris jokes after communicating with the Chuck Norris API. It also allows you to generate a random person by communicating to the names API and replaces Chuck Norris with that name. Execution goes like: 1) Asks you if you want a joke 2) Asks you to pick ...
I am translating a text into another language using Google APIs. Sometimes the translated text returned from the API does not match the case of the text provided - e.g. when translating the text "Now Activated" to German, I get the translated text response as "jetzt aktiviert" instead of "Jetzt Aktiviert". I wrote a...