15,185 Topics
| |
I'm trying to write a code where I should have a few questions and an input for an answer. If the answer is correct, then it will tell me correct and wrong if it is wrong. I found a similar solution on this site, but the difference is that I … | |
def sort(l, x) if len(l) <= 1: ### if my list is smaller than 1, simply return l return l else: ### Here is the problem i don't know how to solve - how to find smallest element within a list using recursion? I've tried to call another function in … | |
can I somehow extract single file from a zip archive without replicating directory structure inside zip file ? for example file I need is : archive.zip/folder1/folder2/fileIneed.doc when I use zipfile.extract I get the file, but I get it in destination folder with same directory structure. I'm at home now and … | |
hey guys n girls, im using python 3.1.2 i am currently creating a process to: 1) check a directory does not exist, 2) check for illegal char's from a list i have made, 3) pass it to a program,-program creates directory, 4) and passes a value back to python 5) … | |
I'M getting an error in the following program on line 38 to a function call. The function is in the gameobjects module and the there's an error there as well on line 21. Here's the code. Code:[CODE] background_image_filename = 'sushiplate.jpg' sprite_image_filename = 'fugu.png' import pygame from pygame.locals import * from … | |
I really need help. The output is supposed to read a text file with the coordinates and print them to a text file, but I am not sure what lines of code to write and where to insert them. Here are the coordinates that are in there own text file: … | |
Hey guys. I'm new to Python. I kinda blundered into a CIS major at the university I attend, and I have to say, I haven't enjoyed the Python class so far. It's so... esoteric. I'm having a TON of trouble grasping what the rest of my class view as simple … | |
[CODE]import pygame from pygame.locals import * from sys import exit pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) font = pygame.font.SysFont('arial', 32) font_height = font.get_linesize() while True: for event in pygame.event.get(): if event.type == QUIT: exit() screen.fill((255, 255, 255)) pressed_key_text = [] pressed_keys = pygame.key.get_pressed() y = font_height for key_constant, pressed … | |
the problem is that of a path planning algorithm. the obstacles will be rectangular shaped boxes. what i need to do is detect the rectangular boxes, and then add a black "aura" around these boxes. any ideas on how i go about doing this? | |
Dear Sir, I would like to extract only unique terms from all sdrf.txt files but this python code outputs unique terms for every file individually. Like Array Data File , Array Design REF ... are repeated in most of sdrf.txt files so i don't wanna print it as unique terms. … | |
Hello Everyone, i would like to make a file in which i move the mouse to coordinates x and y and click the scroll button(middle button). this is what i want but works for left and right i have on idea how to make it work with scroll/medium button. any … | |
Hi guys, new here, and new to python. And I thought I would ask for a bit of guidance on this piece of code I'm working on. The following block of code is supposed to output all positive factors of the entered integer. However, it does not work properly. The … | |
Hi, I have created a program in Python which creates a database called inb104 and loads the data from text files into the mySQL server. The code works perfectly fine. The data is inserted into the table without any issues. The problem is that I would like to place the … | |
Hi there, I would need some help with my code...its in python, and the thing I have to do is to make points of the matrix of the object be displayed in a way to make the first camera position as a start of the coordinate system! to clarify a … | |
Hai all... I want to get different colored bars for labels 'Bill', 'Fred', 'Mary', 'Sue' can any one please tell me ...as soon as possible..... [CODE]#!/usr/bin/env python """ The new ticker code was designed to explicity support user customized ticking. The documentation http://matplotlib.sourceforge.net/matplotlib.ticker.html details this process. That code defines a … | |
This is my code: Vigenere cipher : [CODE]from graphics import * ##def encode(message, keyword): def main(): win= GraphWin("Vigenere cipher", 400,350) messagebox = Text(Point(100, 60), "Enter message to encode") keywordbox = Text(Point(63, 120), "Enter Keyword") encodedbox = Text(Point(75, 250), "Encoded Message") message = Entry(Point(290, 60), 20) message.setText("") keyword = Entry(Point(290, 120), … | |
Hi guys. This is my first post here and I've read through the forum quite a bit and can't wait to get more involved. So here is my main problem: getting my code to take the text I enter into an entry box to be recognized as a string so … | |
Hello I'm trying to make a stem and leaf plot. The first function is supposed to call the other two functions and return the final plot. My code works for the first elemnt in the list and then stops. Is there something I have to do within my for loop? … | |
i have a csv file from where in i read the data and store individual coloumns in list , but for the last coloumn i am getting \n in the list . i want to get rid of that . [CODE] f = open('datagen.txt') for lines in f: line = … | |
I made a wxPython gui to interact with a camera, however the lab is very matlab centric and the professor wants everything to be controllable from matlab. I think this is more of a matlab problem, but it's python related and I thought it might be a little odd to … | |
Hi, all I have been learning the python language for a couple of weeks. For now I only know a little of the language, the syntax, usage of the builtin types such as str, lists, dicts, and tuples, this is fine for writing some simple scripts to process text files. … | |
Hi all. I'm trying install python 3.1.2 on RHEL4 from source, but 'make' failed to build some necessary modules. Followings are from build log: *** WARNING: importing extension "_ctypes" failed with <class 'AttributeError'>: 'module' object has no attribute 'load_dynamic' Python build finished, but the necessary bits to build these modules … | |
Hello, I'm pretty new to programming in general, and I'm trying to get started with python. Whenever I open up IDLE, everything seems to work fine. However, when I go to File>New Window, I just get a blank window and everything freezes up. If I restart my computer, I can … | |
[CODE] b2 = raw_input("Select your action:") if b2 == "Attack": mgeHP = 2500 print "You have decided to attack the mage." while True: dmg = random.randrange(1, 125, 1) mgeHPN = mgeHP-dmg print "You did" , dmg , "damge to the mage, giving it" , mgeHPN , "left" mgeHP = mgeHPN … | |
Hey Daniweb, I'm starting out learning python and have been looking around and saw the thread on printing a line that starts with a specific word, I would like to create something similar except take numbers out of text and print them so I can graph them. So far I've … | |
Ahoy Sailors! So to simplify this right from the start, When someone connects to my Host script, They first send a string with their PC name attached. [code]n:JoeyBlowHole-PC[/code]We'll store this into a variable, Along with any others that are being sent. So it may look like this. [code]JoeyBlowHole-PC:JohnBinBag-PC[/code]Now I'm needing … | |
Dear friends, I am a new programmer and i have a task to make a phonebook with python. Please help me to finish my task. The program should repeatedly ask the user for input. Each primary input is one of the words “help”, “lookup”, “enter”, “remove”, and “quit”. If the … | |
This is my first function in python and i need to get item quantity and price loops into the function Processorderitems. I took out the items loop because I was not doing anything with it. I need to return the subtotal and I have a 3% discount for quantities over … | |
hi, I'm creating a game with pygame and i want to create a matrix that will represent the map(where each tile will be). my pygame code is ok, because if i create the map without loading the tilemap (the matrix file) the game runs ok. that would be good but … | |
Is there any method or library to translate pysnmp OIDs to human readable strings?? |
The End.