回答編集履歴

6

update code

2022/12/01 07:37

投稿

ps_aux_grep
ps_aux_grep

スコア1579

test CHANGED
@@ -33,16 +33,21 @@
33
33
  print(output)
34
34
 
35
35
  def hello9(name):
36
- print(name.join(["こんにちは", "さん"]))
36
+ print(name.join([''.join(list(map(chr, [12371, 12435, 12395, 12385, 12399]))), "さん"]))
37
37
 
38
38
  def hello10(name):
39
- for s in "こんにちはさん":
39
+ output = list("こんにちはさん")
40
+ output.insert(5, name)
41
+ print(''.join(output))
42
+
43
+ def hello11(name):
44
+ for s in [12371, 12435, 12395, 12385, 12399, 12373, 12435]:
40
- print(s, end = "")
45
+ print(chr(s), end = "")
41
- if s == "は":
46
+ if chr(s) == "は":
42
47
  print(name, end = "")
43
48
  print()
44
49
 
45
- for i in range(1, 11):
50
+ for i in range(1, 12):
46
51
  print(f"hello{i}(name): ", end = "")
47
52
  globals()[f"hello{i}"]("キティ")
48
53
  ```

5

update answer

2022/12/01 07:26

投稿

ps_aux_grep
ps_aux_grep

スコア1579

test CHANGED
@@ -35,7 +35,14 @@
35
35
  def hello9(name):
36
36
  print(name.join(["こんにちは", "さん"]))
37
37
 
38
+ def hello10(name):
39
+ for s in "こんにちはさん":
40
+ print(s, end = "")
41
+ if s == "は":
42
+ print(name, end = "")
43
+ print()
44
+
38
- for i in range(1, 10):
45
+ for i in range(1, 11):
39
46
  print(f"hello{i}(name): ", end = "")
40
47
  globals()[f"hello{i}"]("キティ")
41
48
  ```

4

add code

2022/12/01 07:22

投稿

ps_aux_grep
ps_aux_grep

スコア1579

test CHANGED
@@ -32,7 +32,11 @@
32
32
  output += "さん"
33
33
  print(output)
34
34
 
35
+ def hello9(name):
36
+ print(name.join(["こんにちは", "さん"]))
37
+
35
- for i in range(1, 9):
38
+ for i in range(1, 10):
39
+ print(f"hello{i}(name): ", end = "")
36
40
  globals()[f"hello{i}"]("キティ")
37
41
  ```
38
42
 

3

add code

2022/12/01 07:18

投稿

ps_aux_grep
ps_aux_grep

スコア1579

test CHANGED
@@ -22,9 +22,18 @@
22
22
  print("こんにちは", end = "")
23
23
  print(name, end = "")
24
24
  print("さん")
25
+
25
-
26
+ def hello7(name):
26
- for f in [hello1, hello2, hello3, hello4, hello5, hello6]:
27
+ print("こんにちは" + name + "さん")
28
+
29
+ def hello8(name):
30
+ output = "こんにちは"
31
+ output += name
27
- f("キティ")
32
+ output += "さん"
33
+ print(output)
34
+
35
+ for i in range(1, 9):
36
+ globals()[f"hello{i}"]("キティ")
28
37
  ```
29
38
 
30
39
  [paiza.io](https://paiza.io/projects/8mTISFyZ5fwZFPiZt5xbiw)

2

update code

2022/12/01 07:11

投稿

ps_aux_grep
ps_aux_grep

スコア1579

test CHANGED
@@ -17,8 +17,13 @@
17
17
 
18
18
  def hello5(name):
19
19
  print("こんにちは", name, "さん", sep = "")
20
+
21
+ def hello6(name):
22
+ print("こんにちは", end = "")
23
+ print(name, end = "")
24
+ print("さん")
20
25
 
21
- for f in [hello1, hello2, hello3, hello4, hello5]:
26
+ for f in [hello1, hello2, hello3, hello4, hello5, hello6]:
22
27
  f("キティ")
23
28
  ```
24
29
 

1

append code

2022/12/01 07:09

投稿

ps_aux_grep
ps_aux_grep

スコア1579

test CHANGED
@@ -1 +1,25 @@
1
1
  [Python print with variable - Google Search](https://www.google.co.jp/search?q=python+print+with+variable)
2
+
3
+ 以下全て同じ文字列を出力します.出題者の意図を汲み取って適切なものを利用してください.
4
+
5
+ ```python
6
+ def hello1(name):
7
+ print(f"こんにちは{name}さん")
8
+
9
+ def hello2(name):
10
+ print("こんにちは{}さん".format(name))
11
+
12
+ def hello3(name):
13
+ print("こんにちは{0}さん".format(name))
14
+
15
+ def hello4(name):
16
+ print("こんにちは%sさん" % name)
17
+
18
+ def hello5(name):
19
+ print("こんにちは", name, "さん", sep = "")
20
+
21
+ for f in [hello1, hello2, hello3, hello4, hello5]:
22
+ f("キティ")
23
+ ```
24
+
25
+ [paiza.io](https://paiza.io/projects/8mTISFyZ5fwZFPiZt5xbiw)