cloning over all the old files
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# Given the initial statements
|
||||
# s1 = "spam"
|
||||
# s2 = "ni!"
|
||||
|
||||
# Show the result of evaluating each of the following string expressions.
|
||||
|
||||
# a) "The knights who say, " + s2
|
||||
# b) 3 * s1 +2 * s2
|
||||
# c) a1[1]
|
||||
# d) s1[1:3]
|
||||
# e) s1[2] + s2[:2]
|
||||
# f) s1 + s2[-1]
|
||||
# g) s1.upper()
|
||||
# h) s1.upper().1just(4) * 3
|
||||
|
||||
## Initialization
|
||||
s1 = "spam"
|
||||
s2 = "ni!"
|
||||
|
||||
StringValues = {
|
||||
"a": "The knights who say, " + s2,
|
||||
"b": 3 * s1 + 2 * s2,
|
||||
"c": s1[1],
|
||||
"d": s1[1:3],
|
||||
"e": s1[2] + s2[:2],
|
||||
"f": s1 + s2[-1],
|
||||
"g": s1.upper(),
|
||||
"h": s1.upper().ljust(4) * 3,
|
||||
}
|
||||
|
||||
def main():
|
||||
for key, value in StringValues.items():
|
||||
print(f"{key}) {value}")
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user