15,185 Topics

Member Avatar for
Member Avatar for Sudo Bash

Hi all, I am fairly confident with Python, and am now turning my focus from learning how to program the language to learning to program it well. I am wondering what the best way to approch classes which have too many variables in them. I an writing a platformer game, …

Member Avatar for Sudo Bash
0
250
Member Avatar for june.pierre.311

I'm writting a program that will take a file as input and go through the list of numbers in the file and return the max number uing recusions. I'm not very good with recursions here is what I have so far. Also I'm not allowed to use the max command. …

Member Avatar for vegaseat
0
333
Member Avatar for pxalpine

Is there a way to read in a two-columned CSV file, and based on the fields in 1st column, output many different files? The input/output looks something like: input.csv call Call Mom. call Call T-Mobile. go Go home. go Go to school. go Go to gas station. play Play music. …

Member Avatar for rrashkin
0
195
Member Avatar for Delightfully

Hello All!! I have an assignement that I am working on and for some reason I cannot for the life of me recall how to do something so simple lol. The directions are too "Write a function named Exam, which takes one argument n where n>2. Your function creates a …

Member Avatar for Lucaci Andrew
0
309
Member Avatar for siaosituimoloaublood

i am in need of help with this homework. The instructions are as followed: Package Newton's method for approximating square roots in a function named newton. This function expects the input number as an argument and returns the estimate of its square root. The script should also include a main …

Member Avatar for TrustyTony
0
5K
Member Avatar for johnathan.millsap

#Guess the number game by Johnathan Millsap import random guessesTaken = 0 print('Hello! What is your name?') myName = input() number = random.randint(1, 100) print('Well, ' + myName + ', I am thinking of a number between 1 and 100.') print('Try to guess it!.') while guessesTaken <= 3: print('Take a …

Member Avatar for vegaseat
1
1K
Member Avatar for darealsavage

Hello everyone im pretty new to python and im having some trouble creating a program that takes a file containing numbers and imports it into python and makes it look like a table. the table is supposed to look something like this when the program is run. basically i figure …

Member Avatar for snippsat
0
261
Member Avatar for tizzqman

I need help with my code. Im kind of new to program and i need to do a final project for my class. I decided to do a converter program because i thought it would be sort of easy and challenging at the same time. but i wrote the program …

Member Avatar for sneekula
0
231
Member Avatar for mical700
Member Avatar for biscayne

Thw following piece of code generates 1 file for each row in csvData. I want to generate only 1 file and have already adapted the rest of the code. But not this main-loop. Is there an easy way to do this ? index = 0 # Generate the Scribus Files …

0
84
Member Avatar for biscayne

I have a piece of code where I fill variables with data and would like to add the first column of each row into the variable: So each variable in a row should contain: %VAR_ + 'value of column[0]' + headerRow[i] + % Now it looks like this which makes …

Member Avatar for biscayne
0
194
Member Avatar for bintony.ma_1

hi experts, I have a new quesiton following what I asked before: http://www.daniweb.com/software-development/python/threads/436159/python-remove-lines-when-two-specified-words-in-the-same-line I am still new python user, and hope and get your help again. my task is to do the following Python Remove current and following 3 lines when two specified words in the same line I have …

Member Avatar for bintony.ma_1
0
453
Member Avatar for sym366

trying to impleament a checkWin function that checks all possible wins for a player, but I'm notreally sure how to do it. from connect4cell2 import Connect4Cells from Tkinter import * class Connect4Frame(object): COLORS = ["White", "Red", "Yellow"] def __init__(self,rows = 6, columns = 7): self.cells = Connect4Cells(rows, columns, 3) self.rows …

Member Avatar for sym366
0
1K
Member Avatar for JazzyJ

I'm in my first AND LAST computer science class and I really need help with our final project. Up to this point all of my assignments have been completed from my teacher and TA standing over my shoulder telling me exactly what to do. I'm pretty sure they're just as …

0
120
Member Avatar for flopoe

Hello everyone; I am new to Python. How can we explain this code step by step. I couldn't understand some parts. myList=[43,21,12,80,3,2,35] end=len(myList)-1 while (end!=-1): swapped=-1 for i in range(0,end): if myList[i]>myList[i+1]: temp=myList[i] myList[i]=myList[i+1] myList[i+1]=temp swapped=i end=swapped print(myList)

Member Avatar for vegaseat
1
981
Member Avatar for inaxassan

Consider a hospital scenario. Design classes for: Patients. The class might have fields like unique ID for the patient, name, male or female, age, address, phone number, date of birth, height, and weight. I need help with this problem

