What's the error in this code ?[Solved] | Sololearn: Learn to code for FREE!

+3

What's the error in this code ?[Solved]

https://code.sololearn.com/cGruGeT8KNaL/?ref=app I wanna append all the prime numbers from 1 to 100 but the code is only appending only 1 number!Why?

4/17/2021 4:48:36 AM

Frisbee

4 Answers

New Answer

+7

Unpuzzling Because you are not reinitialising count with 0 after first loop https://code.sololearn.com/cV6PcXPYQ6Gw/?ref=app

+9

https://code.sololearn.com/cHZ7LRSea61u/?ref=app Read it carefully hope it will help you ☺️

+1

Plz can someone help me out in this x=0 for i in range(30): x+=1 print x

+1

Teyei Anna You must give a space before (x+=1) for the syntax.And you also forgot to give the parenthesis to the print statement! The actual code would be like :- x=0 for i in range(30): x+=1 print(x)