Back
Close

Computing with Data

elgeish
97.2K views

Strings

Python's scalar data types and operators are similar to those in C++ and Java. That said, Python's boolean operators are expressed using keywords: and, or, and not:

s = ''' this is a string
that spans
multiple lines'''
print('\n line') # newline followed by "line"
print(r'\n line') # avoid escape character substitution
s = "Python"
print(s[2]) # print third character of string s
print(s + str(123)) # concatenate s with "123"
print(s.replace('P', 'p')) # replace 'P' in s with 'p'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants