15,190 Topics
![]() | |
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?? | |
Here's the code I need to loop: [CODE] dmg = random.randrange(1, 10, 1) print "You have decided to attack the giant rat." ratHP = 100 ratHPN = ratHP-dmg print "you did" , dmg , "damge to the rat, giving it" , ratHPN , "left" ratHP = ratHPN [/CODE] If you … | |
Hi all, I would like to ask. Im Fairuz and the new member for this forum. I having problems to sort the multi dimentional array in python. ie: [('DcaUiVb_B09398-11', [None]), ('m3sui_R66441-35', []), ('m3sui_r26557-01', []), ('m3sui_R31225-24', []), ('m3sui_r66147-03', []), ('m3sui_R31225-23', []), ('m3sui_R30803-10', [])] I have the list but im having problems … | |
Hi.. Ive been doing python for about 2 days now (my 1st programming language) and im wondering, after ive made the .py file, and all the codes in it, how do i run it? To be honest im not even sure if the term compiling is right... I am doing … | |
This might be a little challenging, but I'd like to know. [code=syntax]from math import sqrt y = int(raw_input("> ")) x = sqrt(y) print x [/code] In this code, say I input 4 for y. The output will be 2, naturally. However, say I have 2 for y. I'd get something … | |
In the book, wxPython in Action (page 65), the following code shows how to bind an event to a frame (self) and to a button. In the case of the frame event (wx.EVT_CLOSE), no source argument is specified because the event is being bound to the object refenced as "self". … | |
The user enters a number and the program should output that amount of rows and colunmns. I have tried a couple of different ways butcant quite get it even though I think I am close. for example if 10 is entered it should look something like this: O OO OOO … | |
im currently running on windows 7 and i cant seem to find some suitable installation of mysql for python 3.1.2.. any help on this?my professor havent gave me any links on where to download it, anyone would mind helping me on this? or as i tried import mysqldb and i … | |
Hello, I have this code : import urllib import zipfile import re totaal = 0 commentaar = [] lus = True image = urllib.URLopener() image.retrieve("http://www.pythonchallenge.com/pc/def/channel.zip","channel.zip" ) bestand = "readme.txt" zf = zipfile.ZipFile('channel.zip') while lus == True : for filename in [ bestand ]: try: data = zf.read(filename) except KeyError: print … | |
I've been doing programming in tkinter for awhile now and I came across a problem...this problem only shows up after a single part but here is the code...kinda lengthy.if you go to the equip menu and equip bare neck you can't change necklaces again. any help in shortening this or … | |
so now that i have gotten farther in the code, it prints the substrings correctly, but i can't get the program to stop correctly. basically, i'm looking for the longest common substring. def main(): input1 =raw_input('Enter string: ') input2 = raw_input('Enter second string: ') if input1 > input2: str = … | |
Hi, I have just started my first semester in a Bachelor program 'Computer Engineering'. I have above basic knovledge in Java SE and currently am interested in Python. The problem is that I'm facing some difficulties in determing my purposes about my future career in IT field. I used to … | |
Hello Please excuse my lack of knowledge to python, but I just cannot understand how time complexity works. I've read many threads on this forum regarding time complexity but I am still quite confused. Our prof has given us this example: [CODE]def foo(n): ! while (n > 0): ! ! … | |
I have a pretty simple coding function that returns all possible substrings of a string including the string itself def main(): str = raw_input ("Enter first string: ") size = len(str) for sub_len in range (1, size + 1): for idx in range (0, size - sub_len + 1): sub_str … | |
am using debian lenny and tried to create a shutdwon script using python import os os.system("sudo shutdown -h now") i cant use this in debian lenny then how will i implement | |
Can someone please direct me to the code for the class <int> in python. I know that it must have written in C, but I could not understand, where to ask this query. Though I tried to figure it out myself, but could not even understand, which folder to attack … | |
Hello everyone. This is my first post so if something doesn't work, bear with me. I'm a beginner at python and tried to write a program that will calculate Average Word Length. I wrote what I thought should work but the final answer keeps coming out to an average of … | |
Hello, I have a image with a grey band in it. How can I know the values of only the grey band of the image ? Roelof | |
So I have this list of strings. They all of the strings have a 18 capital letters. I want to assign each letter a value and them sum up the total score. [CODE]window=['SALHWRAAGAATVLLVIVL', 'ALHWRAAGAATVLLVIVLL', 'LHWRAAGAATVLLVIVLLA', 'HWRAAGAATVLLVIVLLAG', 'WRAAGAATVLLVIVLLAGS', 'RAAGAATVLLVIVLLAGSY', 'AAGAATVLLVIVLLAGSYL', 'AGAATVLLVIVLLAGSYLA', 'GAATVLLVIVLLAGSYLAV', 'AATVLLVIVLLAGSYLAVL', 'ATVLLVIVLLAGSYLAVLA', 'TVLLVIVLLAGSYLAVLAE', 'VLLVIVLLAGSYLAVLAER', 'LLVIVLLAGSYLAVLAERG', 'LVIVLLAGSYLAVLAERGA', 'VIVLLAGSYLAVLAERGAP', 'IVLLAGSYLAVLAERGAPG', 'VLLAGSYLAVLAERGAPGA', … | |
Hey, I am working on a program for my class where we are supposed to count the letters that occur in a given string, with decreasing frequency. For instance, it would say there are 150 A's, 234 B's, 25 C's, etc. Plus, it would then become possible to sort the … | |
I am trying to insert data from a text file into an SQL table. I'm getting this error: " csv_data = csv.reader(file('TxtFile1.txt', 'r')) TypeError: 'list' object is not callable " [code] import MySQLdb, csv, sys conn = MySQLdb.connect (host = "localhost",user = "a", passwd = "b",db = "c") c = … | |
Hello, Now I'm making a program for creating language glossaries, but the problem is that windows uses ANSI for encoding text files, and the program that will read these files (which is not mine) only displays words in utf-8 encoding. Since my program is multiplatform, it can also work under … | |
I have the code below and I get everything except the bonus in the output. I tried it a few different ways and the bonus never comes out right after the staff and sales. #get user input for sales bonuses and make calculations #print headers print" Sales Tracking Program" print … | |
What is parsing and how do I use it? My guess is that parsing is something that locates a keyword in a statement. My guess, okay? I don't understand wiki. If it isn't, is there something that can locate something in a statement and do something if it finds it? … | |
I need the output of the following code to be printed in a text file. So far it creates the text file, but it does not print anything in it. Any help would be appreciated. [CODE]def findSlope (x1, y1, x2, y2): rise = y2 - y1 run = x2 - … | |
If we have more than one if statement, is it possible to combine them? Like this: [code=syntax]x = raw_input("> ") if x == a: print "1a" elif x == b: y = raw_input("> ") if y == a: print "1y" elif y == b: print "1b" elif y == c: … |
The End.