+ 1
In my latest code py how do i remove x from
answer ? Can somebody guide please ? Thank you.
9 Answers
+ 2
Thank you Mr Ben Davis
+ 1
#include<iostream>
using namespace std;
int main()
{
char c;
int i,j;
string s;
cin>>s;
int d=s.length();
for(i=0;i<=d;i++)
{
if(s[i]=='x')
{
s[i]=s[i+1];
d--;
}
}
cout<<s;
return 0;
}
this coding will remove x from the string
+ 1
Thank you Mr Thilipan
and Python could be simpler and shorter ?
Can you give a Py try ? :)
+ 1
sorry sir i am just learning java and c++ only
so i am post my coding in c++
0
you didn't attach the code to the question.
also please label your question with the language you are using (eg Java)
0
Language is py
but I don't know how I can attach code to question.
0
% is the Modulo operator. It gives the remainder of a decision.
eg mod = a % b
then mod would be the remainder of a after b has been subtracted "a +ve integer" number of times.
I think you want newval = pi - X but your question isn't very clear
0
you can still edit the question, or just add the code in a comment. The way to do so is to click the grey "+ insert..." at bottom left, then select "insert code" from the popup, then select the code (you will need to use the filter at top right to find the code to share! select "my codes" instead of "trending")
0
Fine
Thank you Mr Thilipan