Antivirus programs search a virus executable for a known piece of code or some other sort of signature that uniquely identifies it. Exactly how a virus is identified depends upon how the antivirus was made. The "signatures" or "definitions" you download just about every day is a database containing these identifications.

A virus isn't [I]known[/I] and removable until it has already been released, hit some computers, and either submitted to or caught by Antivirus companies who add an ID for the virus to their database and release an update. To combat new viruses that are unknown, what's called a heuristic scan may be performed.

A heuristic scan picks apart an executable and searches for patterns commonly found in viruses, such as disabling parts of Windows, raising a fake error when something is opened, etc. Most viruses (in this case I am talking about extremely common 'rouge antiviruses') are just cheap copies of earlier ones. Several are identical to one another other than a slightly different GUI, name, and possibly hiding techniques. You can see how this actually works well! If a program is flagged by heuristics it is usually flagged as "Suspicious" as the antivirus doesn't really know if it is a threat or not.

Anyway, It depends on exactly what you are doing in the background. If you're accessing the internet in any way, it'll probably respond by asking the user to allow the program through the firewall. (assuming the antivirus has one, it SHOULD if it's worth anything) ...

Its taking a string called ligne, splitting it at char 59 (that's a semicolon), and assigning valeur as index zero of the split.

C# equivalent of that

[CODE]string valeur = ligne.Split(';')[0];[/CODE]

samueal commented: Good one. +4

This will do it.

[CODE]for (int I = 1; I <= 4; I++)
this.Controls["label" + I].Text = "Some text";

There's an infinite recursion going on. Here's what is happening.

Line 127: You make a BattleshipBoard object called 'b' giving it the value of a new BattleshipBoard class. It's going to go through and assign any variables you tell it to and make its methods available to the object you assign it to.

Line 10: You create a new Player object called 'p' with the value of a new Player class. It will assign values and make the methods available to 'p'.

Line 48: Inside the Player class, you create another new BattleshipBoard.

The program will now go back to BattleshipBoard, which creates a new player, which creates a new BattleshipBoard, which creates a new player, and so on.

ddanbe commented: Nice observation and explanation! +14

That means no value was returned. Look at your find_discount() function. You've set what discount should be on all occasions, but you only return on one occasion! You need to move it back so it returns after all the if and else statements.

Here's how it should be.
[CODE]def find_discount(total):
if total <120: #Check for this
discount = 0 #It's True! Skip the else: statement.

else:              #Above is not true, execute this block of code
    if total <300: #You get the picture..
        discount = 0.03*total
        if total <500:
            discount = 0.05*total
            discount = 0.07*total

#All checks are done, so return
return discount[/CODE]

Also, line 39 needs to be: [ICODE]print "The total is " + str(discounted_total)[/ICODE]

This makes it a string. You must do this because your discounted total is a float, and you can't add letters and numbers.

C'mon, show a little effort. It's not hard, I promise.

[URL=""][I][B]This page might help.[/B][/I][/URL]

Instead of using If to handle errors you need to use the Try and Except statement.

Here is your code using those.

[CODE]import getpass, smtplib

gname = raw_input("Username: ")
gpass = getpass.getpass("Password: ")

try: #Try to execute the code between try: and except:
server = smtplib.SMTP('')
server.login(gname,gpass) #<-- SMTPAuthenicationError is raised here.

Now Python will look for an Except clause that handles that specific error, skipping over the rest of the Try clause.
#Which is printing that we are logged in, which we aren't!

print "Logged in as ", gname  

except smtplib.SMTPAuthenticationError: #Found it!
print "Error! Wrong password or username." #Huzzah![/CODE]

From the Python documentation:
"The try statement works as follows.

  • First, the try clause (the statement(s) between the try and except keywords) is executed.

  • If no exception occurs, the except clause is skipped and execution of the try statement is finished.

  • If an exception occurs during execution of the try clause, the rest of the clause is skipped. Then if its type matches the exception named after the except keyword, the except clause is executed, and then execution continues after the try statement."

Here's a link to the page all about errors and exceptions.

I apologize if I make no sense at all. I'm a terrible teacher. :P

Perhaps not the best way to do it, but maybe something like this?

[CODE]import random

tries = 0
keys='abcdefghijklmnopqrstuvwxyz '
key = random.choice(keys)

while key != "m": #While key is not equal to 'm'
tries += 1 #Add one to tries
key = random.choice(keys) #Choose another key

if key == "m": #Key 'm' was chosen
print "Tried %s times until we got m." % tries

dustbunny000 commented: geat post +1