C11 GCC9.2
And bro ur code will not be accepted since u are using extra things like “enter your number”.
remove them.your output should come as given in the question.
how can I solve it in python 3.8?
python 3.8
[REDACTED]
a = input("")
can be written without the quotes.
@hjr265 Hi!
In custom testing, Python 2.7 and PyPy 7.1 (2.7) has some problems. (Not only in this problem, rather in every other problems in toph)
When I pass abc
as input, it gives ‘abc’ is not defined. But passing “abc”(as a string) solves it. Ig, the system is passing exactly what we type. So, instead of a str input, it goes as a code variable.
The Test option has the same error too.
When submitted, it gets RE.
As the input in this problem is as integer, it works fine. But if the input is string, it gets RE. (e.g. This Submission)
Hope it’ll be solved soon. : )
Peace…
As-salamu alaikum @Nusab19,
What you are experiencing is a Python 2 behavior. On Python 3, input()
returns a string.
On Python 2, to take a string as input, you need to use raw_input()
instead.
You can learn more about these two functions here:
You will notice that the documentation says that in Python 2, input(...)
is equivalent to eval(raw_input(...))
.
What I would recommend is you switch to Python 3. And if you really want to stick to Python 2, then use raw_input()
when reading strings.
Hope this helps.
Walaikumus Salam Wa Rahmatullah @hjr265
Actually, I code in Python3.
I never learned Python2; I just got some ideas from other’s submissions in it.
So, After getting a AC in Pyhton3. I try to solve it in Python2 too.
I used to use raw_input()
while taking multiple inputs in a single line. You just cleared my misconception!
Jazakallahu Khairan.
Please someone give this solution with Javascript.
Hey @hjr265 I have recently submitted a code of this problem. while submitting I have got RTE. But when I run the same code in my laptop it works perfectly. Feeling complex.It occurs when I submit the code through ‘open file’
@Being_Gorom It seems you have submitted C++ code, but chose Bash 5.0 as your programming language.
Does this error happen if you change the programming language to one of the C++ ones?
Thanks man! Actually I had no idea that toph has updated!
[REDACTED]
why this problem is wrong?
When submitting your solution, please choose the correct programming language. It seems you are choosing Bash while your code is written in C.
#include<iostream>
using namespace std;
int main ()
{
int num = 10;
cout << "enter your number"<< endl;
cin>> num;
return 0;
}
this programme showing wrong answer in test…plz help
Do not print extra text like “enter your number”.
And, in your code you are reading the number but not printing it.
var num = prompt();
console.log(num);
how to solve this program with javascript?
One way of solving this problem in Node.js would be to use the readline
module.
You cannot use JavaScript for solving problems in toph. You can use NodeJS as an alternative.
However, taking input in NodeJS can be frustrating. A good alternative is to use C++, which has a similar syntax to JavaScript .