481 Posted Topics
![]() | Re: Well you could use a simple array to count how many times each number occurs. [CODE=C++]int nums[= = {0,0,0,0,0,0}; nums[roll()-1] += 1; [/CODE] You get the idea, thats assuming roll() returns a number between 1&6 ![]() |
| |
Re: Hmm lets try adding code tags, so it becomes a bit more readable. Also couldyou give us a little clue as to what problems you are actually having cause thats alot to look over when we don't know what were looking for Chris | |
Re: You guys really should have a good read up on Threading and follow the example given it will work fine for you | |
Re: nvm shush i should think perhaps its in your other file | |
Re: this may help [url]http://www.daniweb.com/forums/thread147970.html[/url] | |
Re: Is that all your compiler tells you about the error? That is not the reason since it is the LINKER that has thrown the error up which means it has compileid fine just the linker. Chris | |
Re: [QUOTE=evstevemd;699985]Their big goal is to dethrone C/C++ from kingship of gaming programming! [/QUOTE] Good luck to them on that one, as an interpreted language its not exactly the fasted language out there. Although i must say Oblivion use Python very well, but that isn't so much Pygame as far as … | |
Re: Perhaps [URL=http://www.computerhope.com/jargon/i/ip.htm]this[/URL] will help | |
Hey, does anybody know any good tutorials for MPASM for the 16F PIC micro controllers? Thanks for any help. Chris | |
Re: I'm not sure if I fully understand what your problem is. However you may wish to look into [CODE=Python]os.walk() os.path[/CODE] You may find these helpful in locating and accessing files on a system. Chris | |
Re: Tkinter is the easier, and has one big advantage; its standard. However i personally find hat wxPython is better although slightly harder to learn. Chris | |
Re: [CODE=Python]m= start[0]*60+start[1] n= finish[0]*60+finish[1][/CODE] here there is a problem, start[0] refers to the first character in the string start. so from your exmaple of 14, 12 start[0] would be 1. and start[1] would be 4. Also you would need to convert those to intergers before multiplying by 60 otherwise you … | |
Re: Simple read the use file.readlines() on both files to give you 2 arrays so something like this [CODe=Python]f1 = open("file1.txt", "r") f2 = open("file2.txt", "r") fileOne = f1.readlines() fileTwo = f2.readlines() f1.close() f2.close() outFile = open("results.txt", "w") x = 0 for i in fileOne: if i != fileTwo[x]: outFile.write(i+" <> … | |
Re: wxPython, will aid you with GUI so will Tkinter (whic is built it). They will also allow basic graphics. For more detials graphics have a look at PyGame. Chris | |
Re: indeed it is possible, very easy actually [CODE=Python]import os os.system("cd [directory]")[/CODE] and if you want to make it so that you can type commands into your python commandline [CODE=Python]import os while True: command = raw_input("Enter Command->") if command.upper() == "Q": break try: os.system(command) except: print "invalid command\n"[/CODE] One thing to … | |
Re: perhaps you could run a different script that calls the scripts you want to run every 30 seconds, also if your on windows you could call os.system("cls") from within your script assuming you have imported the os module 'import os' this will clear the console for you. Im sure there … | |
Re: does ctrl + c not work? this is a basic interupt command. Chris | |
Re: This is trusting you have python install on your pc. Im guessing you don't since if you did then you could simply double click the file and it would run, if your on windows. If your on linux you need to change the access rights via chmod to 755 to … | |
Re: One thing to note is that you have to do the calculations over and over until the money is depleted. One thing i would do is consider how i would ad interest. id they enter 6% that is the same as balance*0.06. That is how much interest is added to … ![]() | |
Re: you could split your list in to 2 smaller lists and process them indervidualy. Also you may wish to look into vectors Chris ![]() | |
Re: this is just the way python does it, this doesn't affect you in anyway does it? Chris | |
Re: [CODE=Python]for word in list: print word+",",[/CODE] or did i just miss what you asked? | |
Re: when you set your x and y positions you need to check to if the new postion will be >10 or <1 if so it is an invalid move. Please use [code] tags this will keep indenting and make it possible to actually read our code. You need to then … | |
Re: what you saying is you want to use the same bit of code over and over? sorry if this is not what you are asking if so then you use a function [CODE=Python]def myFunction(param1, param2): print param1 print int(param2)**3 myFunction("Hello", 2) myFunction("Joe", 3)[/CODE] Hope this helps Chris | |
Re: [QUOTE]First print --> [2, 5, 7, 7] 4 Second print --> (4, [2, 5, 7, 7])[/QUOTE] the first print is showing 2 different objects. The second print is showing 1 object. Read about lists & tuples, embedding in particular, this may help you understand Chris | |
Re: It works perfectly, you just need to read about unicode(UTF-8) encoding and other data encoding. By default you are using ascii....which arabic characters do not fall under. Chris | |
Re: mywxpythonscript.pyw this will then run with pythonw.exe which doesn't run the commandline window Chris | |
Re: Indeed there is [CODE=Python]while True: overWrite = raw_input("Would you like to overwrite log file? (y/n)->") if overWrite.upper() == "Y": break elif overWrite.upper() == "N": break else: print "Invalid Option\n"[/CODE] ignore naming of variables etc, thats just taken from something im working on myself right now. Chris | |
Re: One way is to raise you own exception and then catch it with a break. [CODE=Python] class myException(Exception): pass w = input("Enter width") h = input("Enter height") for x in range(0,w): for y in range(0,h): print x,y if (raw_input("Stop? y/n") == "y"): raise myException except myException: break[/CODE] any help? Chris | |
Re: [CODE=Python]import os folderA = [] for path, dirs, files in os.walk("C:\\Folder A"): for f in files: folderA.append(f) i = 0 for path, dirs, files in os.walk("C:\\Folder B"): for f in files: os.rename(f, folderA[i]) i += 1[/CODE] Something like that should work nicely for you. Not tested so if it doesn't … |
The End.