Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Johan Geldenhuys
So far: I tried >>> f = os.popen('ping 192.168.8.85 -c 100 > cap2.txt') You will see that I send the output from the command to a file, because I want to test how stop the command before it reaches 100 pings. If I don't write the output to the file 'cap2.txt' and succeeds in closing 'f', all th

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Alan Gauld
> Python has a "signal" module in the standard library. Will that work? Yes potentially, but you still need to mess about with process ids etc to find which process to send the signal... And you would have to do the two things in separate threads since system() blocks your main program. Alan g

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Alan Gauld
Nathan, look at the functions in the random module. randrange() would be one potential candidate. Alan G - Original Message - From: "Nathan Pinno" <[EMAIL PROTECTED]> To: Sent: Friday, October 28, 2005 3:07 AM Subject: [Tutor] Can anyone help me? Hey all, I am trying to create a prog

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Alan Gauld
> >>> f = os.popen('ping 192.168.8.85 -c 100 > cap2.txt') > > You will see that I send the output from the command to a file, because > I want to test how stop the command before it reaches 100 pings. > If I don't write the output to the file 'cap2.txt' and succeeds in > closing 'f', all the dat

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Johan Geldenhuys
If I use popen2, I need to write to one of the tuple parts. >>> f = os.popen2('ping 192.168.8.85 -c 100 > cap1.txt') >>> f[0].write('\x03') Thank command works, but 'f[1]' is in read-only mode and I can't write to it. My command in the background is still not terminated. BTW I use Linux as OS.

[Tutor] OT - Re: Can anyone help me?

2005-10-28 Thread Ed Singleton
You can actually increase your chance of winning in the English lottery. If two many tickets win a prize in one draw, the lowest prize (£10 for three numbers) is not paid out. Also the jackpot is shared between all the winning tickets (6 numbers) some sets of numbers like 1,2,3,4,5,6 are chosen b

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Alan Gauld
> >>> f = os.popen2('ping 192.168.8.85 -c 100 > cap1.txt') > >>> f[0].write('\x03') > > Thank command works, but 'f[1]' is in read-only mode and I can't write > to it. > My command in the background is still not terminated. Thats almost certainly because ping never reads its input. In that case

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Johan Geldenhuys
With what can I try and see what the PID is when using popen() or popen2() ? One thing that I noticed now is that when using popen() and the sys.exit(). The command is completed before my Python shell is terminated and if I use popen2(), sys.exit() works immediately but the ping command runs st

Re: [Tutor] OT - Re: Can anyone help me?

2005-10-28 Thread Johan Geldenhuys
Any chance of winning  £25million is a good one. ;-) Ed Singleton wrote: You can actually increase your chance of winning in the English lottery. If two many tickets win a prize in one draw, the lowest prize (£10 for three numbers) is not paid out. Also the jackpot is shared between al

Re: [Tutor] Passing Functions or Code as Parameters

2005-10-28 Thread Kent Johnson
Ed Singleton wrote: > On 27/10/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > >>Ed Singleton wrote: >>>Can I pass a block of code that will be executed within the function's >>>scope? >> >>Yes, you can define a function within traverse() and pass that function to >>things_to_do(), but I don't know

Re: [Tutor] syracuse sequence (collatz or hailstone)

2005-10-28 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hello > > I am trying to create a program that will calculate the syracuse sequence > which is also known as collatz or hailstone. the number that is input by > the user may be either even or odd. the number goes through a series of > functions which are x/2 if the numbe

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Johan Geldenhuys
>>> def randnum(): ...           c = [] ...   for x in range(6): ... s = random.randrange(50) ... c.append(s) ...   print 'Randoms: ',c ...   c = [] This works good !! Johan R. Alan Monroe wrote: Hey all, I am trying to create

Re: [Tutor] Random number generator (was: Can anyone help me?)

2005-10-28 Thread Johan Geldenhuys
After I tested the previous code, I noticed that the odds is 1:49 that a duplicate number can be found in the 6 digit range (and it happended) and that 0 can also be found. Here is the fix: import random def randnum():     c = []     for x in range(6):     s = random.randrange(0, 50)    

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Kent Johnson
Johan Geldenhuys wrote: > So far: > I tried > >>> f = os.popen('ping 192.168.8.85 -c 100 > cap2.txt') > > You will see that I send the output from the command to a file, because > I want to test how stop the command before it reaches 100 pings. > If I don't write the output to the file 'cap2.txt

Re: [Tutor] Random number generator

