![]() |
|
[Python] Waiting script with turns -> my #4 script in python. - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Waiting script with turns -> my #4 script in python. (/showthread.php?tid=5666368) Pages: Pages
1
2
|
Waiting script with turns -> my #4 script in python. - Malentor - Jul 10, 2017 first of all thank you for the tips on my previous threads, I have took these tips and used them. A user told me to start using try/except , and another user told me to start using ELIF instead making too many if statements. Here is what I made with these tips: PHP Code I feel happy that only had to use google only once for search how to clear the console after every command , the rest was on my mind. cya next!! * - Crypto Elliot - Jul 10, 2017 Looks good! There isn't a problem using google or anything. Most people I know are on stack overflow the whole day. Just wondering, what are you learning python for? * - Anxuein - Jul 10, 2017 You should be using Google. I don't mean that in a bad way, a LOT of programmers use Google still and you can find good improvements while doing so. * - Charger - Jul 10, 2017 Quit centering your code. * - Malentor - Jul 10, 2017 (Jul 10, 2017 01:55 PM)Kryometric Wrote: Looks good! There isn't a problem using google or anything. Most people I know are on stack overflow the whole day. Just wondering, what are you learning python for? My goal for the end of this year is learn as much coding as I can. I already know the basics of PHP and Python, I choose python just because I am little bit familiar with PHP and is almost same sintax. * - vorticalbox - Jul 10, 2017 (Jul 10, 2017 02:05 PM)Malentor Wrote: My goal for the end of this year is learn as much coding as I can. I already know the basics of PHP and Python, I choose python just because I am little bit familiar with PHP and is almost same sintax. No its really not close to php, for one php doesn't use white space for syntax and php requires lines to end with ; If are different too If($var == 'something') { //stuff } Where as python If var == 'something': //stuff * - Malentor - Jul 10, 2017 (Jul 10, 2017 02:35 PM)vorticalbox Wrote: No its really not close to php, for one php doesn't use white space for syntax and php requires lines to end with ;Its almost same to me, I'm sorry if you don't think the same. Also in PHP,Python you don't have to state the type of variable, it auto-detect itself, unlike another languages like java or C++ Thats another reason why I think why python is little bit same than PHP and a very easy language to start with. * - Malicious Intent - Jul 10, 2017 In Pytho indentation is very important and this code will not run if you copy and run it. As Charger said .. please dont center the code.. any code... good luck with your learning tho. Python is a good language to know and very useful for quickness. Also .. python might detect the variable type but it doesnt mean you dont need to know or declare the types ...you will understand once you dig deeper into it. * - Malentor - Jul 10, 2017 (Jul 10, 2017 02:01 PM)Charger Wrote: Quit centering your code. i just edited the thread, thanks for heads up * - Malicious Intent - Jul 10, 2017 (Jul 10, 2017 02:57 PM)Malentor Wrote: i just edited the thread, thanks for heads up Also just noticed .. you dont need to convert the input to int.. its int by default. Another thing is that the exception handling will not work correctly the way it is.. option() is also not needed in exception .. there is few things wrong here but keep trying buddy. * - Malentor - Jul 10, 2017 (Jul 10, 2017 03:06 PM)Malicious Intent Wrote: Also just noticed .. you dont need to convert the input to int.. its int by default. in this line? select_option = int(input( I thought i always had to set int for numbers and raw_input for strings alright thanks :) * - Malicious Intent - Jul 10, 2017 (Jul 10, 2017 03:21 PM)Malentor Wrote: in this line? In python 3+ there is no raw_input .. input can be str or int but its int by default. in python 2.7 you can use raw_input for strings or integers but might have to convert somewhere down the line if you need to make operation on int... * - Malentor - Jul 10, 2017 (Jul 10, 2017 03:24 PM)Malicious Intent Wrote: In python 3+ there is no raw_input .. input can be str or int but its int by default. in python 2.7 you can use raw_input for strings or integers but might have to convert somewhere down the line if you need to make operation on int... good to know, thanks * - Malicious Intent - Jul 11, 2017 Code def add_client():Also there is no need to print "Added" twice here as it will get cleared by the os.system anyway. * - Davian - Jul 12, 2017 Just a small mistake I thought is worth mentioning, PHP Code Correct way: PHP Code PHP Code Keep learning dude you're doing great. |