13,420
edits
Changes
→PART 1 - Strings and Substrings
print(str(course_number))
print(course_name + ' ' + course_code + ' ' + str(course_number))
</source>Strings can also use special syntax for string '''repetition ''' by <u>multiplying </u> the string by a number. This will repeat that string that many times. Repetition with '''*''' is useful whenever a string needs to be repeated more than once<br><br>
:#Issue the following:<source>
print(course_name + '-' + course_code)
print('abc'*2)
print(course_code*5)
</source>When using the '''print() ''' function, you can display '''special characters'''. One such special character is the is the newline character (denoted by the symbol: '''\n'''). This allows you to separate content between new lines or empty lines.<br><br>
:#To demonstrate, issue the following:<source>
print('Line 1\nLine 2\nLine 3\n')