15,181 Topics

Member Avatar for
Member Avatar for nytman

dear list, what i have to do is, i have perform some mathmatical operation in one function and using its results as input into another function, here is my code of what i had done till now : import math def Math(x1,y1): a = x1+y1 b = x1-y1 c = …

Member Avatar for vegaseat
0
288
Member Avatar for frankenfrank

Since I noticed that these languages are rather popular, what are the advantages and disadvantages of each over the others? and what is the need/motivation for each one of them? Why are there no C++/Java libraries to deal with those needs?

Member Avatar for vegaseat
0
421
Member Avatar for hmx7

Use a while loop to collect a shopping list of items from the user. Then use a while or for loop to list it back to them. i have: item = int(input('How many items do you have? ')) while item > 0: input('Name of item: ') item -= 1 i …

Member Avatar for hmx7
0
137
Member Avatar for MrNoobieCoder

I am currently in need of help on a piece of homework, I'm using python 3.3 and i need to set a delay on a times table program that i created heres the code: def get_int(prompt="Enter an integer: "): """this function will loop until an integer is entered""" while True: …

Member Avatar for MrNoobieCoder
0
234
Member Avatar for matthew.s.thomas.14

I am looking for help in how to implement function avg() that takes as input a list that contains lists of numbers. Each number list represents the grades a particular student received for a course. List for a class of four students. ([95,92,86,87],[66,54,],[89,72,100],[33,0,0]) the function avg should print one per …

Member Avatar for BearofNH
0
381
Member Avatar for phorce

I don't know why I'm having such a problem with this, basically, I want to have a Queue that is constantly running during the program called "Worker" this then works, however, every 10 seconds or so.. Another method called "Process" comes in and processes the data. Let's assume the following, …

Member Avatar for woooee
0
269
Member Avatar for MrNoobieCoder

Hello, I'm currently working on a school project in which i can not get my head around into figuring out how to make a loop until the user has input an interger this is what i have so far : width = "hi" length = "hello" while width != int …

Member Avatar for MrNoobieCoder
0
274
Member Avatar for james.lu.75491856

import os import web ### Url mappings urls = [ '/', 'index', '/.*','notfound' ] for root, dirs, files in os.walk("C:/Users/James/Desktop/server"): for f in files: u = os.path.join(root,f) u=u.strip("/").strip("\\") ident=u.lstrip("C:/Users/James/Desktop/server").replace("/","slash").replace("\\","SLASH").replace(".","DOT") globals()[ident] = open(u,mode='rb').read() exec(""" class %(classname)s: def GET(self): global %(data)s return %(data)s """%{"classname":ident+"server","data":ident}, globals(), globals()) #create a class as if were …

Member Avatar for james.lu.75491856
0
356
Member Avatar for phorce

I have two threads, and, I want one thread to run for 10 seconds, and then have this thread stop, whilst another thread executes and then the first thread starts up again; this process is repeated. So e.g. from threading import Thread import sys import time class Worker(Thread): Listened = …

Member Avatar for Gribouillis
0
11K
Member Avatar for darkofpain

hi friends, To use the built-in web server to improve the infrastructure of the project that I do have some questions, but would like to get suggestions on these issues. 1 I want to accept and process thousands of instant connection 2 I want to do this with a simple …

0
77
Member Avatar for williampalme

I need some urgent help in the Python programming project. In this project I am implementing the file system which provides the capability to store and retrieve data on the virtual drive. The virtual drive is represented by an ordinary file on the computer. This will create the file on …

Member Avatar for TrustyTony
0
288
Member Avatar for Subhradeep

I am using Debian Linux and Python 2.7 with PIL. I want to capture an image from a webcam and store it in a file. What are the ways in which this can be done? Also,I want to covert the captured image for modification using Scipy. What is the procedure.for …

Member Avatar for Gribouillis
0
2K
Member Avatar for goo_1

What i'm trying to do is writing Program that print the number of newlines,words and characters in counted file by python I'm lost and i do not how should i do it? that what i got so far infilename = input("Enter the name of the file:") infile = open ( …

Member Avatar for vegaseat
0
326
Member Avatar for mohan.jce

shutil.copyfile which has a default buffer size of 16384 bytes , as u kno copying wil take more time.. Below is the code that increases the buffer size as 10 MB.. u can copy files that are in Gbs.. import os import shutil def copyFile(src, dst, buffer_size=10485760, perserveFileDate=True): # Check …

0
76
Member Avatar for krystosan

import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self, items=None): super(Example, self).__init__() self.items = items or {'India':['New Delhi', 'Bangalore']} self.initUI() def initUI(self): self.combo = QtGui.QComboBox(self) self.cbBox = QtGui.QComboBox(self) self.combo.addItems(self.items.keys()) self.cbBox.addItems(self.items[str(self.combo.currentText())]) self.combo.move(50, 50) self.cbBox.move(50,80) self.combo.currentIndexChanged.connect(self.onActivated) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Learning by practice') self.show() def onActivated(self): self.cbBox.clear() self.cbBox.addItems(self.items[str(self.combo.currentText())]) def main(): …

