hisoka
Members-
Posts
569 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by hisoka
-
Thanks for both of you it works I tried another thing : this works too int main(){string m = "green";string n = "land";cout<< m + " " + n <<endl;system("pause"); } Now I tried it like that : int main(){cout<< "green" + " " + "land" <<endl;system("pause"); } but it gives an error . 8 C:da.cpp invalid operands of types `const char[6]' and `const char[2]' to binary `operator+' I could not understand the error : Any explanation ? and how to correct the little piece code ?
-
So I am unfortunate should I look for a C++ forum or continue to ask C++ questions here ? what do you say ?
-
cout in c++ can be used like this : int main(){cout << "green" << "land" << endl;system("pause"); } or like this int main(){cout << "green" ; cout << "land"<<endl ;system("pause"); } output : greenland However I want the output to be green land but I cannot figure out How . I want a space between the two word using cout So how? any idea ?
-
I , strongly , suggest and recommand that you do create a whole section for C++ programming language -as it is one of the most important and powerful programming language in the world- like you did for python , php and javascript . I will begin to post my first message concerning C++ in the section named general as there is no special section for C++ and I hope I get help thanks
-
I have a problem words = [ "ca" , "caa"] for x in words: if len(x) >1: words.insert(0,x) ...words it gives : Syntaxerror : invalid syntax I do not know what is the problem ? normaly it should give [ "ca" , "caa" , "ca"]
-
FoxyMod good morning Thank you for your reply I understand more better now for example : >>> s = input( 400+458+78) 936 not only the input() function outputs what is inside its parenthesis but it evaluates it and give the result
-
"In other words: The user's input is evaluated as Python code" sorry I did not ,exactly, understand your meaning . Could you , please , explain it more clearly ? Here http://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x it is stated that using input() is better than raw_input() raw_input() takes exactly what the user typed and passes it back as a string. input() takes the raw_input() and performs an eval() on it as well. The main difference is that input() expects a syntactically correct python statement where raw_input() does not. in matter of making errors input() is more strict than raw_input() it is mentioned too that : raw_input() was renamed to input() and the old input() was removed. If you want to use the old input(), you can do eval(input()). may be this is why when I use raw_input() instead of input() python interpreter gives me this error: NamError : name 'raw_input' is not defined What do you think ?
-
I found it . It becomes like this : languages = ["german" , "english" , "italian"] for x in languages: print(x , len(x))
-
"That will change the permissions on the directory /home itself, not the files inside it" thank you for the valuable information . However I need to change the permission of both files in /home directory regardless their name and extensions for example lets say : I have two files example.txt and intelligent.php in directory /home and I want to change the permission for these both files to all users + write so how can I do it or what is the command to do it ?
-
hello justsomeguy how are you doing I hope good concerning your reply if for example I have a directory whose name is /home in this directory there are two files : example.txt and example1.txt and I want to change permissions of these two files in the home directory to for all users + write should I do it like this $ chmod a+r /home ? is this command true or wrong ? and if it is wrong what is the right one?
-
now I used input() instead of raw_input() are they the same ? if I want to operate mathematically with input() too should I cast to an integer too like with raw_input() int(input("write a number:"))
-
4.3. The range() Function If you do need to iterate over a sequence of numbers, the built-in function range() comes in handy. It generates lists containing arithmetic progressions: >>>>>> range(10)[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] The given end point is never part of the generated list; range(10) generates a list of 10 values, the legal indices for items of a sequence of length 10 When I used the same little piece of code in my python interpreter web console it gave me : >>> range(10) (0,10) and not [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] why?
-
"The result of raw_input() is most likely a string" it can be an integer too "which means you can't operate mathematically with it" I could as both raw_input() and int(raw_input()) , in our example , gave me the same result . So what do you say about it ?
-
languages = ["german" , "english" , "italian"] for x in languages: print(x) , len(x) it gives me : german (none , 6) english (none , 7) italian (none , 7) but I want it to be german 6 english 7 italian 7 how ?
-
In this web page : https://docs.python.org/2/tutorial/controlflow.html There is this construction : x = int(raw_input("Please enter an integer: ")) Why the person who wrote the page used int(raw_input(....) instead of only raw_input(....) ? they both give the same result so why complicate things ??
-
You are right . I made an unconscious error
-
I know how to change permission of a file for all users + write : $ chmod a+r example.txt However I do not know how to do it with two files in the same time is it like this : $ chmod a+r example1.txt example2.txt ?? or how is it exactly ?
-
what does it mean by range is around 150 to 170 and 56 to 89? an IP address is composed of 4 numbers . If we suppose that an IP is 0.0.0.0 and we want to compose an ip address in which a range is around 150 to 170 and 56 to 89 so how it becomes our IP address 160.66.13.20 or 13.20.160.66 or 160.66.0.0 or 0.0.160.66 150<160<170 and 56<66<89
-
You're asking it for b, the value you set was a b was probably set to 3 earlier. No no I did not . I did not assign any value to b I begun the little piece of code like this >>> a = 123 >>> b (then when I pressed enter ) I got 3 as a result believe me now i tried again but when I pressed enter I got this error : name 'b' is not defined now a value should assigned to b Now I assigned a value to be b and now it is printed normally but before the result was 3
-
thank you
-
I would like to clear python interpreter command line . I know that there a command like : import os os.system('cls') you invoke the OS to clear the interpreter command line . Is there a more short , simple and elegant command that clear python interpreter command line ?
-
In python interpreter prompt command , I got this result : >>> a= 25 >>> b 3 >>> a=120 >>> b 3 I could not understanding why I got 3 as a result . What is the explanation of getting 3 as a result or why I get 3 as a result ??