1. While You're Here - Commas


#1



https://www.codecademy.com/courses/python-beginner-en-cxMGf/0/1?curriculum_id=4f89dab3d788890003000096#


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


#2

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


#3

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