15,181 Topics

Member Avatar for
Member Avatar for hotblink

Hi, I'm studying for a final exam and I just wanted to ask if you could be so kind to explain how you get these answers from these questions. I'm really confused on them. Thanks! 1) What is the output of the following program? def f(x, y): if y == …

Member Avatar for Xantipius
0
137
Member Avatar for dp121307

I tried to use a different forum but I was completely out of my league with the responses. I am extrememly new to python. As a project, I'm supposed to ask the user to input a file name, check that the file exists, output the numbers in the file, and …

Member Avatar for vegaseat
0
20K
Member Avatar for Jezza25

Hi I know how to import a individual file def cvt(s,default=-1): try: return float(s) except ValueError: return default import csv with open("Dealer1.txt", "rb") as csvfile: reader = csv.reader(csvfile, delimiter="\t") data = list(reader) I have a folder that contains 50+ files, using Glob, I created the following code import os import …

Member Avatar for Gribouillis
0
225
Member Avatar for Jezza25

Hi I have a script that is looking up multiple files, the files have a consistent layout they are a notepad from a CSV file. In some files there is a number and in some files there is a text. i have created a dictionary that one of the items …

Member Avatar for TrustyTony
0
109
Member Avatar for woooee

The problem is explained by the comments in the code. It is a fundamental question about the method call...every time I try text_box_name.tk_textBackspace() I get the TclError message. That's why I asked the question without the code... # When user enters a search word in the +search_box' text widget and …

Member Avatar for woooee
0
285
Member Avatar for aVar++

Hello, i have my naughts and crosses code as pasted below. Can someone help me with code to recognise if the game has come to a draw and recognising any invalid moves. Row1 = [" "," "," "] Row2 = [" "," "," "] Row3 = [" "," "," "] …

Member Avatar for slate
0
177
Member Avatar for MissAuditore

Hi guys, Trying to learn more about pandas csv reading. I have a file, with date and time on first row and a lot of data below. I want to be able to slice the data from T1 to T2 and use it for something. fname = "C:\Users\zana.pepaj\Desktop\Temperature.csv" data = …

Member Avatar for MissAuditore
0
187
Member Avatar for Jezza25

Hi Can I get some assistance with the following Code: Letter = raw_input("Enter Letter") A = 7 B = 8 C = 9 print Letter I have left the basic info but if the Letter A is entered in the print Letter it results A, I want it to give …

Member Avatar for Jezza25
0
99
Member Avatar for efwon

so I am new to python and I am trying to generate a 100 numbers from 0 to 10 and find out how many times a three appears. I'm not sure exactly how to get it to work. I basically just want to be able to count how many times …

Member Avatar for snippsat
0
232
Member Avatar for runlevel3nut

I'm returning to college after a 21-year absence and am starting fresh in a science stream. My first course in January will be the introductory Python course. In the meantime, I'm doing the Codeacademy tutorials and have completed the basic ones on variables, strings, comments, conditionals, some functions, and a …

Member Avatar for runlevel3nut
0
244
Member Avatar for slasel
Member Avatar for Lardmeister
0
105
Member Avatar for aVar++

I have got a simple naughts and crosses game working, can someone tell me a simple def blah(): .. command to check if the player has already moved to a place on the board already taken.. E.G Player's first go = top left Player's second go = top left.. (message …

Member Avatar for aVar++
0
122
Member Avatar for aVar++

Hey guys, i have been working on this for a while and global doesnt seem to be doing anything; help? Row1 = [" "," "," "] Row2 = [" "," "," "] Row3 = [" "," "," "] Grid = [Row1,Row2,Row3] x = False def NAC(): def check(): #only using …

Member Avatar for aVar++
0
287
Member Avatar for krystosan

I want to know how to check if the string given is a path with a file name or not , the file name with extension is not on disk but will be created later, but since its not created I cannot use os.path.isfile(filepathsupplied) so how should i check if …

Member Avatar for Gribouillis
0
127
Member Avatar for Gribouillis

This snippet is easy: it defines an immutable wrapper around a sequence type (list, deque, etc) which allows a class, function or module to expose a read only version of a sequence to the outer world. A constant wrapper around mapping types could also be defined in a similar manner.

Member Avatar for Gribouillis
2
576
Member Avatar for biscayne

I'm trying to find a record in a csv file in a nested stucture: for elem in lstLine[1:]: for item in open(fname): lstData = item.rstrip('\n').split(';') andexfield = lstData[0] if andexfield == elem: do bladibla Now I want ot add error handling: if no record in fname is found where andexfield …

Member Avatar for Gribouillis
0
271
Member Avatar for satsujin

Hi folks, I was wondering if there was some way to delete all Labels from a Tkinter canvas in one go. I'm not even sure if the labels are being drawn on the canvas since you only use the master(self.root) when creating it but I do the same for buttons …

Member Avatar for satsujin
0
2K
Member Avatar for jlh070945

I'm working through Python Programming by Zelle. I've entered the code for the racquetball problem in Chapter 9 exactly as written in the text. (At least I think so.) The program returns one game only then quits. I've prototyped and unit tested but can't find my mistake. Any insights would …

Member Avatar for woooee
0
145
Member Avatar for WhiteTulip

Hi! I'm writing a program that will take a an inputed phrase, assigns each letter to a picture of the letter from a file, and outputs the given phrase, looking like a ransom note. I have a start, but I'm not really sure where to go next. I've only just …

Member Avatar for woooee
0
309
Member Avatar for vegaseat

This Python code allows you to get selected statistics of a story text. It will count lines, sentences, words, list words and characters by frequency, and give the average word length. It should be easy to add more statistics using the dictionaries created.

Member Avatar for Ene Uran
3
801
Member Avatar for satsujin

I am trying to write a python app that will switch between two views when I click on the canvas in Tkinter. I have written the views and main app as seperate objects with binds linked to the opposing view through the left mousebutton. When I run the app in …

Member Avatar for satsujin
0
188
Member Avatar for krystosan

print "Maya Data Out > %s ",pickle.loads(process.stdout.read()) File "C:\Python26\lib\pickle.py", line 1374, in loads return Unpickler(file).load() File "C:\Python26\lib\pickle.py", line 858, in load dispatch[key](self) File "C:\Python26\lib\pickle.py", line 994, in load_tuple k = self.marker() File "C:\Python26\lib\pickle.py", line 874, in marker while stack[k] is not mark: k = k-1 IndexError: list index out of …

Member Avatar for Gribouillis
0
741
Member Avatar for sym366

I'm not really good wih the Big O notation so I was wondering if any one can help me find the Big O notation of this code for each of its function when they are best , worst, and adverage case and a brief explantation of why it's that. Sorry …

Member Avatar for TrustyTony
0
173
Member Avatar for giancan

Dear friends, I need our help for a new task. I have a gps track (sequence of lat long and altitude) and I would like to know if there is a way to make an offset (or a parallel line if you prefer) of this line to its right and …

Member Avatar for giancan
0
386
Member Avatar for Cosmo_Kramer

I am writing the following functions I cannot tell where I should leave off with the "bootstrapping" that the first function searchMaze() is supposed to be doing, the wording is not getting through my dense head. searchMaze(maze, start_pos, finish_pos) This function takes a maze data structure as created by readMazeFile(), …

Member Avatar for Cosmo_Kramer
0
248
Member Avatar for jrcagle

Generators are essentially dynamic sequences, making their official debut in Python 2.5. That got me to thinking: can we make a circular list with them? Why yes, we can...

Member Avatar for vegaseat
2
187
Member Avatar for vegaseat

You can alternately show one of two lines drawn on the Tkinter canvas by simply moving them on and off the canvas screen. This beats a cumbersome create and delete cycle.

3
529
Member Avatar for lewashby

Below is a short program I'M working of from udacity.com but I can't figure out why I'M getting the value 6 from the first call to the function. # Define a procedure, biggest, that takes three # numbers as inputs and returns the largest of # those three numbers. def …

Member Avatar for woooee
0
222
Member Avatar for tizzqman

I need help with a program i am doing. it is a cryptography program. i am given a regular alphabet and a key. i need to use the user input and use the regular alphabet and use the corresponding letter in the key and that becomes the new letter. i …

Member Avatar for woooee
0
108
Member Avatar for slasel

I am using turtle graphics with Tkinter however the problem is that the turtle graphics window comes over my root window and covers it! Is there a way to solve this? Note: i am using turtle inside functions if that makes any difference... import ImageTk import tkMessageBox from Tkinter import* …

Member Avatar for vegaseat
0
2K

The End.