1. While You're Here - Commas



I'm confused - why is there a comma after the string (in between the string and count). I removed it and it showed a syntax error. Why is this, and what is its purpose?

count = 0

if count < 10:
    print "Hello, I am an if statement and count is", count
while count < 10:
    print "Hello, I am a while and count is", count
    count += 1


the comma's allows you to concatenate the string and integer together.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.