15,181 Topics

Member Avatar for
Member Avatar for scrace89

[CODE]# This file contains python code that will determine whether a potivie range # of integers entered by the user will contain odd or even numbers, prime or # composite numbers, perfect/abundant/deficient numbers, square numbers, and # triangular numbers. def main(): import math firstNum = 0 secondNum = 0 n …

Member Avatar for Gribouillis
0
578
Member Avatar for thoutmosis

Hi guys, I got a file having this kind of records: 000000000111GOOGLE 5428[B]MG[/B]45525[B]RC[/B] 000000000122MICROSOFT 8565[B]MG[/B]85454[B]RE[/B] 000000000044APPLE 5814[B]KL[/B]484545[B]RC[/B] I want to keep only the records that have 'MG' in position 34 and NOT ('RE' or 'RD') in position 41 What should I add to this code? #!/usr/bin/python infile = 'DATA' input …

Member Avatar for thoutmosis
0
70
Member Avatar for amadain

Hi I was hoping I could get a bit of help here. I am trying to break a number of strings up into arrays on particular words. For example in the following strings I want them broken on the words GET and/or POST: [CODE] "POST at the start without the …

Member Avatar for jice
0
272
Member Avatar for vegaseat

Tired of the Tk icon in the corner of the form. It's easy to replace with any fancy icon you have. Here is the code ...

Member Avatar for The-IT
0
1K
Member Avatar for lewashby

In the code below, the only part I'M having trouble with is word[position]. I know this is something really simple but I've always had trouble understanding these kinds of statements. I know that it print a random letter (position) from (word). What I don't know is why or how it …

Member Avatar for jice
0
119
Member Avatar for pelupelu

I am trying to compute some lexical statistics from a given text. For instance, how many lines, sentences, words, how many times a given character is repeated. Can anyone help me with this?

Member Avatar for vegaseat
0
250
Member Avatar for darkbow

Hi i'm having trouble adding a if statement to my code i have these two files in the same folder mud.world effect and simmind, in effect i have this class EffectIllusion, and i use the portion illusionRace, i ive been trying to add a condition that when illusionRace is active …

Member Avatar for woooee
-2
122
Member Avatar for persianprez

I'm to have the user input what classes they have taken and tell them what they have left to do. I have my for loop done but I feel like I need an array or something because they should have entered requirement for 6 different class types. Here is my …

Member Avatar for d5e5
-1
133
Member Avatar for lukerobi

lets say i have 2 lists: lista = [1,2,3,5,6,7] listb = [4,5,6,7,8,9,10] The lists can be different lengths, and may not allways be unequal lengths. The higher average will allways be in listb, so that is the 1 constant we can rely on. This works for even teams: [code] average …

Member Avatar for vegaseat
0
98
Member Avatar for Frenzic

Hi, I'm stumped at this problem set and was wondering if anyone could guide me in the right direction or give me some hints on where to begin. I'm not looking for a full answer. Q: Write a program that computes and prints the 1000th prime number. Any help is …

Member Avatar for pysup
-1
97
Member Avatar for vipints

Hi all, I am using scipy.io for switching from python to matlab. here is my list of list in python code = [[[1, 2], [3,4], [5, 6]], [[7, 8], [9, 10]]]. I want to convert this to matlab format. For that I used a code scipy.io.savemat('/tmp/out.mat', mdict={'Num': (code[0], code[1])}) but …

Member Avatar for vipints
0
351
Member Avatar for lehe

Hi, I was wondering how to debug python script without adding pdb module to the script file. Say, I have a script test.py without adding "import pdb" and "pdb.set_trace()". Can I debug it in Python running in terminal by importing pdb there? How to set up breakpoints and start the …

Member Avatar for Outdoor83
0
140
Member Avatar for jaymeaux77

Hi, I am fairly new at the whole programming racket and I am having trouble with an assignment for my computer science class. I know homework help is discouraged, I read that sticky, but I'm curious if I am missing a fairly simple mistake. The assignment is to make a …

Member Avatar for jaymeaux77
0
220
Member Avatar for awn

Hi - I'm fairly new to python. I 've been trying to write some python code to read data from a serial port and convert it to be able to display as incrementing or decrementing numbers with a voltmeter image in the background. Any ideas on how i can flush …

Member Avatar for ov3rcl0ck
0
73
Member Avatar for CurtisEClark

[CODE]#Program to count number of specific vowels msg = input("Enter a message:") msg_lower = msg.lower() VOWELS = list(aeiou) msg_list = list(msg_lower) x = () for letter in VOWELS: x[letter] = msg_list.count(letter) for letter in x: print(a, x(letter)) print(e, x(letter)) print(i, x(letter)) print(o, x(letter)) print(u, x(letter)) [/CODE] I get an error …

