-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathstrings-in-python.py
More file actions
24 lines (20 loc) · 1.11 KB
/
strings-in-python.py
File metadata and controls
24 lines (20 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'''
Strings in Python
50xp
In the video, you learned of another standard Python datatype, strings. Recall that these
represent textual data. To assign the string 'DataCamp' to a variable company, you execute:
company = 'DataCamp'
You've also learned to use the operations + and * with strings. Unlike with numeric types
such as ints and floats, the + operator concatenates strings together, while the * concatenates
multiple copies of a string together. In this exercise, you will use the + and * operations on
strings to answer the question below. Execute the following code in the shell:
object1 = "data" + "analysis" + "visualization"
object2 = 1 * 3
object3 = "1" * 3
What are the values in object1, object2, and object3, respectively?
Possible Answers
object1 contains "data + analysis + visualization", object2 contains "1*3", object3 contains 13.
object1 contains "data+analysis+visualization", object2 contains 3, object3 contains "13".
object1 contains "dataanalysisvisualization", object2 contains 3, object3 contains "111".
'''
# object1 contains "dataanalysisvisualization", object2 contains 3, object3 contains "111".