15,175 Topics

Member Avatar for
Member Avatar for giancan

Dear all, I wrote 2 scripts and at a certain point of the first I would like to run the second, and when the second is done, to go back to the first and continue with it. How can I do it? I put at the desired point of the …

Member Avatar for giancan
0
183
Member Avatar for RM@Bowdoin

I'm trying to find degrees of separation between any two actors in a movie database. I succeed when I reach my base case, which is 1 degree of separation (i.e. actor is in same movie as another actor) but I use recursion to find all other degrees of separation, and …

Member Avatar for Gribouillis
0
2K
Member Avatar for my_py

I have written almost all of my program, except I am stuck on this certain part. I need to write an averege out to figure all students final grades out as a statistic of the course. Students name and final grade have been appended to an external file(keep in mind …

Member Avatar for my_py
0
170
Member Avatar for as3g

I just completed an assignment, and both scripts function the same ultimatley, but just wanted to know if there were any potential differences, or is it just a matter of style? [CODE] if num % 2 ==0 : new = num //2 num = new print(num) count = count +1 …

Member Avatar for Gribouillis
0
152
Member Avatar for eternalcomplex

Hi, I am using the command in python from a linux system: [CODE=python] import os os.system('grep "^[0-9]" data.txt | wc -l') [/CODE] The output of this is an integer like 115. Can I assign this to a variable somehow? For example: x=os.system('grep "^[0-9]" data.txt | wc -l') DOES NOT WORK. …

Member Avatar for Gribouillis
0
49
Member Avatar for bibidiboo

Hey guys I need some help with making the iframe be dynamic with the webpage. it is in video_page and I cant seem to get around it. here is the code: [code] def video_page(self): return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" …

0
65
Member Avatar for C@un5el@r

Hi - I know that this has been somewhat discussed in a couple of threads, but I haven't seen anything with an actual answer. What would the design or pseudocode look like? Write a program that checks HTML files to determine whether the embedded XHTML tags are balanced. The program …

Member Avatar for TrustyTony
0
473
Member Avatar for MakingMoney

I've been asked to write a program that computes the nth Fibonacci number where n is a value input by the user. For example, if n = 6, then the result is 8. This is what I have so far: def main(): print "This program will compute nth Fibonacci" print …

Member Avatar for TrustyTony
0
2K
Member Avatar for sofia85

Hi,I was wondering how to read and write strings in python. I have this code where I'm creating a path, but its a string, and now I want to write to this string. But keep getting this error message [I]AttributeError: 'str' object has no attribute 'write'[/I] I was thinking about …

Member Avatar for Gribouillis
0
235
Member Avatar for Cheese7

Hey, I'm new to Python programming and I've been making a simple rock paper scissors program for practice. I've managed to get it working; it asks the player to enter 'a' for rock, 'b' for scissors or 'c' for paper. If the player entered a, b or c, a number …

Member Avatar for Cheese7
0
152
Member Avatar for draven07

..uhm...hello...i'm new to python programming and I really want to explore more about this... ...i just want to know what is the best compiler I can use for this...

Member Avatar for draven07
0
246
Member Avatar for Shady Baddarni

how can i compare 2 string for bull hit game in python. i wrote the program itself. how can i find how many hits and bulls i have. [CODE]import string import random import re m = input (' Please input the long of the string you want to guess :') …

0
89
Member Avatar for bigredaltoid

Hey guys, I need to print a dictionary from a text file and than print it again with the last two values updated in each row. The text file appears as so: 12345678 Joe Dokes IT 30 95 87654321 Sally Sue ISYS 50 87 34876293 Bo Burnham MATH 60 78 …

Member Avatar for bigredaltoid
0
133
Member Avatar for felix001

I need to write a small bit of code that will print an error if I cannot resolve the name to IP. I see that you can use the "socket.gethostbyaddr" methods but I cant seem to find a simple method/exception for when it does not find an IP address. Also …

Member Avatar for Gribouillis
0
221
Member Avatar for funfullson

Hi every body. I want to make a topographical image from a 2d Aerial photograph. how can I do it in python? Thanks if help me.

Member Avatar for hughesadam_87
0
115
Member Avatar for ERINY

Hi, i'm python beginner. how to make that only use def, for, list, while .. [CODE] def comb(n,r): if r == 0: return 1 elif r == n: return 1 else: return comb(n-1,r-1) + comb(n-1,r) [/CODE] this code is very slow.... ah , I have to use recursion .! please …

Member Avatar for TrustyTony
0
1K
Member Avatar for Jetster3220

Task: • Create a text file with 5 questions in it. • Read each question in from the file. • Ask the user for their response. • Create a new text file. • Write the user’s answers to the text file. • Ask the user if they’d like to review …

Member Avatar for woooee
0
314
Member Avatar for bigredaltoid

Hi all - I need to write a code that reads in a 20 line file 4 lines at a time, and puts the five sets of 4 strings into their own individual strings. So there should be five strings containing 4 strings each. I am very confused and havne't …

Member Avatar for bigredaltoid
0
164
Member Avatar for sainitin

Hi all, I have text file as follows... >s1 MPPRRSIVEVKVLDVQKRRVPNKHYVYIIRVTWSSGATEAIYRRYSKFFDLQMQMLDKFP MEGGQKDPKQRIIPFLPGKILFRRSHIRDVAVKRLIPIDEYCKALIQLPPYISQCDEVLQ FFETRPEDLNPPKEEHIGKKKSGNDPTSVDPMVLEQYVVVADYQKQESSEISLSVGQVVD >s2 MAEVRKFTKRLSKPGTAAELRQSVSEAVRGSVVLEKAKLVEPLDYENVITQRKTQIYSDP LRDLLMFPMEDISISVIGRQRRTVQSTVPEDAEKRAQSLFVKECIKTYSTDWHVVNYKYE DFSGDFRMLPCKSLRPEKIPNHVFEIDEDCEKDEDSSSLCSQKGGVIKQGWLHKANVNST . . . I wanted to count letter 'P' in each sequences output should be > s1:10 > s2:20 To acheive this python script as follows infile=open("file1.txt",'r') out=open("file2.csv",'w') for line in infile: line = …

Member Avatar for woooee
0
192
Member Avatar for sofia85

Hi, I have written a program that searches through a text file and in the end I want it to give me some probabilities. In my program I'm searching (for each line) for certain characters and if that character exists then extract the probability. The thing is that sometimes this …

Member Avatar for Gribouillis
0
148
Member Avatar for effBlam

I'm confused on how i can change or "toggle" the text of a button from say "D" to "A" when clicked, and then back to "D" if clicked again. So far I have this: [ICODE]from Tkinter import * from tkFileDialog import * class Game(Frame): def __init__(self,root): Frame.__init__(self,root) self.grid() self.buttons() def …

Member Avatar for effBlam
0
179
Member Avatar for Zeref

Hi guys I'm trying to place a user input into a database(mysql) [CODE]newplayer=raw_input('Please enter a new player name: ")[/CODE] the sql commands to insert data is [CODE]sql="""INSERT INTO PLAYERS(NAME) VALUES('newplayer')"""[/CODE] When i check the database it shows newplayer instead of what the user has entered. any ideas of how i …

Member Avatar for TrustyTony
0
93
Member Avatar for debasishgang7

Hi All, I want to create a pattern like this using python.. [CODE]Aa0Aa1Aa2Aa3Aa4Aa5......Ab0Ab1Ab2.........and so on.[/CODE] Thanks...

Member Avatar for debasishgang7
0
259
Member Avatar for usdblades

[code=python]import random secret = random.randint(1,99) guess = 0 tries = 0 print "AHOUY! I'm the Dread Pirate Roberts, and I have a secret!" print "It is a number from 1 to 99. I'll give you 6 tries. " while guess != secret and tries < 6: guess = input("What's yer …

Member Avatar for Gribouillis
0
259
Member Avatar for python12345

I'm trying to write code to count the number of times a whole number can be divided by 2 before reaching 1. When I run my code it prompts me to enter a number as you'll see in my code below, but once I do so, nothing happens, just a …

Member Avatar for Rick345
0
12K
Member Avatar for MRoman

I recently received an assignment in class and I need help really bad. The idea behind this assignment is to create a Network Backup Routine that that has a selection menu (New Backup Item, Remove Backup Item, Exit), I have been trying to create this program but with a sub …

Member Avatar for MRoman
0
185
Member Avatar for new_pythonuser

I use the following code to read a CSV file with 6 columns. The headers are assigned correctly (i.e. print headers works) but when I try to read the rest of the rows as variables under those headers. The first column is 'time' and it is read correctly. But when …

0
80
Member Avatar for just_starting

I am trying to write a program that 1. Lets the user write new students and there overall grade to the file, 2. Opens the file to view course info(student and their grade) 3. Shows course stats(mean and range for the class). Here is what I have so far, can …

Member Avatar for just_starting
0
185
Member Avatar for samymcdonnell

These are the original instructions: "Design and write a python program that emulates a Magic Eight Ball. Your program should continually prompt the user to enter a question and then display the answer as long as the user wishes to continue. Store eight Magic Eight Ball answers in an array. …

Member Avatar for woooee
0
507
Member Avatar for sofia85

Hi, I'm trying to create a new file. In this file I want to add some results I have received from my code. Unfortunately I get a error message saying I can't combine str with list. So then I tried to make a string out of the list and ended …

Member Avatar for sofia85
0
96

The End.