Member Avatar for krystosan
0
280
Member Avatar for RHNation

def main(): print('Welcome to the Fast Freight Shipping Company Calculator for Shipping Charges') print() #constants for the shipping prices weight_one <= 2 weight_two > 2 weight_three > 6 weight_four > 10 weight_one_rate = 1.10 weight_two_rate = 2.20 weight_three_rate = 3.70 weight_four_rate = 3.80 #get the weight of the package using …

Member Avatar for Lardmeister
0
4K
Member Avatar for rwe0

I am not sure how to do this, please let me know your suggestions. I want to have my python program be able to read the site I visit with a browser (firefox) separately. An example of useage would be this: In the browser log into my account (credit card, …

Member Avatar for rwe0
0
238
Member Avatar for bright.silva

@Gribouillis and other gurus in the house, i just did this code but seem i ssem to be having difficulties in modifying it to work the way i want it.Its a bit lenghty, pls pardon me because am still a beginner in python.This program prints out where a particular property …

Member Avatar for bright.silva
0
149
Member Avatar for chanchalrawat

I am writing a code of the consumer producer problem in python , so far I am almost ready but my code still not running.. Would you help me in any way to finish it, I am new in python and am not sure what I do wrong, any help …

Member Avatar for Gribouillis
0
354
Member Avatar for Paraborn

Hey guys, I'm new to this website as well as Python and well, programming in general. Anyway, I would like some feedback on this program I wrote, its purpose is to take a credit card number, which the user inputs and determine whether it is a valid or invalid credit …

Member Avatar for woooee
0
241
Member Avatar for hostme

Task A Download the files bank.txt and assignment2.py. The file bank.txt is the input file for the program. It consists of a number of lines of text, each with five fields. These fields are: • The customer’s first name • The customer’s last name • The customer’s account number • …

Member Avatar for hostme
0
268
Member Avatar for bright.silva

i am a beginner in python and still got a whole lot to learn.i have this exercise that seem too difficult to crack. check it out and see if you can help. here is a simple data set1=["01","34","29","16"] set2=["45","88","19","17"] set3=["56","21","57","20"] set4=["29","42","89","08"] set5=["19","45","56","20"] set6=["85","56","33","78"] using the data above, write this program …

Member Avatar for bright.silva
0
264
Member Avatar for varun mahawar

i am using cherrypy and i want the list itemes in new line like a=['abc','def','ghi'] abc def ghi in browser

Member Avatar for TrustyTony
0
114
Member Avatar for mike89

I'm experiencing a few issues trying to install rpy2-2.3.7 under Cygwin64 on Windows7 using R 3.0.1 and python 2.7 $ python setup.py install finds R version to be 3.0.1 at the beginning of the install, but on line 158 it bombs out for failing to discover the R version. I …

Member Avatar for Gribouillis
0
433
Member Avatar for hmx7

A GPA, or Grade point Average, is calculated by summing the grade points earned in a student’s courses and then dividing by the total units. The grade points for an individual course are calculated by multiplying the units for that course by the appropriate factor depending upon the grade received: …

Member Avatar for hmx7
0
787
Member Avatar for bumsfeld

This program uses Python module re for splitting a text file into words and removing some common punctuation marks. The word:frequency dictionary is then formed using try/except. In honor of 4th of July the text analyzed is National Anthem of USA (found via Google).

Member Avatar for sujit.shakya.3
2
1K
Member Avatar for dp121307

I'm making a class dataset. In it, I'm trying to set the minimum max and the mean. In my given test, I am asking the user to input as many grades as they would like so what I did, for example in minimum is this.. class Dataset(object): def __init__(self, grade): …

Member Avatar for TrustyTony
0
690
Member Avatar for Ravic85

Hello, I'm still very new to python, and I'm tyring to figure out how I would parse data from an input file. Here is what the input file would look like. B 128.9 hello 2918.1 hi 2938.2 world H 12.2 India 218.6 Lost 29.9 Place C 28.3 Watch 28.4 Found …

Member Avatar for phorce
-1
218
Member Avatar for vegaseat

Just a little fun with Python's named tuple, behaves like a class but is much leaner.

Member Avatar for vegaseat
2
677
Member Avatar for vegaseat
Member Avatar for vegaseat
2
1K

The End.