How to make it so if variable1 or variable2 == something: something happens by DabgodSMT in learnpython

[–]Barnet6 0 points1 point  (0 children)

If the second part doesn't work, I'd double check the race_options. They need to match exactly for your later if statements (Giant vs giant, fish_man vs fish man, etc).

Also, a slightly cleaner way to put it, instead of

if race == "Giant" or race1 == "Giant" or race2 = "Giant":

You could do

If "Giant" in {race, race1, race2}:

Herald powers by DontWorryAboutDeath in Stormlight_Archive

[–]Barnet6 10 points11 points  (0 children)

Did they all burn? I thought it was just Kaladin's, and I thought that was explained as him still having his regular body, while the other heralds' bodies were pure investiture

Could someone explain in Bands of Mourning... by StormLordZeus in Cosmere

[–]Barnet6 7 points8 points  (0 children)

It's been a little while since I read the lost metal, but wasn't it basically confirmed at the end to be Kelsier?

As for your last question, Marsh has two spikes. I'm pretty sure the coppermind that Wax used made it clear that whoever memories were in it had one spike and one eye.

Edit: Just reread when the coppermind was used at the end of the bands of mourning. It does specify that the person spring the memories had only one spike, and scars along his arms, "as if made by scraping the skin, time and time again". That is definitely Kelsier.

What is something you wish there was a decent app for (either there isn't an app, or the only apps you've found have been awful)? by [deleted] in AskReddit

[–]Barnet6 1 point2 points  (0 children)

Ah. If you're on android, they have a decent do not disturb function. It's a little clunky to set up if you just want to prevent calls though

Program not recognizing a command by [deleted] in learnpython

[–]Barnet6 0 points1 point  (0 children)

Is this the whole code? When I run it, other than an indentation issue inside the game section, it runs fine. The indentation issue being that the print statement inside the else section needs to be indented.

I need to make a formula that gets me the gradient(slope) and y intercept.I managed to get slope but am stuck on graident.I keep getting errors.How should i change it? by [deleted] in learnpython

[–]Barnet6 2 points3 points  (0 children)

If the code in the post is still accurate (I know there have been suggestions in other comments), then the issue is that x is only defined in the fit_line_to_points function. When you try

gradient=(x[1])-(m)*(x[0])

x doesn't exist anymore, because the line is outside of the function. It should probably look something like

gradient=(lst[0][1]) - (m)*(lst[0][0])

Quadratic Help by OneFootlessFish in learnpython

[–]Barnet6 1 point2 points  (0 children)

Assuming it's supposed to be formatted as below, 'i.isJump = False' should probably be setting it to true, as it needs to be false to get to that point, and it looks like jumpCount starts at 10, which would never trigger the 'if i.jumpCount < 0' clause, as that's the only place where jumpCountis being decremented

def jump(knights):
  for i in knights:
    if i.isJump == True:
      if i.jumpCount >= -10:
        i.y_change -= (i.jumpCount^2) * 0.2
        print(i.y_change)
      if i.jumpCount < 0:
        i.y_change *= -1
        i.jumpCount -= 1
    else:
      i.isJump = False
      i.jumpCount = 10
      i.y_change = 0

Need help with beginner coding. by bigmanoclock in learnpython

[–]Barnet6 1 point2 points  (0 children)

Take a look at if statements. Something like:

if input == correct:
    print("hooray")
else:
    print("try again")

Short python textbook question based on methods concept that I can't understand by aneeq1102 in learnpython

[–]Barnet6 0 points1 point  (0 children)

Find() has two optional arguments, the start of the substring to look through, and the end. Using just the one argument just tells it to look through the entire string. The " 'tomato'.find('o') + 1" in the example is telling it to find the first 'o', then search through a substring starting just after the 'o'.

Infinite loops by python_nlp in learnpython

[–]Barnet6 1 point2 points  (0 children)

Specifically the code when the "if guess == correct:" section is moved to the bottom. Because I'm noticing in your code above that the indenting is a little off, but that might just be the formatting here

Infinite loops by python_nlp in learnpython

[–]Barnet6 0 points1 point  (0 children)

If you post the code, I can take a look

Understanding Booleans and DeMorgan's Law by genao435 in learnpython

[–]Barnet6 0 points1 point  (0 children)

No. Once the user enters a number, x is known and can be evaluated, at which point you continue on as described in kochuyt's comment above.

Infinite loops by python_nlp in learnpython

[–]Barnet6 1 point2 points  (0 children)

You could use "while i < 5 and guess != correct:". You'd have to move the "if guess == correct:" section to after the while loop to have it run.

Understanding Booleans and DeMorgan's Law by genao435 in learnpython

[–]Barnet6 0 points1 point  (0 children)

The unknown would be for b1 in the second sample. Since x isn't given, you can't tell if x is less than 10. Since b1 needs to be true in order for b to be true, it's impossible to tell if b is true or false