2005-10-28 Thread Kent Johnson
Johan Geldenhuys wrote: > After I tested the previous code, I noticed that the odds is 1:49 that a > duplicate number can be found in the 6 digit range (and it happended) > and that 0 can also be found. Look at random.sample() for a simpler way to do this. Kent > > Here is the fix: > > import

Re: [Tutor] File IO help

2005-10-28 Thread Kent Johnson
Mike Haft wrote: > Hello all, > I'm new to python but so far I have to say its a really good language > > I've been having some trouble with File IO can anyone help? I've got the > basics but my problem is that I have many files (one for each year of the > last 100 years or so) that look l

[Tutor] Joining non strings in to string

2005-10-28 Thread Eddie S
Hi, I have a list containing numbers. I want to join this list in to a string which I can then output. The problem is I cant seem to join list of non-string items in to a string. My list looks something like: list = [5,7,20,19,49,32] I could loop through the list outputing each number individual

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Liam Clarke
Alan Gauld wrote: > > You can read the output of popen into your program with > f.read(), but that will read all of the output after the program > has run. However I think you can readline() too to catch it > line by line. You can also write() data to f thus allowing you > to send your Ctrl-C.(You

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Liam Clarke
On 10/28/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > > >>> f = os.popen2('ping 192.168.8.85 -c 100 > cap1.txt') > > >>> f[0].write('\x03') > > > > Thank command works, but 'f[1]' is in read-only mode and I can't write > > to it. > > My command in the background is still not terminated. > > Thats al

Re: [Tutor] Joining non strings in to string

2005-10-28 Thread Wolfram Kraus
Eddie S wrote: > Hi, > I have a list containing numbers. I want to join this list in to a > string which I can then output. The problem is I cant seem to join > list of non-string items in to a string. > > My list looks something like: > > list = [5,7,20,19,49,32] > > I could loop through the li

[Tutor] Fwd: File IO help

2005-10-28 Thread Liam Clarke
On 10/27/05, Mike Haft <[EMAIL PROTECTED]> wrote: > Hello all, > I'm new to python but so far I have to say its a really good language > > I've been having some trouble with File IO can anyone help? I've got the > basics but my problem is that I have many files (one for each year of the > l

Re: [Tutor] File IO help

2005-10-28 Thread Liam Clarke
Oops, filePaths = [os.path.join(direc, item) for item in os.listdir(direc) if not os.path.isdir(os.path.join(direc, item))] should be > filePaths = [os.path.join(dirPath, item) for item in os.listdir(dirPath) > if not os.path.isdir(os.path.join(dirPath, item))] ... __

Re: [Tutor] File IO Help again

2005-10-28 Thread Liam Clarke
Heh, Cut 'im some slack there Bob, I only just figured out that line[:1] == line[0]... On 10/28/05, bob <[EMAIL PROTECTED]> wrote: > At 01:42 PM 10/27/2005, Adam wrote: > > >if line[:1] == "1": > > > >This line won't work because you're getting the first 2 characters from > >the line > > Oh? Did

Re: [Tutor] Fwd: File IO help

2005-10-28 Thread Kent Johnson
Liam Clarke wrote: > And, a question for the group, I've always found that line[:1] is a > complicated way of writing line[0]... is there any time when line[:1] > != line[0]? Actually I would say that the general case is for them to be different and in the special case where line is a string they

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 09:42 PM 10/27/2005, Nathan Pinno wrote: >If I create a program that randomly draws 6 numbers, its like the lottery. >According to an article I read in Reader's Digest, if you get a Quick Pick >- which is six numbers at random - you increase your odds of winning. Odds are how many tickets yo

Re: [Tutor] Python as Application (OT now)

2005-10-28 Thread Liam Clarke
On 10/27/05, Lee Harr <[EMAIL PROTECTED]> wrote: > >My son is learning something about using a spreadsheet - extremely > >useful and I support it 100%. That he thinks what he is learning is > >Excel is absolutely unforgivable, in terms of my understanding of > >ethical norms that once prevailed i

Re: [Tutor] equivalent of 'last' in perl

2005-10-28 Thread bob
At 09:50 PM 10/27/2005, Johan Meskens CS3 jmcs3 approximated: >what is Python's equivalent of 'last' in perl? > >if flag == 1: > break Yes. If flag is either 1 or 0 you may code it thus: if flag: break That's not the whole truth. Most types have a value that is seen as false in b

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Smith, Jeff
Aren't the odds just based on how many tickets you buy? The odds aren't affected by different people buying more tickets. If only one person buys a ticket in the entire lottery system, his odds of winning are the same as if two people play, and the same as if 20 million play. Jeff -Original

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 07:28 AM 10/28/2005, Smith, Jeff wrote: Aren't the odds just based on how many tickets you buy?  The odds aren't affected by different people buying more tickets.  If only one person buys a ticket in the entire lottery system, his odds of winning are the same as if two people play, and the sam

Re: [Tutor] ***[Possible UCE]*** Can anyone help me?

2005-10-28 Thread Nathan Pinno
Thanks Martin. You have a solid point. It would be a fun programming exercise anyway...I haven't programmed in ages it seems. :) Nathan Pinno For great sites go to: http://falcon3166.tripod.comMSN Messenger: [EMAIL PROTECTED],comYahoo! Messenger: spam_swatter31ICQ: 199020705AIM: f3mighty -

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Nathan Pinno
Hey, I created it. Want to see the code? Here it is: [code] import random numbers = [] while True: q = int(raw_input("Do you want a lottery number drawing? 1 for yes, 2 for no ")) if q == 1: for i in range(6): draw = random.choice(range(1,50)) numbers.append

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Smith, Jeff
Title: Message But the odds that you will win are not impacted by the number of tickets that are sold in total...only the number you buy.  When you take into account the total number of tickets sold, all you get are the odds that the lottery will be won by anyone.   I'm also a little confus

Re: [Tutor] syracuse sequence (collatz or hailstone)

2005-10-28 Thread andrade1
hello, Could I gather all of the values from print x into a string or a range? Since, I am not familiar with lists yet. def main(): x = input("Please enter a positive starting value: ") while x != 1: if x%2 == 0: x = x/2 else:

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 08:08 AM 10/28/2005, Smith, Jeff wrote: But the odds that you will win are not impacted by the number of tickets that are sold in total...only the number you buy.  When you take into account the total number of tickets sold, all you get are the odds that the lottery will be won by anyone.   I'

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 08:03 AM 10/28/2005, Nathan Pinno wrote: >Hey, >I created it. Want to see the code? >Here it is: >[code] >import random >numbers = [] Move this inside the loop following if q == 1 and get rid of the occurrence of this statement following print numbers. Less code, easier to read, more to the p

Re: [Tutor] os.system sending of break signals

2005-10-28 Thread Alan Gauld
>> to do that you need to find the process ID. I'm not sure if >> popen() provides access to the PID but if not you could >> either search for it (this might be too slow) or just drop >> down to use fork rather than popen, as fork will return >> the PID. > >Would calling PS via another popen() and

Re: [Tutor] syracuse sequence (collatz or hailstone)

2005-10-28 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > hello, > > Could I gather all of the values from print x into a string or a range? > Since, I am not familiar with lists yet. Here is a simple example of gathering values into a list and making a string: >>> r=[] # Start with an empty list >>> for x in range(3): # x w

Re: [Tutor] Python as Application (OT now)

2005-10-28 Thread Alan Gauld
> >useful and I support it 100%. That he thinks what he is learning is > >Excel is absolutely unforgivable, in terms of my understanding of > >ethical norms that once prevailed in an institute of higher education. > > > > I've never worked in any workplace where anything else other > than Excel wa

[Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
Hello: # I have the following dictionary: next_phases = {"open":"review","review":"write","write":"open"} # a 'phase is extracted by next_phase = next_phases[self.phase Note that the value for each of the first keys is the key for the next item, and that the value for the last key is the *first*

[Tutor] nokia 60 series

2005-10-28 Thread Mohammad Moghimi
Hi As you know nokia company lauched python for its cell phones. Do you know a good tutorial to write python programs for cellphones?-- -- Mohammaddo you Python?!! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Recursion and List Comprehensions

2005-10-28 Thread Carroll, Barry
Greetings:   I'm trying to improve my programming and Python skills.  To that end I have implemented a word jumble program as a recursive function:  given a string of arbitrary length, return a list of all permutations of the string each character exactly once.  In other words:       pe

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Hugo González Monteverde
Hi, There may be, but I do not understand what is it exactly what you are trying to do. If you're trying to implement a circular something that goes back to the first element after iterating the last one, then I'd think of a list, and using some modulus when iterating. Can you explain more of

[Tutor] Global var problem

2005-10-28 Thread Nick Lunt
Hi Folks, messing about with classes I've come across something basic that I don't understand. Take this class class T: def p(self): print x if __name__ == '__main__': x = 1 t = T() t.p() This outputs 1 Now this class T: def p(self):

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Hugo González Monteverde <[EMAIL PROTECTED]> [051028 12:51]: > Hi, > > There may be, but I do not understand what is it exactly what you are > trying to do. > > If you're trying to implement a circular something that goes back to the > first element after iterating the last one, Yes. You

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Alan Gauld
Tim, I don;t know if theres a better way but > next_phases = {"open":"review","review":"write","write":"open"} > > Note that the value for each of the first keys is the key for > the next item, and that the value for the last key is the *first* key. But I think this is pretty neat, I like it. N

Re: [Tutor] nokia 60 series

2005-10-28 Thread Alan Gauld
> As you know nokia company lauched python for its cell phones. Wild. > Do you know a good tutorial to write python programs for cellphones? That will depend on what kindf API they offer. Unless they open up the phone with a Nokia specific library/moduile it will be hard to do much that is us

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Alan Gauld
>def permute3 (word): >retList=[] >if len(word) == 1: ># There is only one possible permutation >retList.append(word) >else: ># Return a list of all permutations using all characters >retlist = [a list comprehension that ca

Re: [Tutor] Global var problem

2005-10-28 Thread Alan Gauld
> messing about with classes I've come across something basic that I don't > understand. As you say this has nothing to do with classes its more basic. Its about namespaces. Try reading the namespaces topic in my tutor for more info. Meanwhile lets simplify by removing the class bit def f():

Re: [Tutor] Question about an re

2005-10-28 Thread w chun
> - ->: \d+/?\d* > - -> > - ->ie 1 or more digits followed by 0 or 1 slashes followed by 0 or more > digits. this looks like it'll also accept invalid data, such as "1/" ... i think there's some more tweaking involved to get it so that if there's a '/', there is at least one digit afterwards. -

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Alan Gauld <[EMAIL PROTECTED]> [051028 14:05]: > Tim, > > I don;t know if theres a better way but > > > next_phases = {"open":"review","review":"write","write":"open"} > > > > Note that the value for each of the first keys is the key for > > the next item, and that the value for the last key i

Re: [Tutor] Global var problem

2005-10-28 Thread Andrei
Hi Nick, > messing about with classes I've come across something basic that I don't > understand. Your issue is not so much with classes as it is with namespaces. You'll hit the exact same problem with simple functions. > Take this class > > class T: > def p(self): > p

Re: [Tutor] Global var problem

2005-10-28 Thread Hugo González Monteverde
Hi Nick, Global variables in Python are global for *reading*, based in the precedence order for looking into the namespace: locals, globals(module scope actually), builtins for writing, as variables are created on the fly, a local variable will be created and will mask the global one. That's

Re: [Tutor] Global var problem

2005-10-28 Thread w chun
> if __name__ == '__main__': > global x > x = 1 > t = T() > t.p() as alan mentioned, it's all about namespaces. the "global x" you have in the above piece of code doesn't do anything (because you're already or still in the global [name]space). you're getting the

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Kent Johnson
Carroll, Barry wrote: >> >>>permuteList=permute2(word[0:pos]+word[pos+1:len(word)]) >> >>># Now, tack the first char onto each word in the list >> >>># and add it to the output >> >>>for item in permuteList: >> >>>retList.append(word[p

Re: [Tutor] Question about an re

2005-10-28 Thread Kent Johnson
w chun wrote: >>- ->: \d+/?\d* >>- -> >>- ->ie 1 or more digits followed by 0 or 1 slashes followed by 0 or more >>digits. > > > > this looks like it'll also accept invalid data, such as "1/" ... i > think there's some more tweaking involved to get it so that if there's > a '/', there is at lea

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Mark Brown
Nathan, While testing I noticed the same number coming up more that once in a set of 6 so what I've done: import random while True: q = raw_input("Do you want a lottery number drawing? 1 for yes, 2 for no ") if q == '1': numbers = [] for i in range(6): while T

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Andrei
Carroll, Barry wrote: > Greetings: > I'm trying to improve my programming and Python skills. To that end I > have implemented a word jumble program as a recursive function: given a > string of arbitrary length, return a list of all permutations of the > string each character exactly once. In

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Terry Carroll
On Fri, 28 Oct 2005, bob wrote: > At 09:42 PM 10/27/2005, Nathan Pinno wrote: > > >If I create a program that randomly draws 6 numbers, its like the lottery. > >According to an article I read in Reader's Digest, if you get a Quick Pick > >- which is six numbers at random - you increase your odd

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Andrei
Tim Johnson wrote: > Hello: > > # I have the following dictionary: > next_phases = {"open":"review","review":"write","write":"open"} > > # a 'phase is extracted by > next_phase = next_phases[self.phase > > Note that the value for each of the first keys is the key for > the next item, and that th

Re: [Tutor] nokia 60 series

2005-10-28 Thread Adam
On 28/10/05, Mohammad Moghimi <[EMAIL PROTECTED]> wrote: Hi As you know nokia company lauched python for its cell phones. Do you know a good tutorial to write python programs for cellphones?-- -- Mohammaddo you Python?!! ___Tutor maillist  -  Tutor@pytho

[Tutor] Can anyone help me?

2005-10-28 Thread Terry Kemmerer
> >If I create a program that randomly draws 6 numbers, its like the lottery. > >According to an article I read in Reader's Digest, if you get a Quick Pick > >- which is six numbers at random - you increase your odds of winning. > > Odds are how many tickets you buy relative to how many t

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread R. Alan Monroe
> Unfortunately, I don't understand how list comprehensions work and how to > implement them. Can someone point me in the right direction, please. Compare these two pieces of code x=[1,2,3,4] y=[] for eachnum in x: y.append(eachnum * 2) versus x=[1,2,3,4] y = [each * 2 for each in x

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Carroll, Barry
Alan et al: After reading the topic you recommended I tried rewriting my permute function as follows: ## def permute3 (word): if len(word) == 1: # There is only one possible permutation retList=[word] else: # Return a list of all permutations using all cha

[Tutor] Albertito and I want you to help us create a search engine.

2005-10-28 Thread Nathan Pinno
Hey all,   Albertito and I want you all to help us create a search engine for our site. Albertito heard that Google was created in Python, is this true? I want to know if such a task is possible, and if so, who is willing to help us create the script needed for our site. Thanks, Nathan Pinno Crew,

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Andrei <[EMAIL PROTECTED]> [051028 15:57]: Andrei, I really like your approach. Will which up an object interface for it. Will have other applications, I'm sure. thanks tim > Tim Johnson wrote: > > Hello: > > > > # I have the following dictionary: > > next_phases = {"open":"review","review":"w

[Tutor] AJAX resources for Python

2005-10-28 Thread Tim Johnson
Hi All: Are AJAX resources available for python? http://en.wikipedia.org/wiki/AJAX thanks Tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/list

[Tutor] Code Readability (was: Recursion and List Comprehensions)

2005-10-28 Thread Carroll, Barry
Kent Johnson <[EMAIL PROTECTED]> wrote: <> >>PS Don't get too crazy about eliminating intermediate variables, they can >>make the code more readable. >> >>Kent I agree. When writing for keeps (i.e. production code) I prefer clarity and ease of maintenance over 'elegance' or 'trickiness'. This

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Carroll, Barry
Greetings: Andrei gave me the answer I needed: <> >Let's fix that by extending the list instead: > > retList.extend([word[pos] + item for item in permuteList]) > <> The extend method solved the problem. Barry >-Original Message- >From: Carroll, Barry >Sent: Friday, October 28, 2005

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Carroll, Barry
Andrei: >Date: Sat, 29 Oct 2005 01:13:45 +0200 >From: Andrei <[EMAIL PROTECTED]> >Subject: Re: [Tutor] Recursion and List Comprehensions >To: tutor@python.org >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed <> >There's nothing magic about writing a

Re: [Tutor] syracuse sequence (collatz or hailstone)

2005-10-28 Thread andrade1
would this be a possible use of a list and appending even though I recieve an error from it: def main(): x = [1] x[0] = input('enter an int to start your syracuse sequence\n') while not isinstance(x[0], int): x[0] = input('no, please enter an int to start your syracuse sequ

Re: [Tutor] AJAX resources for Python

2005-10-28 Thread Kent Johnson
Tim Johnson wrote: > Hi All: > > Are AJAX resources available for python? > http://en.wikipedia.org/wiki/AJAX Turbogears supports AJAX using MochiKit on the client side and JSON for the protocol. http://www.turbogears.org/ Kent -- http://www.kentsjohnson.com __

Re: [Tutor] Albertito and I want you to help us create a search engine.

2005-10-28 Thread Liam Clarke
Mate, if I could write a search engine, let alone anything remotely as useful as Google, I'd hopefully be working for Google. Yah, Google heavily uses Python, but the Sphinxe's being built out of sandstone blocks does not mean that I'll be able to replicate the Sphinx by learning how to build wit