- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 16
- Posts with Upvotes
- 9
- Upvoting Members
- 14
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
60 Posted Topics
Re: Here's one of my favorite sayings. [B]"Can it be done? Yes. Will it be done? No."[/B] I don't think it's necessary. | |
Okay, I'm trying to make a python game (not with pygame), I want it to use the arrow keys. But the thing is, I don't know how to get it to respond to the arrow keys. So here's what I want to do. If the user presses the up arrow … | |
!USING PYTHON 3.1! Hello DaniWeb! Today I'm going to teach you a cool variable trick that I learned. So here's an example: [CODE] a, b, c = input('?x?x?: ').split('x') [/CODE] Now let's input something like: [CODE] >>> a, b, c = input('?x?x?: ').split('x') ?x?x?: 1x2x3 [/CODE] Now, variable 'a' is … ![]() | |
Re: Well, it sounds like it simply encrypts your code. When you run the program it decrypts the encrypted file and checks to see if it matches the code. Sounds relatively simple. You could use some simple encryption keys. | |
[B]!USING PYTHON 3.1![/B] Hello DaniWeb! Today I'm going to be posting a [B]simple[/B] threading tutorial. First of all, what is threading? Well, threading is just another way of doing a side task without interrupting the main program. Now here's a simple example. Let's say we are going to make a … | |
I've been at a loss as how to convert the std::string to char (Line 40). I've tried c_str() and a few other things, but it's really confusing when the pointers are thrown in there. I know I'm kind of asking you guys to do it but I don't know what … | |
Hey! I've recently come back to C++ to tackle another project, but I've run into a problem I can't figure out. #include <iostream> #include <string> #include <fstream> #include <direct.h> using namespace std; int main() { string variable = "AwesomeName"; mkdir ("test"); ofstream write ("test\\" (variable+".txt").c_str() ); // this the place … | |
Re: This may be a little hard to understand. But instead of: [CODE] try: n = int(how_many) return n except: print "You can't trick me, that is not integer!" [/CODE] here's what you should do: [CODE] try: n = int(how_many) except ValueError: print "You can't trick me, that is not integer!" … | |
[B]!USING PYTHON 3.1![/B] [B]USING WINDOWS[/B] I never thought it could be so simple. However I should have clarified that it's a [B]1 character[/B] input. But the general idea is the same. Someone suggested that I explain what is going on better, so I'm going to do that. The function 'getch()' … | |
Is their ANY way to do something like: [code] for (int x=1; x<3; x++) {string MyArray[1][x]={"-"};} [/code] Assuming the array has already been defined? I really don't want to have to do: [code] MyArray[1]={blah} MyArray[2]={blah} MyArray[3]={blah} etcetera etcetera [/code] I'm not necessarily looking for efficiency but seriously, initializing 50 arrays … | |
Re: It's already been solved, but for the above equation: [code] money *= (400/32)^9[/code] would be much more suitable. C++ only excepts quadnobial equations with bitwise operation *=. | |
I'm creating a program and I need the class 'Child' in the following code to inherit the value of 'age' from the class 'Mother'. [CODE] #include <iostream> using namespace std; class Mother { public: int TellAge(void); protected: int age; } MObj; class Child:protected Mother { public: void ChildTellAge(void); } CObj; … | |
Re: That same site has a tutorial: [URL="http://www.cplusplus.com/files/tutorial.pdf"]Clicky Here![/URL] It is the main source of my knowledge and it's very informative. (to get started, look up "introduction to strings" to begin.) However though, some of the really new people may find the terminology difficult to understand at first, but once you … | |
Re: I don't know much on the problem, but I found a few links that might help you: [url]http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/426d85b4-db84-4c01-a9d4-d3fd025339c0[/url] [url]http://www.daniweb.com/forums/thread290836.html[/url] (a daniweb page which has been solved) [url]http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/426d85b4-db84-4c01-a9d4-d3fd025339c0[/url] Even if they don't straight up solve your problems, at least they might be able to help you a little bit. | |
Hey, I'm new to C++ (1 week, used to do Python), and it's very enjoyable, but I have an issue. In the following code: [CODE] int sizeofarray; cout << "Type size of array: "; cin >> sizeofarray; int myarray[sizeofarray]; ...........more code [/CODE] That isn't the code, but that is the … | |
Hey, it's me again. I have a Ceaser Cypher here: [CODE]letters=list("abcdefghijklmnopqrstuvwxyz") def Encrypt(): for i in range(int((len(word)-1))): curletter="".join(letters).find(word[i]) if (curletter+key)>(25): if (curletter+key)<0: i=(curletter+key) i=[(curletter+key)-(curletter+key)] else: i=(curletter+key)-(25) print (curletter+key) word[i]=letters[curletter+key] return def Decrypt(): return word=list(input("Type in some letters:")) key=int(input("Type in a key:")) choice=int(input("1) Encrypt\n2) Decrypt\n:")) if choice==1: Encrypt() else: Decrypt() print("".join(word))[/CODE] … | |
Re: Your question is irrelevant to the title. Are you saying that you don't know how to use it, or you know how to use it, but you want to make it faster. | |
Re: If you didn't edit the code, the only thing I could think of is that one of the files being used or imported got changed. But if none of the files necessary to run the program were edited I see no reason that it shouldn't work. | |
Re: Type: [CODE] import os os.system("set") [/CODE] To view the system variables. To use one of them you just: [CODE] import os os.system("%variable%") [/CODE] This works with windows, but nothing else. | |
Re: That was exactly my thought. It could be a virus extension to further spread itself to other directories. | |
I have a limit of 30-45 dollars to buy an editor (with Python support, obviously) . Here's what I would like. Customizable syntax highlighting (like the kind in Notepad++). Auto indent, so it autmatically indents 4 spaces after a ':' character. Good code completetion. A built in IDE. Preferably like … | |
Re: I wrote a tutorial about threading. A simple one :). Check out the tutorial section. [QUOTE=johnroach1985] I would have rather gotten a quick answer than to read documentation... [/QUOTE] The classic Lazy. :icon_rolleyes: Though I will admit, reading documentation isn't a very good tutorial source and it is quite boring. | |
Re: NetBeans for Python has nice code completion. It will close off "", {}, '', and () symbols for you. After typing 'def SomeFunction' it automatically adds '():' for you and when doing the same thing with a class like, 'class SomeClass', it automatically adds '(self):' for you. It also has … | |
Re: Pictures imported to pygame need to be in .png format. If the pictures don't show up in .png format then something is wrong with the code you're using to show the pictures. | |
Well, I've written a simple program that gives you info about your computer. The program runs perfectly fine, but the console window pops up and really does nothing. So I would like to hide the console window and only show the gui frame. Pointers on how to do this? | |
Re: You didn't have to make it so complicated with the dictionary. A bunch of if statements. Would've done fine. | |
Re: They're all trying to just confuse you. [CODE] print "H e l l o W o r l d" [/CODE] | |
Re: Instead of manually writing out all the letters and digits do this: [CODE] import string a = list(string.ascii_letters + string.digits + "!@#$%^&*()-+={}|\/?><,.'") [/CODE] | |
Okay, the encryption algorithm idea was stupid. But I still made an encryption program. I got the absolute most possible frustrating situation. The program doesn't work in the console window. It spits out a giant error (probably recursion judging how many errors it got), but it DOES work in IDLE. … | |
Re: Hm... So you want to find out the position of the mouse when it double clicks? | |
Re: It seems like so many people come on to the forums requesting for home works assignments they have no idea on how to do. Does your teacher realize that you don't have the proper skills to do this? Or maybe you do know you just don't want to work. This … ![]() | |
I can't find a compiler to compile version 3 Python scripts to .exe. All the compilers I see are all for Python 2. | |
Re: [QUOTE=Wikipedia] The source code is made available under the Biopython License, which is [B]extremely liberal[/B] and compatible with almost every license in the world. [/QUOTE] Crash... I'm not using they're software. Why would they mention that? | |
Okay, I wrote a simple calculator, not in GUI form, but a calculator for simple stuff. So I'm wondering, would this layout be considered OO? I think this is how it works. Now I do know that I didn't use an object to handle the class since it just wasn't … | |
Re: Well, what's happening, what's going wrong with the program? Could you post the error message. | |
Re: [CODE] self [/CODE] Automatically becomes the object of the class. Like: [CODE] class SomeClassName: def SomeMethod(self): *some code* obj1 = SomeClassName obj2 = SomeClassName [/CODE] So self is replaced with the obj name. master, is simply the main frame window. If you notice this line: [CODE] root = Tk() [/CODE] … | |
| |
Re: Well static typing is like this: [CODE] int num = 2 str var1 = "a" [/CODE] Python is dynamically typed meaning you don't have to type int, str, or that kind of thing before a variable. Or are you thinking of something else. | |
I can't find a simple command that does this. If there's no command that does this I'm going to spam python.org until they finally agree to put this in the next version of python. | |
Re: [QUOTE] How would i do this? [CODE] import random name = random random.name [/CODE] I can't use 'name = random.random', as name is something that could change. [/QUOTE] No, you can't do something like that. But you can do: [CODE] from random import * name = random() print (name) [/CODE] … | |
As the title suggests, there are some major flaws in my new program, though it still functions nonetheless. Here's the code: [CODE] POS = 1 try: import Tkinter as tk except ImportError: import tkinter as tk import os def clear(): if os.name == "nt": os.system("cls") else: print ("\n"*40) def key(event): … ![]() | |
Re: Range will start at zero if you don't tell it the start number. Try this: [CODE] for i in range(1, numQuiz): [/CODE] That should work, don't forget to check the mark thread as solved once your question has been answered. | |
I'm having a problem sizing down this block of code: [CODE] if POS == 1: POS1 = "->" else: POS1 = " " if POS == 2: POS2 = "->" else: POS2 = " " if POS == 3: POS3 = "->" else: POS3 = " " if POS == … | |
Re: This is obviously off topic, but may I ask why you are using Junior M.D.'s picture and signature. They're not bad, but copying someone's signature is prohibited on some sites. | |
Re: Be forewarned. If there's no pre-existing animation, it's going to take tons of coding. It's inefficient, but possible. But no, I don't have any examples. | |
![]() | Re: I would assign the integers to a list inside of variable "n". Now, I didn't exactly understand your entire post but here's what I got: [CODE] n = [] first = input("Enter a starting integer: ") last = input("Enter an ending integer: ") last = last + 1 for integer … |
Re: Woah, what version are you using. There's no indents. | |
Okay, I was thinking about making an encryption algorithm, now the thing with most algorithms is that they follow specific steps. Well, I was thinking, what if you made an algorithm that generated random characters (the kind you see on your keyboard, excluding characters that could crash the program), and … | |
I have a weird glitch or something, whenever I try to start turtle graphics from the shell it goes unresponsive, but when I run the program in a console window it works. This is really annoying me! Any help would be appreciated. |
The End.