1.
文字列の結合にjoin()メソッドを使用する場合、リスト["apple", "banana", "cherry"]をカンマ区切りの文字列にする正しいコードはどれですか?
2.
次のコードの出力結果を求めてください。
words = ["data", "science", "python"]
sentence = " ".join(words)
print(sentence)
3.
次のコードの出力結果を求めてください。
text = "Python"
result = text + " " + text[::-1]
print(result)
4.
"Python3"という文字列から「3」を削除して"Python"にするコードはどれですか?
5.
次のうち、文字列"Hello"を5回繰り返した文字列を生成するためのコードはどれですか?
6.
次のコードの出力結果を求めてください。
text = "Hello"
result = text + " " * 3 + "World"
print(result)
7.
リスト["Python", "Java", "C++"]を結合して"Python and Java and C++"とするためのコードはどれですか?
8.
変数name = "Alice"とage = 25の内容を使って「Alice is 25 years old」という文字列を生成するために入力すべきコードはどれですか?
9.
次のコードを実行した場合の出力は何ですか?
items = ["apple", "banana", "cherry"]
output = " - ".join(items)
print(output)
10.
次のコードの出力結果を求めてください。
names = ["John", "Paul", "George", "Ringo"]
result = ", ".join(names)
print(result)
11.
変数greeting = "Hello"とname = "Alice"を使って、「Hello, Alice!」と出力するためのコードはどれですか?
12.
次のリスト["one", "two", "three"]をスペース区切りで結合し、"one two three"という文字列を生成するコードはどれですか?
13.
次のコードを実行した場合の出力は何ですか?
a = "Python"
b = "Programming"
result = a + " " + b
print(result)
14.
次のコードの出力結果を求めてください。
text = "Welcome"
repeat_text = text * 3
print(repeat_text)
15.
次のうち、文字列の結合に使われないメソッドはどれですか?
16.
変数animal = "cat"とsound = "meow"を使って、「The cat says meow」という文字列を生成するために入力すべきコードはどれですか?
17.
変数first = "Hello"とsecond = "World"を使って、「Hello, World!」という文字列を生成するために適切なコードはどれですか?
18.
文字列"Hello World"のスペースを削除して"HelloWorld"とするために使用するメソッドはどれですか?
19.
文字列フォーマットのf-string(フォーマット文字列)の記述方法として正しいものはどれですか?
20.
Pythonで文字列を結合するために使用される演算子はどれですか?