i have this piece of code which only prints the line number of the incorrect words.
i want it to print the linenumbers of the incorrect words from the txt file.
Am i able to modify this code to do that?
# text1 is my incorrect words
# words is my text file where my incorrect word are in
from collections import defaultdict
d = defaultd...
Hi. I'm working on my assignment on pthreads. I'm new and never touched on pthreads before. Is there any sample codes or resources out there that anyone of you have, that might aid me in my assignment?
Here are my assignment details. A pthread program about queue system:
Write a C/C++ Pthread program for a Dental clinic’s queuing sy...
What am I doing wrong/what can I do?
import sys
import string
def remove(file):
punctuation = string.punctuation
for ch in file:
if len(ch) > 1:
print('error - ch is larger than 1 --| {0} |--'.format(ch))
if ch in punctuation:
ch = ' '
return ch
else:
retur...
how to delete same lines in file .txt but keep one of them using c# ?
...
I've written backend for simple Bantumi game. Now I'd like to create a simple GUI for it, so that it would look like this :
How to start ? What layout should I use, and what type of component each element should be?
Classes :
Basket
Player
Game
Main
Shared
...
#modules
import sys
import string
#Importing and reading the files form the Command Prompt
#Document = open(sys.argv[1],"r")
Document = open('Wc.txt', 'r')
Document = Document.read().lower()
#Dictionary = open(sys.argv[2],"r")
Dictionary = open('Dict.txt', 'r')
Dictionary = Dictionary.read()
def Format(Infile):
for ch in string.pu...
Am I wondering if the follow are true.
If f(n) is O(g(n)) and f(n) is also Ω(g(n)) that means
f(n) is also big Θ(g(n)) right? Also if either of the 2 above are false, then f(n) is not big Θ(g(n))?
...
i have this piece of code
the last bit of the code starting from d = {}
im trying to print the words with its line number located in the text but it is not working its only printing the words anyone know why ???
need help ASAP
import sys
import string
text = []
infile = open(sys.argv[1], 'r').read()
for punct in string.punctuation:
...
I am trying to make a recursive program that calculates interest per year.It prompts the user for the startup amount (1000), the interest rate (10%)and number of years(1).(in brackets are samples)
Manually I realised that the interest comes from the formula YT(1 + R)----- interest for the first year which is 1100.
2nd year YT(1 + R/2 +...
This is for debugging purpose. I've got a for loop that generates some output to Cygwin bash's CLI.
I know that I can redirect outputs to text files and use Perl or even just a normal text editor to inspect the values printed out for a particular iteration, just feel that a bit painful.
What I am now thinking is, to place a special sub...
i have following pseudo code :
void siftup(int n)
pre condition n>0 && heap(1,n-1)
post heap(1,n)
i=n;
loop
/* invariant: heap(1,n) except perhaps
between i and its parent
if (i==1)
break;
p=i/2;
if (x[p]<=x[i])
break;
swap(p,i);
i=p;
please help me to write it in real code i have question about loop for exa...
I'm studying x86 and Real Time Systems, and I have a question, that is:
Which steps x86 follows to handle any interrupt ?
...
I've been tasked (coursework @ university) to implement a form of path-finding. Now, in-spec, I could just implement a brute force, since there's a limit on the number of nodes to search (begin, two in the middle, end), but I want to re-use this code and came to implement Dijkstra's algorithm.
I've seen the pseudo on Wikipedia and a fri...
Can someone explain this to me?
Such as this:
Given a function:
for k = 1 to lg(n)
for j = 1 to n
x=x+1
How would I analyze the tight (Θ) bound?
...
Hello. My task was as follows :
Create class Person with char*name and int age. Implement contructor using dynamic allocation of memory for variables, destructor, function init and friend function show. Then transform this class to header and cpp file and implement in other program. Ok so here's my Person class :
#include <iostream>
usi...
Hello,
In a method i am calculating the longest row of elements. The 1-dim array is filled up with random values (0 or 1).
The method looks up the longest row (being 0 or 1, whatever is the longest).
Meaning in for example:
1110100 --> the longest row would be 3 (3 * 1)
0110000 --> the longest row would be 4 (4 * 0)
The first ex...
My task is as follows :
Using pointers to class fields, create menu allowing selection of ice, that Person can buy in Ice shop. Buyer will be charged with waffel and ice costs.
Selection of ice and charging buyers account must be shown in program.
Here's my Person class :
#include <iostream>
using namespace std;
class Iceshop {
...
I'm implementing an MD-5 Hashing algorithm and I want to convert the text I have to bits so I can start manipulating them. As you know Hashing require taking block of bits and then manipulating them. There are many ways to do that but I can't determine the best/easiest way to just convert the text (string) into array of bits. Any clue ? ...
I need (simple) program which allows to choose what to use to transfer data - Infiniband or Ethernet and switch them in runtime. I searched through InfiniBand docs, google and google/codeseaarch and have found nothing. Please provide program or tips where can I find such information.
EDIT: OS and language of implementation doesn't matter...
I want to write a 'Date' class that behaves like a Value Type.
for example, Instead of writing a Clone method for setting properties safely, make the Date class to pass by value:
public Date Birthday
{
get { return this.birthday; }
set
{
this.birthday = value.Clone();
...