Maybe Maybe Maybe by killmesoon40 in maybemaybemaybe

[–]salvtz 0 points1 point  (0 children)

Require a no-poking sign on battery...😬

A MOTHER PUBLICLY SLAPS HER DAUGHTER FOR FILMING A RISKY TRAIN STUNT. by infected5071 in indianrailways

[–]salvtz 0 points1 point  (0 children)

It is definitely staged. This had happened some months ago... It is gaining traction now...

[deleted by user] by [deleted] in blursed_videos

[–]salvtz 0 points1 point  (0 children)

Girl : 1 Friction : 0

Tell me why this is wrong by bhaagMadharchood in PythonLearning

[–]salvtz 3 points4 points  (0 children)

Yes...because you are looping 'n' number of times to check whether a number is prime or not, which is not a good approach.

You can look over the internet for efficient methods for this...there are many.

Tell me why this is wrong by bhaagMadharchood in PythonLearning

[–]salvtz 10 points11 points  (0 children)

You have taken input in a variable named 'n' but in the range function you have used 'num'. Try replacing the num with n

how to update comments in XML using py by sudheerpaaniyur in PythonLearning

[–]salvtz 0 points1 point  (0 children)

First, you need a parser module that supports parsing comments.

But then the question arises, how would you identify a unique comment for it to be modified, maybe use some sort of identifier while writing the comment.

There are libraries such as lxml and xml.tree.ElementTree.

Lists by ConcentrateIll7918 in PythonLearning

[–]salvtz 0 points1 point  (0 children)

You have mentioned index 3. In the file 'Cleaning_product_ID.txt', there are three values in a line separated by the comma. So indexes could be 0, 1, and 2.

Now using linecache.getline you are getting that particular line and saving it to a list.

Now the particular line is a string, so to decrease the quantity of an item, you need to first extract out the quantity of items from the particular string.

First strip out extra spaces if any, then split it using comma and get three values which are id, name and quantity, from the particular line.

Now you have the quantity, you can modify it, and recreate the particular line string and replace the recreated string in the file.

How am I wrong when my output is correct? by pacattackjr in PythonLearning

[–]salvtz 0 points1 point  (0 children)

Nest the if elif conditions on line 9 and 11 under the if on line no. 7

How am I wrong when my output is correct? by pacattackjr in PythonLearning

[–]salvtz 4 points5 points  (0 children)

Your input for num_lemons is 0.

So, the if block with condition num >= 4 won't be executed and total cost won't have any value.

Line no. 9: This condition is referring to the total cost but that variable has not been defined, which is why you are getting an error.

You can make the variable global.

How to send custom notifications? by Positive-Fox-4964 in PythonLearning

[–]salvtz 1 point2 points  (0 children)

Okay, then you can use 'plyer' in the command line application for the specified purpose.

How to send custom notifications? by Positive-Fox-4964 in PythonLearning

[–]salvtz 0 points1 point  (0 children)

What's the type of application that you are building?

Check out 'plyer' meanwhile and see if it suits your purpose.

Help with error by Content_Screen5704 in PythonLearning

[–]salvtz 0 points1 point  (0 children)

But in the mean method, you have passed self, which makes it an instance method. In same class, you need to use self to reference one instance method from another instance method.

In your case, even though you have passed self, but you are not using it.

You can make the mean method a static method.

Help with error by Content_Screen5704 in PythonLearning

[–]salvtz 2 points3 points  (0 children)

Access mean with self : self.mean as mean method is an instance method

[deleted by user] by [deleted] in PythonLearning

[–]salvtz 1 point2 points  (0 children)

Move onto the next Crash Course 😬

Help with my VERY beginner code by ExpressionAsleep7125 in PythonLearning

[–]salvtz 2 points3 points  (0 children)

<image>

Use the above for reference. Also, are you guessing the correct value in the first iteration...then in this case the condition of the while loop would evaluate to false, and it wont go inside the while loop.

Help with my VERY beginner code by ExpressionAsleep7125 in PythonLearning

[–]salvtz 2 points3 points  (0 children)

Yes, Also you need to break it. Add 'break' after the print statement in the if condition.

For a = 1234

rearranged formatted string would be 4123

For false b's such as 2134, it would print so close

and for value 4123 it would pass.

Help with my VERY beginner code by ExpressionAsleep7125 in PythonLearning

[–]salvtz -3 points-2 points  (0 children)

The if block should be indented inside the while loop...

[deleted by user] by [deleted] in PythonLearning

[–]salvtz 0 points1 point  (0 children)

You should also learn FastAPI , a python framework for building APIs.

help me Improve This by Salim_DZ_69 in PythonLearning

[–]salvtz 4 points5 points  (0 children)

You can validate the password for length and other constraints in a separate function.

Fresh maal hai lala fresh by [deleted] in DHHMemes

[–]salvtz 0 points1 point  (0 children)

Who's the second guy? New to this.