Question: Convert the given below C++ code into python. complete and step by step answer required #include #include using namespace std; void Add_and_Reverse(int n) { int

Convert the given below C++ code into python.

complete and step by step answer required

#include #include using namespace std; void Add_and_Reverse(int n) { int rem; long int sum = 0, t = n; static int i = -1; while (t != 0) { rem = t % 10; sum = sum * 10 + rem; t = t / 10; } ++i; if (n == sum) { cout << sum << endl; cout << i << endl; } else if (i <= 1000 && (n + sum) <= 4294967295) { n = n + sum; Add_and_Reverse(n);

} } bool palindrome(char *b, int e) { static int s = 0; if (s == e) return true; if (b[s] != b[e]) { return false; } if (s < e + 1) { s++; return palindrome(b, e - 1); return true; } return -1; } int main() { int choice,f; choice=true; while(choice==true)

{ f1:cout<<"press 1 to check Add_and_Reverse"<>choice; cin.ignore(); switch (choice) { case 1: cout<<"enter your number"<> num; Add_and_Reverse(num); break; case 2: int a; cout << "Enter the size of the word:"; cin >> a; char *aa; aa = new char[a]; for (int i = 0; i < a; i++) { cout << "Letter " << i + 1 << ": ";

cin >> aa[i]; } if (palindrome(aa, a - 1) == true) { cout << "Yes it is a palindrome" << endl; } else { cout << "No it is not a palindrome" << endl; } goto f1; case 3: goto f; break; default : cout << "wrong input, enter your number again" << endl; goto f1; } } f:cout<<"";

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!