+ 1

In my latest code py how do i remove x from

answer ? Can somebody guide please ? Thank you.

27th Nov 2017, 5:58 AM
Anil/Anant/1949Nov
Anil/Anant/1949Nov - avatar
9 Respuestas
+ 2
Thank you Mr Ben Davis
20th Dec 2017, 3:45 AM
Anil/Anant/1949Nov
Anil/Anant/1949Nov - avatar
+ 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
27th Nov 2017, 5:51 PM
Thilipan Sakthivel
Thilipan Sakthivel - avatar
+ 1
Thank you Mr Thilipan and Python could be simpler and shorter ? Can you give a Py try ? :)
28th Nov 2017, 2:32 AM
Anil/Anant/1949Nov
Anil/Anant/1949Nov - avatar
+ 1
sorry sir i am just learning java and c++ only so i am post my coding in c++
28th Nov 2017, 9:29 AM
Thilipan Sakthivel
Thilipan Sakthivel - avatar
0
you didn't attach the code to the question. also please label your question with the language you are using (eg Java)
27th Nov 2017, 6:07 AM
Ben-Davis
Ben-Davis - avatar
0
Language is py but I don't know how I can attach code to question.
27th Nov 2017, 6:13 AM
Anil/Anant/1949Nov
Anil/Anant/1949Nov - avatar
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
27th Nov 2017, 6:17 AM
Ben-Davis
Ben-Davis - avatar
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")
27th Nov 2017, 7:10 AM
Ben-Davis
Ben-Davis - avatar
0
Fine Thank you Mr Thilipan
28th Nov 2017, 1:28 PM
Anil/Anant/1949Nov
Anil/Anant/1949Nov - avatar