Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Oct 19, 2019 10:03
@AndrasDeak Okay. Sure
Oct 19, 2019 10:00
@Aran-Fey :)
Oct 19, 2019 09:57
@Aran-Fey Doesn't it check all items in a new_number_list with a particular item in the original list ? I have tried quite a lot but i am getting output as just [].
Oct 19, 2019 09:51
/
#Python program to remove all the duplicates.
number_list=[2, 3, 7, 0, 9, 2, 5, 0, 4, 3, 1, 77, 65, 2, 4]

new_number_list=[]
for item1 in number_list:
for item2 in new_number_list:
if item1!=item2:
new_numbers_list.append(item1)

print(new_number_list)

/
Oct 19, 2019 09:51
where am i going wrong here friends ?
 

Lounge<C++>

Today we're daydreaming about C++26 reflection
Mar 2, 2015 17:08
whether its true or false
Mar 2, 2015 17:07
I m not satisfied , in my opinion since the code is if(equal) statement1 , shouldn't it give only statement 1 ?
Mar 2, 2015 17:06
@LightnessRacesinOrbit I have already tried , if equal is true then statement1 , and if equal is false then i get statement 2 .
Mar 2, 2015 17:05
and if equal is "false" ?
Mar 2, 2015 17:05
say equal is "true" will it execute statement 1 or statement 2 ?
Mar 2, 2015 17:04
consider i have a bool variable "equal" . How does the If-else statement execute if i say if(equal) statement1
else statement 2 .
Mar 2, 2015 16:21
ideone.com/82EXtM can someone tell me why if statement is necessary
Mar 2, 2015 16:20
@AlexM. huh I don't know what it does .
Mar 2, 2015 16:19
@AlexM. If cin is not m then the output will be "Invalid entry
Mar 2, 2015 16:17
what does it mean ?
Mar 2, 2015 16:17
 if (!(std::cin >> m)) {
        std::cout << "Invalid entry\n";
Mar 2, 2015 09:54
@sehe I am still confused with the if statement , what does actually that statement do ?
Mar 2, 2015 09:42
@sehe std is just substitution for namespace std which one can define at the beginning right ?
Mar 2, 2015 09:39
@sehe there is no error now .
Mar 2, 2015 09:38
?
Mar 2, 2015 09:38
@sehe the 'if' statement
Mar 2, 2015 09:35
@sehe Looks lot better
Mar 2, 2015 09:35
@sehe Yes i am going through it .
Mar 2, 2015 09:33
@sehe Are you suggesting me that i should write the code in the way that your link includes ?
Mar 2, 2015 09:26
@sehe so the rem assumes 0 as the value
Mar 2, 2015 09:23
Ok
Mar 2, 2015 09:22
haha
Mar 2, 2015 09:21
@Rapptz How do i do that ?
Mar 2, 2015 09:19
@sehe the first loop is satisfied for i=1, i=2, i=3 , but non of the i's will satisfy the second loop so i shouldn't get anything at all . Am i wrong ?
Mar 2, 2015 09:13
ideone.com/01IoHo for m=4 why do i get 000 as output ? I should actually get nothing as output .
Mar 1, 2015 20:42
@jPlatte The purpose was to produce all the prime numbers less than 'm'.
Mar 1, 2015 20:34
@jPlatte thanks
Mar 1, 2015 20:31
ideone.com/fmyuzc @jPlatte can you tell me whats wrong because i am getting every digit twice . :(
Mar 1, 2015 20:07
@Blob I will write down short notes on the side of the codes to explain what i am expecting , please have a look when u have time .
Mar 1, 2015 20:05
@Blob Thanks a lot . I read a lot but didn't notice that at all .
Mar 1, 2015 20:04
@Blob Got it , but one confusion is what if i use only one "=" .
Mar 1, 2015 20:03
@jPlatte I am expecting it to give me all the prime numbers less than 'm' .
Mar 1, 2015 20:03
@milleniumbug i meant that if my cin = 1 or cin =2 then it immediately tells me that the number is prime .
Mar 1, 2015 20:00
pastie.org/9992070 @jPlatte can you check whats wrong in my code if you have time .
Mar 1, 2015 19:59
@jPlatte thanks
Mar 1, 2015 19:58
@Pris i have written a code and i want to share here with few questions , but i am not supposed to throw in a code more than 5 lines . is there a platform where i can write and share the link ?
Mar 1, 2015 19:56
where can i write code to get an URL to share ? Do you know ?
Feb 26, 2015 12:59
@sehe Thats a code from MIT lecture , the question was to find out the output without the use of computer .
Feb 26, 2015 12:57
@LightnessRacesinOrbit okay
Feb 26, 2015 12:56
@райтфолд :(
Feb 26, 2015 12:47
@LightnessRacesinOrbit so if initially accumulator = a , bob = b , and dole is odd , then accumulator = a+b .
Feb 26, 2015 12:41
@milleniumbug accumulator +=((dole % 2 ==1 )? bob : 0); consider if dole is odd , then does it mean bob =1 ?
Feb 26, 2015 12:38
okay :)
Feb 26, 2015 12:34
int accumulator = 0;
3 while ( true )
4 {
5 if( dole == 0) break ;
6 accumulator += (( dole % 2 == 1) ? bob : 0);
7 dole /= 2;
8 bob *= 2;
9 }
10 cout << accumulator << "\n";
Feb 26, 2015 12:33
I worry if someone kicks me