shanenin

Moderator
  • Content Count

    3752
  • Joined

  • Last visited

Everything posted by shanenin

  1. I needed to do the line like this if i[0] in pool and i[1] in pool and i[2] in pool: the way I was doing it was like saying if 5 in pool: #i[2] = 5 it seems to only except the last elemnt in the argument
  2. I feel like I am going crazy. I do not see why this script is behaving the way it is. def winner(): pool = [1,2,5,6] winner = ( (1,2,3), (4,5,6), (7,8,9), (1,4,7), (2,5,8), (3,6,9), (1,5,9), (3,5,7) ) for i in winner: if (i[0] and i[1] and i[2]) in pool: print i winner() here is what I think this script should be doing. it should check every element in the tuple called winner; if all three numbers that comprise the element are in the list called pool, it will print the element from the tuple winner. here is where it is seeming to go wrong. i
  3. phpbb totally screws up my indenting. It makes my python code unrunable, assuming you just cut and pasted the results.
  4. I figured out a way to do it using the triple quotes. Since python expects you to indent properly I assumed my whole function needed to be indented the same. Below is the way I thought it needed to be. def instructions(): print """\n\n\tWelcome to the game of tic-tac-toe\n \t --a game of man against machine--\n\n you first need to choose to go first or second. If you choose to go first you will be X's. If you choose to go second you will be O's.\n you will choose your 'move' on the board by using the following key.\n\n""" instruc_list = [ '1','2','3','4','
  5. i got this off of ibms sight
  6. I do not understand why the instructions are being printed off of the margin(about 5 spaces). I would think they would be directly on the margin. I am talking about this part in particular if you run the script you will see what I mean. below is the script # print_board.py # # this function prints the board, it takes # its parameter in the form of a list, the # list must have at least 9 elments def print_board(order): print ' ',order[0], '|', order[1], '|', order[2] print ' -----------' print ' ',order[3], '|', order[4], '|', order[5] print ' -----------' print ' ',order
  7. do you mean boot the windows 2000 install cd? if it boots that(windows install cd) but not your linux cd, I would guess it was burned improperly
  8. I feel stupid. I was trying to use the info that I returned in the function with the varaible name used in the function wrong way print dir_list correct way print movie_find()
  9. I have this function below def movie_find(): import os import string ls_dir = os.listdir('/home/shane/freevo/movies') dir_list =[] for i in ls_dir: if string.find(i,'.mp4') != -1: if i[0] != '.': if string.find(i,'.conf') == -1: dir_list.append(i) if string.find(i,'.avi') != -1: if string.find(i,'.conf') == -1: dir_list.append(i) how do I use the return so I am able to use the list called dir_list out side of the function. I have tried adding return dir_list to the function, but that does not seem to help
  10. I will never be a good programmer, I do not even know what that means
  11. thanks. so long as I am checking for exit staus of zero it does not matter. The info you told me could come in very handy for an other day :-)
  12. the exit status of the bash command? if so this does not look right shane@mainbox shane $ /sbin/ifconfig | grep essi shane@mainbox shane $ echo $? 1 shouldn't the exit codes be the same? >>> ifconfig = os.system('/sbin/ifconfig | grep essi') >>> print ifconfig 256
  13. I want to use the output of /sbin/ifconfig to use in a python script. In particular if essi is found in the output, I want to use that info to set a variable in my python script. I have done it this messy way below using a text file, is there a more direct way of doing this. os.system('/sbin/ifconfig | grep essi; echo $? > .ifconfig') i = open('.ifconfig', 'r') ifconfig = i.read(1) this will set the variable 'ifconfig' to '0' if essi is found, or '1' if it is not found. This is a messy way of doing it, I am sure there is a more direct way possible(witout having to use a text file).
  14. isn't this indexing which make google seach good? to me the google bots seem like a good thing.
  15. this book I have is pretty cool. with every chapter some new ideas are introduced, then you use those ideas for a game. By the end of the book I should be able o make a basic gui game. In all honesty, I will probably get overwelmed(confused) come chapter 7 or so, will see :-)
  16. shanenin

    Help!

    thanks for the update. Glad you got it working :-)
  17. Give it a try, since it is an old computer your dad will probably not have a problem with it. You may get lucky with the wireless card. How come the card does not work with winodws, could it be bad? I would say go for it :-)
  18. I am guessing google changed the name of googlebot to google.com because it seems less threatening.
  19. I was just kidding(maybe you are also), I was just trying to be funny. I was also proud of my infantile game, so I was looking for any reason to post it :-) As for playing it, if you have python installed on your windows computer it should play as is. I know there is a way to make a executable that will allow you to play it even if you do not have python installed. I will check into that.
  20. Is this game good enough to sell for profit? so long as you use integers(whole numbers) the game seems to work bug free. If I can't sell it, at least I had a fun time writing it :-) #!/usr/bin/python # this is a program to make the computer guess the number # I chose between a interactively chosen range # This was programmed completely by # shane lindberg print\ """ This program allows you to play a guessing game against the computer. This is like the game "high/low" you played as a kid. You need to make the following rules. Pick a number that the computer will try to guess. To make it
  21. I remember the excitement of installing redhat for the first time. Have fun with ubuntu :-)
  22. are you sure xh1145dse is the correct model number? I was not able to get any hits on it using google.
  23. I just got my book; so far I am really impressed. The syntax feels very natural. The first two practice programs I have written were done without syntax errors, I did not even have to reference the book. This is out of the first chapter, so it is not complex. I remember trying to write my first practice C program, I spent the majority of the time finding syntax errors.
  24. If you are anything like me, you will manage to sneak in more often then you should.