15,179 Topics

Member Avatar for
Member Avatar for Mogworld937

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

Member Avatar for woooee
0
570
Member Avatar for dean.ong.14

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 …

Member Avatar for dean.ong.14
0
135
Member Avatar for dean.ong.14
Member Avatar for dezirike
Member Avatar for SSeema

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

Member Avatar for SSeema
-1
193
Member Avatar for dean.ong.14

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

Member Avatar for 铃
0
113
Member Avatar for Mitch275

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 …

Member Avatar for TrustyTony
0
177
Member Avatar for tushg

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

0
94
Member Avatar for valorien

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 …

Member Avatar for valorien
0
151
Member Avatar for nabzlfc

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 …

Member Avatar for nabzlfc
0
106
Member Avatar for Wire.Crisis

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 …

Member Avatar for Lardmeister
0
403
Member Avatar for sgeep

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 …

Member Avatar for vegaseat
0
317
Member Avatar for weblover

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 …

Member Avatar for weblover
0
296
Member Avatar for ised

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 …

Member Avatar for ised
0
3K
Member Avatar for rajashekharv

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 …

Member Avatar for abc0502
0
139
Member Avatar for rmbrown09

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 …

Member Avatar for rmbrown09
0
158
Member Avatar for vegaseat

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 ...

Member Avatar for snippsat
5
2K
Member Avatar for Inshu

Can I append a list obtained from a Class as output outside the class , if Yes how ?? can i use userList for this purpose ?

Member Avatar for Schol-R-LEA
0
205
Member Avatar for sHoM

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 …

0
305
Member Avatar for jworld2

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?

Member Avatar for vegaseat
0
5K
Member Avatar for elbarto

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 …

Member Avatar for TrustyTony
0
2K
Member Avatar for sun_2588

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 …

0
58
Member Avatar for Lyled93

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 …

Member Avatar for woooee
0
584
Member Avatar for nyxie

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 …

Member Avatar for abc0502
0
151
Member Avatar for DustinS

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 …

Member Avatar for Gribouillis
0
2K
Member Avatar for shanenin

I can't seem to see how this slice works test = (1,2,3) >>> test[::2] (1, 3) any insite would be helpful

Member Avatar for shanenin
0
1K
Member Avatar for dtripath

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’.

Member Avatar for vegaseat
0
112
Member Avatar for s123456

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

Member Avatar for s123456
0
399
Member Avatar for Lardmeister

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 …

0
140
Member Avatar for favoredanteater

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

Member Avatar for Schol-R-LEA
0
207

The End.