15,179 Topics
| |
I'm trying to make it so in my game when you equip your dagger it will change the variable dagger so I can tell if its equipped or not. from sys import exit from random import randint class Game(object): dagger = 0 def __init__(self, start): self.quips = [ "GAME OVER... … | |
how to loop and how to add score? and i want to make sure that people can ask how many question the want to answer in my quiz. how can i do that? # make input equal to Python3 style input even in Python2 try: input = raw_input except: pass … | |
For this option, you will first ask "how many rows?", and get a positive integer from them. Next, you will ask "how many columns?", and get another positive integer from them. The next step is to ask for an alignment of each column. They will enter "L", "C", or "R" … | |
` print "Welcome to my quiz" begin = raw_input("would you like to begin?: ") if begin =="yes": print "A)True" print "B)False" q1 = raw_input("Is Steve Jobs is the founder of Apple?") if q1 == "A" or q1 == "a": print "well done! you got it right!" else: print "thanks for … | |
Hi Guys, I'm currently making the transition from matlab to python and am having some difficulties with nesting for loops. Below is a rough example of what I'm trying to do. However when this executes abc is only returned as [] and not a 1D array of each iteration. Any … | |
**Running The Project Application in Pyramid Python IS NOT WORKING** Hi Every One:) i am a new to Pyramid & Python as per the website documentations i have installed and run the test But **THE MOST IMPORTANT PART "Running The Project Application" IS NOT WORKING** *could you please guide me … | |
Hi Everyone. I'd appreciate your help writing better code. I have a list of ~1000 values: list_of_values = [0x123D, 0x844F, 0x33E9, ....., 0xFFFF, 0xFFFF, 0xFFFF] The last values in the list will always be 0xFFFF, but I don't know how many exactly. What I want is to get rid of … | |
Hey Guys, Firstly like to say this is a great forum and has helped me a great deal in regards to learling a bit about python! But I have two programs which I require help with if possible :( **Program 1 -** *To search a text file for a user … | |
Hello all. I am very excited to have found this place in that I might better my very shoddy coding skills. I am trying to learn Python with a couple of books and some ideas for programs. I am trying to figure out a matter of what I think is … | |
Hey guys, I've been working on a project recently. It's pretty simple and a few friends helped me out with it, but I wanna try to improve it a little bit. I'm trying to add a sound file whenever a player wins/loses. Being brand new to Pygame, I'm not completely … | |
Hi, I'm trying to apply a linear regressipn function to my numpy array and then store the results in a new array. But i have 2 things that are not working for me. def regressioncal(valarray): new_col = [] linregres valarray = numpy.array(valarray) l=20000 for t in xrange(1,5000,10): for j in … | |
Write a nested for loop that displays the following outpout: 1 1 2 1 1 2 4 2 1 1 2 4 8 4 2 1 1 2 4 8 16 8 4 2 1 1 2 4 8 16 32 16 8 4 2 1 1 2 4 8 … | |
hi , I have a "C" test application which gives the test results in the plain text format. The contents of the test results for each of the test case will be as below. Summary ===================================== Test case id : atc-add-001 Test description: addition of numbers Test result : pass … | |
Hello, I am trying to generate word frequencies using ngrams. I have taken the brown corpus from nltk and changed it for use with ngram calculations by adding <s> and </s> at the beginning and end (in place of period.) I need to try and calculate the frequencies from this … | |
Python experiment to get an image from a web page and save it to an image file. Updated code to work with both Python versions ... | |
Can I append a list obtained from a Class as output outside the class , if Yes how ?? can i use userList for this purpose ? | |
I am creating a network bridge that connects two ethernet cards on the same machine. One of the cards is connected to the LAN and the other is connected to a network device. It looks something like this, [Click Here](http://i.stack.imgur.com/BcoQI.png) I am sniffing packets on both the interfaces and then … | |
I don't want to save all of my python files in the default directory, but if I save them elsewhere, python can't find the path to any modules I might be using. How can I change this to work? | |
Hello all, I have been searching for some time to find the most appropriate enviroment to draw lines and simple tri's / quads in three dimensional space. I have recently experiemented with the floatcanvas class in wxpython and I really like it for 2D work, but extending it into the … | |
Hello everyone, I am learning python from last 6 months, Just few days back i started learning Django. But at the starting only i get stuck. As you people must know that django bundle have a build in deployment server, i also used that only.. The steps which i perform … | |
Hello all, trying to get my program working. The program is to take input from the user in a hh:mmx format (x being p or a, standing for PM and AM) and tell the user how many minutes from midnight that time is. I was able to make it so … | |
I suppose I should post my question about the Twisted http server here, but correct me if I am wrong. I don't know much about python or the twisted server, but I have a project on it and I must install it in my pc. I have googled some stuff … | |
import os data = map(lambda c: ord(c), file(args[0]).read(os.path.getsize(args[0]))) For one file, os.path.getsize(args[0]) returns 10456 while len(data) returns 281. After looking at different files, I realized that it always stops reading at the 0x1A character. The documentation says that in Windows, Python uses _wfopen which (for compatibility reasons) interprets 0x1A (CTRL-Z … | |
I can't seem to see how this slice works test = (1,2,3) >>> test[::2] (1, 3) any insite would be helpful | |
How to write a function for highest denomination of any card in the hand.The denominations from lowest to highest are 2, 3,4,5,6,7,8,9,10,'jack,''queen','king','ace'.For example, highestDenomination({(6,'club'),(6,'heart'),('queen','heart'),('queen','diamond'),(2,'heart')})denotes‘queen’. | |
spring model....i want to get the program to return the value of the period of the motion of the pendulum i have tried putting this outside the loop oldVelocity = vector(0,0,0) and this inside the loop before v: oldVelocity = m.v with print statement: if oldVelocity.y/m.v <0: print ("time = … | |
This little experiment with Tkinter and pixel drawing shows some strange effects (look at line 27 comments!!!): '''tk_put_pixel.py place a pixel at pos=(x,y) with color=(r,g,b) on an image area note: one pixel might be hard to see, so create a series of pixels (line) ''' try: # Python2 import Tkinter … | |
python help on making the program accept other values? # Find the area and perimeter of a rectangle import math class Rectangle(object): """A 2D Recangle""" def __init__(self, width = 1, height = 2): self.width = width self.height = height def Perimeter(self): "Return the Perimeter of the rectangle" return (2 * … |
The End.