64,152 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for macca1111

Hi, I have the following code: import string def main(): rank=[] suit=[] fname=string.split(open('H:\card.txt').read()) for line in fname: rank.append(line) print rank The file (card.txt) is: 2 h 3 h ... How's the easiest was to get the 2 into rank and the h equal hearts Ultimately i need it to print: …

Member Avatar for Ene Uran
0
127
Member Avatar for theking11

So a kid in my class wanted more of a challenge...the professor gave us one...and I have no idea on this problem. Here's the instructions: Darts scorer. Write a program that draws a darts target and allows the user to click on the target to represent darts hitting the target. …

Member Avatar for Ene Uran
0
3K
Member Avatar for mruane

I recently downloaded Py2exe to make my python2.4 programs executable in motive of possible distribution. I looked online, and most of them tell me I need to use my ms-dos prompt, or command prompt. If these are two different things on my Windows 98 O.S., i cannot find command prompt. …

Member Avatar for Ene Uran
0
100
Member Avatar for macca1111

Hi, If the following def shows if a deck is empty, how do I change it to show the number of cards left??? def isEmpty(self): return (len(self.cards) == 0) I was thinking just taking the ==0 should work, by returning number of cards. macca1111

Member Avatar for Ene Uran
0
115
Member Avatar for disc