Member Avatar for masterofpuppets
0
83
Member Avatar for gmilby

i setup a cronjob to execute a script (following instructions here [url]http://moinmo.in/WikiBackup[/url]) basically their script just opens a browser to a page with a backup button. after digging, i found i could add &do=backup and it would click the backup button for me, but now it just stops at the …

0
55
Member Avatar for elliottb

Hi, I'm trying to use swig to generate python wrappers to a custom binary package that my research group uses. I'm new to swig, but I must say I'm very impressed. The only hang-up I have left is that I have trouble directly accessing the global array data. I've currently …

Member Avatar for Gribouillis
-1
130
Member Avatar for DEATHMASTER

I'm just wondering how I would fix this [code]app = first[0:8] and second[0:8][/code] That doesn't work but if I remove "and..." it does but I need both.

Member Avatar for vegaseat
-1
217
Member Avatar for SuperMetroid

I'm compiling an extremely large list of usernames, and I want to know which is a faster method of checking what is already in the list. If anyone can give some insight as to how Python deals with each that would be much appreciated!

Member Avatar for vegaseat
-1
4K
Member Avatar for saikeraku

Hi, the program is this: Discount problem: Available deals: 10% off the total price when you buy $200 or more 15% off the total price when you buy $500 or more 20% off the total price when you buy $1000 or more Write a program that outputs the value, price …

Member Avatar for masterofpuppets
-1
151
Member Avatar for flebber

Hi I am continuing on with one of my first projects in python. This module for my larger project will be to download files(legal freely published by sporting assosciations). I am not sure if my concepts are right in how best to execute this, I have read the urllib docs …

Member Avatar for vegaseat
-1
159
Member Avatar for lewashby

In the code below, the only part I'M having trouble with is word[position]. I know this is something really simple but I've always had trouble understanding these kinds of statements. I know that it prints a random letter (position) from (word). What I don't know is why or how it …

Member Avatar for vegaseat
-1
117
Member Avatar for lewashby

In the program be below, I'M having trouble with these few lines, remember, I'M new. What's going on here? I'M just a little confused because there is (word) wraped in len(). [CODE]position = random.randrange(len(word))[/CODE] And what's going on with these two lines? Thanks. [CODE] jumble += word[position] word = word[:position] …

Member Avatar for snippsat
-1
164
Member Avatar for Dan08

Hey everyone, im doing a application, with some graphics in it and stuff nice in there, and to be honest is almost done. But when i run my program, a black window appears, just behind my program, its like a command prompt and what i would like to do is …

Member Avatar for vegaseat
-1
73
Member Avatar for minimagician

Hello All, Don't know if this is the right place to put this doubt. Help if possible. I have a python file that extracts data from a file and adds the required part to the database. Now MySQL has certain reserved characters, whenever my update query comes across a reserved …

-1
116
Member Avatar for GradStudent

Folks, I was trying to learn Python, I finished the basics,- Conditional Statements , loops, Functions, Classes. I want to try some GUI designing. I have downloaded Django. I use Python 2..6.2.. Where should i head next..

Member Avatar for lllllIllIlllI
-1
79
Member Avatar for mhangman

Hi im trying to write a game. Its very early stage but i hit to an error so need your help. Here the code: [CODE]def gexp(): connection = sqlite.connect('test.db') memoryConnection = sqlite.connect(':memory:') cursor = connection.cursor() cursor.execute('SELECT * FROM gain') expget = cursor.fetchone() exp = expget[1] texp = expget[1] + mexp …

Member Avatar for mhangman
-1
98
Member Avatar for aegis042404

Hi, I'm writing a little learning game for young kids, mostly to help my own girl learn a few things. I've chosen colours first, but hope to adapt it for more complex ideas later. I'll be releasing it GPL3, if I ever get it done, so feel free to reuse …

Member Avatar for lllllIllIlllI
-1
230
Member Avatar for neverlander

I am trying to display a gif file on pyqt.It shows but doesnt animate.It is static.How can make it animate? This is the code i used: [CODE]pic=QtGui.QPixmap("./IRREGULAR/"+ui.lineEdit.text()+".gif") ui.label_9.setPixmap(pic)[/CODE]

Member Avatar for vegaseat
-1
5K
Member Avatar for MichelleCrews

hey, ima first time programmer and i no clue whats going on someone please help!! i have to write a function called number_of_2s that includes one parameter, N, where N is a positive integer that is no more than 10 digits long. the function should return the number of times …

Member Avatar for MichelleCrews
-1
103

The End.