-
Posts
442 -
Joined
-
Last visited
Reputation Activity
-
-
-
-
-
Neil reacted to madknight3 in Python commenting style
Check out the popular PEP 8 style guide for Python. It has a section on comments as well as a lot of other stuff.
-
Neil got a reaction from namarino in Python Project
Fixed most of it. Your math is just wrong on calculating "express shipping" since it doesn't touch the shipping charge whatsoever.
#!/usr/bin/env pythondef main(): #Prompts user for weight of shipment shipment_weight = float(input("Weight of shipment(lbs): ")) #If weight of shipment is greater than 50, print 'Too heavy' and program ends if shipment_weight > 50: print("\nToo heavy!") return 0 express_shipment = raw_input("Express shipment? ") if str(express_shipment).lower() in ['n','no']: shipment_charge = .50 * shipment_weight elif express_shipment == 'y' or 'yes': shipment_distance = float(input("Distance of shipment(miles): ")) if shipment_distance > 12450: print("Out of range of Earth's surface!") return 0 if shipment_weight <= 3: shipment_charge = (shipment_distance / 200) * 3.00 if shipment_weight > 3 and shipment_weight <= 10: shipment_charge = (shipment_distance / 200) * 6.50 if shipment_weight > 10 and shipment_weight <= 20: shipment_charge = (shipment_distance / 200) * 14.00 if shipment_weight > 20: shipment_charge = (shipment_distance / 200) * 30.00 print "Shipment charge: $%g" % shipment_chargeif __name__ == '__main__': main() The big issue was that you were doing comparisons on strings that don't make sense. You cannot do "if 10 < some_var <= 10" in pretty much any programming language. You have to use compound boolean comparisons.
-
Neil got a reaction from Azgoth 2 in Python Project
Fixed most of it. Your math is just wrong on calculating "express shipping" since it doesn't touch the shipping charge whatsoever.
#!/usr/bin/env pythondef main(): #Prompts user for weight of shipment shipment_weight = float(input("Weight of shipment(lbs): ")) #If weight of shipment is greater than 50, print 'Too heavy' and program ends if shipment_weight > 50: print("\nToo heavy!") return 0 express_shipment = raw_input("Express shipment? ") if str(express_shipment).lower() in ['n','no']: shipment_charge = .50 * shipment_weight elif express_shipment == 'y' or 'yes': shipment_distance = float(input("Distance of shipment(miles): ")) if shipment_distance > 12450: print("Out of range of Earth's surface!") return 0 if shipment_weight <= 3: shipment_charge = (shipment_distance / 200) * 3.00 if shipment_weight > 3 and shipment_weight <= 10: shipment_charge = (shipment_distance / 200) * 6.50 if shipment_weight > 10 and shipment_weight <= 20: shipment_charge = (shipment_distance / 200) * 14.00 if shipment_weight > 20: shipment_charge = (shipment_distance / 200) * 30.00 print "Shipment charge: $%g" % shipment_chargeif __name__ == '__main__': main() The big issue was that you were doing comparisons on strings that don't make sense. You cannot do "if 10 < some_var <= 10" in pretty much any programming language. You have to use compound boolean comparisons.
-
-
Neil got a reaction from Oberon.Smite in YouTube taxes?
No personal income tax. There's still business tax.
-
Neil got a reaction from Speedyv in YouTube taxes?
No personal income tax. There's still business tax.
-
-
Neil got a reaction from Nuluvius in Java 8 pop quiz
I'll take "Not in school, I'd throw this into an IDE and have it print me a stack trace" for $1000, Alex.
There's no reason to be able to manually figure out what snippets like this are doing. That's what the compiler is for.
-
Neil got a reaction from dark_xzyph3r in Watercool Poweredge 2950
As a general rule: Don't watercool servers. If you don't want it to be loud, don't own a rack server.
-
Neil got a reaction from omniomi in Noob question about coding/programming
Possible, yes. Probable, no. DNS uses TTLs (time to lives) which would make simply editing the DNS useless unless the TTLs on the records were very low, or happened to propagate very quickly. That being said, the TTLs are /usually/ honored by recursive DNS resolvers.
As for redirecting the traffic to another host, it depends on if it was SSL traffic or not. If it was SSL, then they'd need the private key for the certificate in order to properly perform a MITM attack.
-
-
Neil got a reaction from Gala in Command line torrent client - because a GUI is so 2015
Uhh. rtorrent supports magnet links. Has for a very long time.
$ rtorrent//press backspace//paste magnet link//press enter
Done.
-
Neil reacted to conspiravision in Why can't Linux people just use Windows?
You're missing the point. You need to be OS agnostic, there are many great things Windows is used for such as there are many great things Linux and OSx are used for. It all depends on how the end user feels like using the system and when it comes to performance it depends on what the user is trying to accomplish. I have had all 3 platforms before, and currently have Windows and Linux. Windows I use as my daily driver typically because of applications and the driver support for my graphics card. However I do run Linux on my laptop and server. Chances are you are just used to Windows because you have grown up using it, but if you learn more about Linux and start using the cli you'll understand the great advantages it has.
-
Neil got a reaction from FakezZ in Calculator Fix
Or, abstracted out, because why should we use a billion cout statements:
#include<iostream>#include<stdio.h>using namespace std;char method;double othernum1, othernum2, result;int main(){ cout << "Please Enter The First Number: "; cin >> othernum1; cout << "Please Enter The Second Number: "; cin >> othernum2; cout << "Please Enter What You Want To Do: "; cin >> method; switch(method) { case '-': result = othernum1 - othernum2; break; case '+': result = othernum1 + othernum2; break; case '/': result = othernum1 / othernum2; break; case '*': result = othernum1 * othernum2; break; default: cout << "command not found!\n"; return 2; }; printf("%g %c %g = %g", othernum1, method, othernum2, result); return 0;} -
Neil got a reaction from fizzlesticks in Best website to learn C?
I'm pretty sure you're just putting a lot of words together in an attempt to sound like you know what you're talking about.
-
Neil got a reaction from dalekphalm in This may seem like a silly question >.<
In theory, a cable with better shielding will also be less susceptible to crosstalk and other EM interference. STP cables only really need to be used for long runs and for runs going through outside facing walls, or if they're being run outside.
-
Neil got a reaction from Nuluvius in Best website to learn C?
I'm pretty sure you're just putting a lot of words together in an attempt to sound like you know what you're talking about.
-
Neil got a reaction from CyberBro in Calculator Fix
Or, abstracted out, because why should we use a billion cout statements:
#include<iostream>#include<stdio.h>using namespace std;char method;double othernum1, othernum2, result;int main(){ cout << "Please Enter The First Number: "; cin >> othernum1; cout << "Please Enter The Second Number: "; cin >> othernum2; cout << "Please Enter What You Want To Do: "; cin >> method; switch(method) { case '-': result = othernum1 - othernum2; break; case '+': result = othernum1 + othernum2; break; case '/': result = othernum1 / othernum2; break; case '*': result = othernum1 * othernum2; break; default: cout << "command not found!\n"; return 2; }; printf("%g %c %g = %g", othernum1, method, othernum2, result); return 0;} -
Neil got a reaction from dalekphalm in Funny x64bit Windows
If you want to get technical, it's x86_64, as that's the instruction set used.
-
Neil got a reaction from byalexandr in Funny x64bit Windows
If you want to get technical, it's x86_64, as that's the instruction set used.
-
Neil got a reaction from byalexandr in Qualifications for a Computer Repair Technician?
It's so important, not only for jobs when you're young, but when you're getting into a career too. If you don't know how to do something, or have questions -- just ask your manager/boss. If you try to sound smart and pretend you know what you're talking about, I'm going to assume you know exactly what you're doing and let you go. I don't like to micromanage someone that is confident in their abilities. But false confidence and lying will get you nowhere.