Hello, Can anyone tell me what the code beneath means. I've searched but can't find a clear explanation. Maybe someone can give an example of how to use it. Thanks... [code] [COLOR=#0000ff]bool[/COLOR][COLOR=#000000] MyClass::[/COLOR][COLOR=#0000ff]operator[/COLOR][COLOR=#000000]()()[/COLOR] [COLOR=#000000]{ [/COLOR] [COLOR=#000000] ....[/COLOR] [COLOR=#000000]}[/COLOR] [COLOR=#000000]class MyClass[/COLOR] [COLOR=#000000]{[/COLOR] [COLOR=#0000ff]virtual[/COLOR] [COLOR=#0000ff]bool[/COLOR] [COLOR=#0000ff]operator[/COLOR]()(); } [/code]

Member Avatar for disc
0
166
Member Avatar for sneekula

With the ease of argument passing to and from functions in Python, why would anyone want to use global variables. Isn't that an open invitation for mistakes to happen? Yet, I see code in threads here that abound with globals. I am a little confused here.

Member Avatar for jrcagle
0
143
Member Avatar for tehloki

I am taking a programming course, and since we have not been introduced to string functions (puts(), gets(), etc) I need to take some input from the user using scanf. The assignment is to read a DNA sequence, storing it in a char array. The array must be 512 characters, …

Member Avatar for tehloki
0
251
Member Avatar for macca1111

Hi, I was running Python 2.3 an although I had a few problems it generally worked. I today tried to upgrade to 2.5 and it installs (apparantely) ok, yet when I click on the IDLE icon nothing happens. No error message, nothing. I can however click on the Python (Command …

Member Avatar for macca1111
0
83
Member Avatar for HLA91

Hi Ive got this word count script when i check it there is no probs but when i run it it says Traceback (most recent call last): File "H:\Scripts\count.py", line 9, in <module> infile = file(data, 'r') NameError: name 'data' is not defined This is my script #The number of …

Member Avatar for bumsfeld
0
182
Member Avatar for cancer10

Hello Friends, I am willing to learn python, so can someone please guide me how do I get started? I mean wot compiler would I need and which editor etc Also tell me wot is the scope of python in web programming? Thanx

Member Avatar for HLA91
0
219
Member Avatar for HLA91

Hi The info "joeprogrammer's" gave me to place the python directory at the end of my path but im confused. My path at the moment looks like this %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL Python on my pc is in my H:\ drive under a folder called python. …

Member Avatar for vegaseat
0
199
Member Avatar for HLA91

Hi i Made a shell script like this [code] name = raw_input ("Please enter your name: ") if name == Harry: print "Welcome" else: print "you smell" [/code] What i want it to do is ask for my name and if i dont enter Harry it says "YOU Smell" But …

Member Avatar for vegaseat
0
164
Member Avatar for sneekula
Member Avatar for vegaseat
0
275
Member Avatar for SammyHasibi

I have written a program with 2 functions which compute factorials & combinations. The functions work perfectly when called but I cannot insert a for loop at the end which sums up the combos. This part works (I have omitted the functions because they work when called for). [code]long factorial(int …

Member Avatar for SammyHasibi
0
97
Member Avatar for mruane

Hey all. I was hoping somebody on here, preferably vegaseat or any other long time and reputable poster and/or moderater would have any Ideas for a program that I should write. Basically, I fear I am trying to push myself to hard and to fast with python. I really want …

Member Avatar for Ene Uran
0
116
Member Avatar for sneekula

I have played with Python code just a little and like it so far. I am using a Windows XP machine and have downloaded Python 2.5. As recommended in the "Starting Python" thread, I am saving my test files in the directory C:\Python25\Atest\. When I bring up the IDLE editor, …

Member Avatar for sneekula
0
111
Member Avatar for HLA91

Hi Im interested in downloading pythhon and i was looking through the first steps to making a python script. This was in the tutorial " [B]Setting the path[/B] You will need to cause the directory containing the file named [B]python.exe[/B] to be listed in your system environment variable named [B]path[/B]. …

Member Avatar for ~s.o.s~
0
101
Member Avatar for sneekula

I thought function xrange would give me a list of integers, but I got a string instead: [code]x = "xrange(1, 5)" print x # xrange(1, 5) x = xrange(1, 5) print x # xrange(1, 5) same result as string above!? [/code]

Member Avatar for sneekula
0
95
Member Avatar for royaloba

2005/11/09 18:32:11, Event:Access, Door:entry, Card No.:2727, Description:266:55748 Date time event door card no. description +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2005/11/09 18:32:11, Event:Access, Door:entry, Card No.:2727, Description:266:55748 2005/11/09 18:32:13, Event:Access, Door:entry, Card No.:2345, Description:266:55732 2006/01/11 14:07:02, Event:Cover Removed Return to Normal, Door:5 2006/01/11 14:07:02, Event:Cover Removed Alarm, Door:5 2005/11/09 18:33:58, Event:Card No. Error, Door:entry, Description:266:51792 …

Member Avatar for Yomet
0
141
Member Avatar for Tim Cook

Hi - I need some advice on how to force web controls to update. I have built a custom header and footer as two separate web controls, and have added them to the Toolbox. I can then drag and drop them onto any aspx web page. All has been going …

Member Avatar for mooresharon72
0
90
Member Avatar for shaun09

I'm trying to cycle through a series of dynamic fields and update the value to the database. But the value of the last field is the one retrived and updated to all fields in the loop. How do i solve this problem. Thank you so so much for your help. …

Member Avatar for shaun09
0
116
Member Avatar for matrimforever

How do I call a function outside of main or use a parameter to pass a reference? If my function is: [code] void getData(int& diameter, int& price) { cout << "Enter in the diameter of the pizza in: " << endl; cin >> diameter; cout << "Enter in the the …

Member Avatar for matrimforever
0
129
Member Avatar for shaun09

I'm trying to create a list to record student grades into the database. I'm able to pull out the names from the database and create a table with textfields in it to input the data into. This is the code i'm using for(int i = 0; rst2.next(); i++){ ....... <th …

Member Avatar for shaun09
0
124
Member Avatar for learnerd

Hi, I am trying to use the "My" functions in Visual basic, but every time i run the code, it give me a Runtime error 424 - object required. I am a newbie at this, please help. I don't have anything else in the code, just New Project, Stantard EXE …

Member Avatar for learnerd
0
106
Member Avatar for venomlash

I use Bloodshed Dev-C++ version 4.9.9.2 and it is a little weird in that it accepts "and" as "&&" and "or" as "||", not to mention not requiring parentheses around separate clauses in and/or connected statements. Therefore it would read the following as the same. if(voice==loud or voice==annoying and voice==whiny){ …

Member Avatar for vegaseat
0
202
Member Avatar for Line

Helloes! I'm using getrusage to get the usertime and systemtime, but sometimes the times returned are negative --> SELF: user time: 1313366639 microseconds system time: -1547562616 microseconds I'm not sure I've understood getrusage correctly, so I'm posting my code in hope of getting a few tips on how to avoid …

Member Avatar for Line
0
202
Member Avatar for rowly

can any one help with this function how it works ! thanks u [code] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] compare([/COLOR][COLOR=#0000ff]const[/COLOR][COLOR=#000000] [/COLOR][COLOR=#0000ff]void[/COLOR][COLOR=#000000] *a,[/COLOR][COLOR=#0000ff]const[/COLOR][COLOR=#000000] [/COLOR][COLOR=#0000ff]void[/COLOR][COLOR=#000000] *b)[/COLOR] { data i= *(data *)a;[COLOR=#008000] [/COLOR]data j= *(data *)b; [COLOR=#0000ff]if[/COLOR] (i.Mark==j.Mark) [COLOR=#0000ff]return[/COLOR] 0; [COLOR=#0000ff]if[/COLOR] (i.Mark<j.Mark) [COLOR=#0000ff]return[/COLOR] -1; [COLOR=#0000ff]if[/COLOR] (i.Mark>j.Mark) [COLOR=#0000ff]return[/COLOR] +1; } [/code]

Member Avatar for rowly
0
128
Member Avatar for mruane

hi, first off I want to say that I was helped immensely by the other posts, especially the one where the one person was talking about classes. From veiwing his coding i was able to get my text adventure started. My basic questions are: 1) how do I learn the …

Member Avatar for bumsfeld
0
114
Member Avatar for kissiwat

What am I trying to establish here... jolly good question :eek: Pretty simple piece of code really but can I get this wretched thing to do as its asked - can I as heck... All it needs to do is display the type of clothing to be worn in certain …

Member Avatar for Infarction
0
111
Member Avatar for akadri

Folks, I want to know how to check whether a file exists for not?? One more thing: If we open an existing file in a write mode, then it gets truncated to zero length, so what the way out of this?? Should I use open('filename','w+') Regards, Asrar

Member Avatar for katharnakh
0
94
Member Avatar for rowly

hello, i have a problem with printing records[i].M_F on the screen while reading from a binary file. i'll appreciate any help ! THank U [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]"stdafx.h" [/COLOR][COLOR=#0000ff]#include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]<stdio.h> [/COLOR][COLOR=#0000ff]#include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]<stdlib.h> [/COLOR][COLOR=#0000ff]enum[/COLOR][COLOR=#000000] sex {m, f}; [/COLOR] [COLOR=#0000ff]struct[/COLOR][COLOR=#000000] student { [/COLOR] [COLOR=#0000ff]char[/COLOR] fname[40]; sex M_F; [COLOR=#0000ff]int[/COLOR] S_AGE; [COLOR=#0000ff]double[/COLOR] W; }; student …

Member Avatar for Ancient Dragon
0
109
Member Avatar for Line

Hey! I'm writing a program and currently having trouble with getting a written line typed in by the user to be copied correctly into another array... I'm using a for-loop to run through the original char-array, but if I type in "Hello" the program will give me this result: Param …

Member Avatar for Line
0
100
Member Avatar for kissiwat

Apparently this was originally posted in the wrong area :rolleyes: :rolleyes: Anyway.... bit of a cheek I know but if you're feeling ultra generous with your knowledge but can anyone write some code in C using if statements for the following: "A car costs a certain amount. If it is …

Member Avatar for Ancient Dragon
0
105
Member Avatar for Eadams20

Here is my problem I am trying to write a program that will estimate the number of boxes of tile needed for a job. A job is estimated by taking the dimensions of each room in feet and inches and converting these into a multiple of the tile size (rounding …

Member Avatar for Eadams20
0
278
Member Avatar for Mouche

I wasn't able to find anything on this... well, I wasn't sure what to search for. But I'm curious what the advantage of this: age = 3 print "Hello, I am %d years old." % age ...is over this: age = 3 print "Hello, I am", age, "years old."

Member Avatar for Mouche
0
150
Member Avatar for rinoa04

Hello... I have one curiosity that I need to solve. I hope anyone who know the problem tell me reason why is this so. I have done a php/mysql application some time ago and I encounter this problem while testing on using coding with register_global on and register_global off. I …

Member Avatar for rinoa04
0
165
Member Avatar for Matt Tacular

I want to make a program that can do two things really: 1) Detect the beat of a song 2) Output through a port, preferably the paralell port. 1) I was thinking the easiest way to do this, would be to use windows media players bars visualization, but then i …

Member Avatar for vegaseat
0
128
Member Avatar for Mouche

I'm working on a text adventure game just for fun. I am not planning to complete it, but I decided to try it just to learn classes. Seeing the text game in another post using functions, I realize that that is a very nice way to make a simple game, …

Member Avatar for jrcagle
1
3K
Member Avatar for rowly

Hello, how can i check that pushing characters into stack is successful (logically)?

Member Avatar for rowly
0
97
Member Avatar for kararu

HI all, In my c++ program, I did the following. [code]...... class thr {private: char *d; ...... public: d =new char[35]; .... } destructor has the line delete [ ]d; i get segmentation error *** glibc detected *** /usr/bin/perl: free(): invalid next size (normal): 0x0000 000001bc7120 *** [/code] But if …

Member Avatar for kararu
0
251
Member Avatar for crackers8838

Hi, I am new at programming and I have never done Java before. I am in my first Java class and we are asked to complete the following question...[B]Complete the method printLargestAnimal below. [/B]Consider the three Strings "dog", "cat", and "monkey". In lexicographical order, "monkey" is the largest of the …

Member Avatar for crackers8838
0
87
Member Avatar for Taps

hello all..I have created ANT Script and need to work along with CVSMy ANT Script shall1. As of CVS extract .ear from this is the common version 2. Extract from CVS and overwrite in target directory the specific components listed in the specific [INSTANCE].Can any one tell me how shall …

0
248
Member Avatar for chris99

How would I manipulate an entry widget so that it hides the entered characters behind asterisks? like this: Typed: PassWord Displayed as typing occurs: ******** I'm trying to make a dialog box module, for use in some future programs. I want the user to be the only one to know …

Member Avatar for Ene Uran
0
133
Member Avatar for Matt Tacular

I know this is VERY off topic, but I am sure that a bunch of people here are experienced with computer building. I am building a computer off of tigerdirect canada and I was just wondering if I could get someone to check and see if all of these parts …

Member Avatar for Ene Uran
0
137
Member Avatar for jan1024188

what sql is?what can we make with SQL?do i have to know PHP BEFORE LEARNING SQL ??????

Member Avatar for jan1024188
0
86
Member Avatar for chris99

The attached program uses buttons to take you to a set of links. The links that the three buttons point to are here, gamefaqs and toontown. You can customise by altering the links and button names within the code, this is just practice. What do you think?

Member Avatar for chris99
0
133
Member Avatar for briggs1987

I need help. I have my program set up except for a graphWin and I don;t know how to set that up

Member Avatar for Ene Uran
0
90
Member Avatar for shadowmoon

[quote] // play a wave file sound using the winmm library // For DevCpp add the library libwinmm.a to linker via // Project/Project Options/Parameters/Add Library // remember this is a console program! #include <iostream> #include <windows.h> // for PlaySound() #define SND_FILENAME 0x20000 #define SND_LOOP 8 #define SND_ASYNC 1 using namespace …

Member Avatar for andor
0
485
Member Avatar for danae

Hi, I've got a problem with searching for record(s) that match the staffID in my "Staff" table in the database. I have a string named mstrSql, a txtStaffID text box and a sql statement that goes [code]mstrSql = "Select * from Staff where staffID like '" & txtStaffID.Text.Trim() & "%" …

Member Avatar for Paladine
0
1K
Member Avatar for sugarboy rider

i have to comunicate from vb to control a nec vt480 and I have not much idea how to send the instructions correctly . Acording to the information given by nec, this are the codes to control projector: 001. POWER ON 02H 00H 00H 00H 00H 02H 002. POWER OFF …

Member Avatar for sugarboy rider
0
435

The End.