+ 1
Write a program that takes text input and output it by adding 3 stars
Expl *** hello *** Note space between stars and text
20 Réponses
+ 6
Let's see your attempt!
+ 6
Its just simple write statement for how to take input and store it into variable then use print statement print 3star then value then print three Star
+ 3
Cԋιɠσȥιҽ Aɳყαҽʝι [Not Online]
Your answer to the question is accurate & appreciated by the OP.
However, without an explanation, it is highly unlikely he will understand why.
I admire you for wanting to help, but please explain the concepts behind the answer.
+ 3
Rik Wittkopp
Thanks 😊
2BpenciL YT the input variable takes an input using the input() function.
And the I output it using console and then add the three stars at beginning and end using string.
Hope I explained.
+ 3
Simon Sauter
Lol 😂
If u want space put it bruh
+ 3
Finally the solution is 👇
text = input( )
print("*** " + text + " ***")
#Thanks to simon Sauter for good explanation and thanks to all
+ 2
Cԋιɠσȥιҽ Aɳყαҽʝι [Not Online] the code you've given above is wrong.
1. It doesn't take the spaces into account.
2. console.log() is not python.
+ 2
АлКа Релова you missed the spaces.
+ 2
I'm not a fan of outright giving people the solutions to problems. But since there are several wrong answers in this thread I think it's necessary in this case.
Version 1:
text = input()
print("*** " + text + " ***")
# note the spaces within the quotation marks
Version 2:
text = input()
print("***", text, "***")
# in this case python uses the print function's default separator, which is a space
+ 2
ss the task explicitly says that the program has to take input, so your second code is one more for the "wrong answers heap". The first one comes on the "correct answers that have already been given heap".
+ 1
input = input()
console.log("***"+input+"***")
+ 1
GURURAJ KL you missed the spaces.
+ 1
Yes he should. But since there are several wrong answers here now there's a strong possibility that he won't be able to figure it out.
0
Simon Sauter But he didn't ask for space
0
Cԋιɠσȥιҽ Aɳყαҽʝι [Not Online] Reread his question. It's right there.
0
But he must know how to add it himself.
- 1
Simon Sauter it's not wrong. Only console.log() does not work. I just added it for better understanding.
- 1
2BpenciL YT
#Python Solution
print(f"***{input()}***")
- 1
stt=input("enter string")
print ('*'*3,stt,'*'*3)
OR
Stt="hello"
print ('*'*3,stt,'*'*3)