481 Posted Topics

Member Avatar for sgame144

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

Member Avatar for sgame144
0
90
Member Avatar for FumarMata
Member Avatar for aoi

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

Member Avatar for ahamed101
0
109
Member Avatar for nealpcarpenter

You guys really should have a good read up on Threading and follow the example given it will work fine for you

Member Avatar for Freaky_Chris
0
219
Member Avatar for amrith92
Member Avatar for scholar
Member Avatar for ohnomis
0
104
Member Avatar for volscolts16

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

Member Avatar for grumpier
0
100
Member Avatar for mruane

[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 …

Member Avatar for Freaky_Chris
0
209
Member Avatar for ravikiran032
Member Avatar for peter_budo
0
91
Member Avatar for Freaky_Chris

Hey, does anybody know any good tutorials for MPASM for the 16F PIC micro controllers? Thanks for any help. Chris

0
59
Member Avatar for Tommy_101

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

Member Avatar for Freaky_Chris
0
84
Member Avatar for lllllIllIlllI

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

Member Avatar for lllllIllIlllI
0
549
Member Avatar for JA5ONS

[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 …

Member Avatar for JA5ONS
0
119
Member Avatar for sreelatha

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+" <> …

Member Avatar for sreelatha
0
3K
Member Avatar for frijole

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

Member Avatar for frijole
0
184
Member Avatar for FreezeBlink

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 …

Member Avatar for rikxik
0
194
Member Avatar for frijole

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 …

Member Avatar for frijole
0
1K
Member Avatar for frijole
Member Avatar for LanierWexford

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 …

Member Avatar for Freaky_Chris
0
82
Member Avatar for ivy47469

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 …

Member Avatar for kdoiron
0
124
Member Avatar for athirar

you could split your list in to 2 smaller lists and process them indervidualy. Also you may wish to look into vectors Chris

Member Avatar for kdoiron
0
118
Member Avatar for nuaris

this is just the way python does it, this doesn't affect you in anyway does it? Chris

Member Avatar for nuaris
0
749
Member Avatar for ymf

[CODE=Python]for word in list: print word+",",[/CODE] or did i just miss what you asked?

Member Avatar for Freaky_Chris
0
104
Member Avatar for Shank89

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 …

Member Avatar for Shank89
0
135
Member Avatar for tondeuse34

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

Member Avatar for tondeuse34
0
131
Member Avatar for Mackjan

[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

Member Avatar for woooee
0
157
Member Avatar for alivip

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

Member Avatar for Freaky_Chris
0
244
Member Avatar for sarabhjeet

mywxpythonscript.pyw this will then run with pythonw.exe which doesn't run the commandline window Chris

Member Avatar for sarabhjeet
0
137
Member Avatar for Smythville

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

Member Avatar for Freaky_Chris
0
90
Member Avatar for FreezeBlink

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

Member Avatar for vegaseat
0
173
Member Avatar for cwolfraven

[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 …

Member Avatar for Freaky_Chris
0
99

The End.