I'm kind of new to python, and I wonder how you would convert the following code in C++ to python
int kids, cd;
while (cin >> kids >> cd){
if (kids == 0 && cd == 0)
break;
cout << pow(cd, kids)<<endl;
}
So I think it's probably something like
from math import pow
kids = int(raw_input())
cd = int(raw_input())
while kids!=0 and cd!=0:
print pow(cd, kids)
kids = int(raw_input())
cd = int(raw_input())
When I submit my python code to the online judge SPOJ, I got a runtime error. My C++ code isn't accepted because of the overflow when the numbers get too large... What's wrong?
Also when I tried to compile the python code using
http://repl.it/languages/Python
with input
2
5
and I get the output
25.0
But how do I make it to be 25 instead of 25.0?
Thanks!
>>or should that be>=?>>is probably intentional;cin >> xreads from the standard input intox.