Member Avatar for vegaseat
0
2K
Member Avatar for inaxassan

Design a schedule class for classes that a student takes during a semester? This is not a homework `class schedule: def classes(self, course, points, level,): self.course= course self.points = points self.level = level def get_course(self): return course.name` I am stock here

Member Avatar for vegaseat
-1
751
Member Avatar for slasel

Can I change the font size in only one widget and keep it the same in the root window? if yes then how please?

Member Avatar for vegaseat
0
240
Member Avatar for inaxassan

Design a class called "sentence" that have a constructor that takes a string representing the sentence as input. The class should have the following methods: get_first_word get_all_words replace(index, new_word) Change a word at a particular index to "new_word." E.g. If the sentence is " I'm going back." and set_word_at_index (2, …

Member Avatar for sneekula
0
1K
Member Avatar for inaxassan

class airlineTicket: def __init__(self, start, destination, dateoftravel, firstClass,\ economy, business, price): self.start = start self.destination = destination self.dateoftravel = dateoftravel self.firstClass = firstClass self.economy = economy self.business = business self.price = price Design a class for an airline ticket. Some of the fields of an airline ticket are start, destination, …

Member Avatar for sneekula
-1
2K
Member Avatar for redcar2228

This is my code for creating a url list and Im getting an index out of range error? Please help! #! /usr/bin/env python import re TOTAL_PAGES = 619 idFile = open("listOfURLs2", "r") outFile = open("output", "w") idList = [] urlList = [] temp = "" tempStr = "" currentList = …

Member Avatar for snippsat
0
388
Member Avatar for foodstamps

I'm trying to process a list contained within a separate text file. I am able to read the file, and generate an output containing the contents of the file, but the output generated is the unprocessed version, identical to the input. I do not encounter this problem when the list …

Member Avatar for foodstamps
0
309
Member Avatar for biscayne

Using print in a python script gives the following result: 10.25, 9.23, 8.97, 8.71, 8.40, 8.36, 8.30, 8.21 10.25, 9.23, 8.97, 8.71, 8.40, 8.36, 8.30, 8.61 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15 0.60, 0.60, 0.60, 0.60, 0.50, 0.50, 0.50, 0.15 4.85, 2.85, 1.85, 1.25, 0.95, 0.85, 0.80, 0.45 …

Member Avatar for biscayne
0
245
Member Avatar for piyush3dxyz

yesterday one of my friend tell me to make RTS engine in pygame......I know basic things which is used to make RTS Like 1. Unit selection 2. Unit moving 3. Resource management But only 1 thing i still cant figure out....Which is path finding.....I read all articles which is on …

Member Avatar for yoni0505
0
120
Member Avatar for prashanth s j

Hi all, could anyone please provide me a simple example of python threads? I tried looking at the python cookbook, but I find it quite confusing with its mentioning of thread, threading etc (I am familiar with threads in C only) All I want is: From my machine I need …

Member Avatar for Gribouillis
0
342
Member Avatar for That.T3rr11

I need help converting this python code to c# could someone help me please? #!/usr/bin/env python # encoding: utf-8 import sys, getopt import os, urllib, urllib2, re, string, math help_message = ''' ''' no_param = ''' ''' verbose = False fakeMode = False curPath = os.getcwd() + "/" # Should …

Member Avatar for deceptikon
0
508
Member Avatar for TeaAnyOne

12347 10000 secretary James Harrison 12348 20000 secretary Jade Powell 12341 40000 consultant Adam Johnson Hi, lets just say that the text above is a text file. I would like to store these employees information, then asking the user to search for (e.g payroll number) which then will print full …

Member Avatar for Lardmeister
0
79
Member Avatar for hpre

What is the best heuristic for solving the Sokoban problem (using astar and gbfs)? can you show me an exsample for the implementation?

-1
43
Member Avatar for hpre

please help! I keep getting this error : (-3, -3, IndexError('list index out of range',)) class SokobanProblem(search.Problem): def __init__(self, initial): ##-------- creates an object of the class ## tmp_list = list(initial) row_len = len(tmp_list) column_len = len(tmp_list[0])-1 goal_list = [] for i in xrange(0, row_len): tmp = list(tmp_list[i]) goal_list.append(tmp) goal_tuple …

Member Avatar for Schol-R-LEA
0
253
Member Avatar for StinaBremm

For my networking class we have to do an assignment using python to code a client and server that will connect to each other and the client will send these messages: 0 - Response This message is a response to a previous request 1 - Echo Request This is a …

0
148

The End.