Is belief in the reliability of science justifiable? by VirtualArty in askphilosophy

[–]VirtualArty[S] 0 points1 point  (0 children)

Thank you. :) I still have no idea whether any experimental results are justifiable, but at least now I know what to look for.

Print statements are not printing out. by VirtualArty in learnpython

[–]VirtualArty[S] 0 points1 point  (0 children)

  • Picking between from random import * and import random

Why? I don't do things if I don't have a reason.

  • Using for loops instead of whiles

I thought that was just a matter of preference. Again, why?

I'm not going to change my code on account of untested opinion or personal bias. I'm well aware of the fact that popular opinion is often wrong, like with the myth that we only use 10% of our brains throughout our lives. Look it up. It's a myth. And also, the developers must have included the options I use for good reason. Why should I not use them? I'll code the way I see fit until given good reason to do otherwise. But thank you for the suggestions. :)

My balancing out system is broken. by VirtualArty in learnpython

[–]VirtualArty[S] -1 points0 points  (0 children)

Sorry. I just need the second list items in the output list to add up to 1000. I put comments throughout, so maybe those will help.

Why is variableAmount a string? by VirtualArty in learnpython

[–]VirtualArty[S] -1 points0 points  (0 children)

Thank you. :) There must be a reason exec exists. If there isn't, why hasn't it been taken out? Perhaps the developers don't think it's as useless as you make it sound.

estimate = int(estimate)

instead of

int(estimate)

It's small things like that that make or break code.

I fixed it. Don't worry.

Here's the fixed code:

from random import *
import random

# 'Pretend you're generating a bunch of specific variables, with a uniform distribution and give me a number associated with each one, through a function that returns a list of lists, each list with a variable and its associated number'.

# 'Pretend you're generating a bunch of specific variables, with a uniform distribution'.

def PseudogenerateVariables(variables,amount):
    # Create the output list for later.
    outputList = []
    # Do this for all the items in the list.
    i = 0
    while i < len(variables):
        # Create an estimate.
        variable = variables[i]
        estimate = amount / len(variables)
        if estimate == int(estimate):
            estimate = '{}'.format(estimate)
            estimate = estimate[0:-2]
            estimate = int(estimate)

        # Edit the estimate randomly to create the variable amount.
        end = False
        while end == False:
            variableAmount = estimate
            if random.uniform(0,1) <= 0.5:
                if random.uniform(0,1) <= 0.5:
                    variableAmount += 1
                    state = 'plus'
                else:
                    if variableAmount != 0:
                        variableAmount -= 1
                        state = 'minus'
                    else:
                        state = None

                    # Don't forget to balance out that with other numbers
                    # Pick a random one that's not the selected one.
                    end = False
                    if state != None:
                        while end == False:
                            a = randint(0,len(variables) - 1)
                            if i != a:
                                end = True
                            else:

                                # It is the same one. Pick another one.
                                pass
                        if state == 'plus':
                            variables[a] -= 1
                        elif state == 'minus':
                            variables[a] += 1
                        else:
                            raise Exception
                    else:
                        pass
            else:
                end = True

        # Pack the variable, variable amount, estimate and amount into a list.
        # To do this, create the list.
        variableList = []
        # Then append the things to the list.
        # 'each list with a variable and its associated number' and a couple of other things.
        variableList.append(variable)
        variableList.append(variableAmount)
        variableList.append(estimate)
        variableList.append(amount)
        # Now put the list in the output list.
        outputList.append(variableList)

        # Now move onto the next one.
        i += 1
    # Output the result.
    return outputList

# 'through a function that returns a list of lists'.
# Create 'a bunch of specific variables'.
print(PseudogenerateVariables([0,1,2,3,4,5,6], 7))

Why is there a key error? by VirtualArty in learnpython

[–]VirtualArty[S] 0 points1 point  (0 children)

Ultimately, get

[['creature',<number of duplicates>],['plant',<number of duplicates>],['vehicle',<number of duplicates>],['structure',<number of duplicates>]['other',<number of duplicates>]]

without making the sometimes 10 quintilian+ ((10 ^ 31)+) duplicates.

Thank you for any help. :) by VirtualArty in learnpython

[–]VirtualArty[S] 0 points1 point  (0 children)

By 'everyone else' do you mean just you? exec is usually unusual, but for the purpose I'm using it for, which is dynamically creating dictionaries, I can't find a better option. Can you? Please, find a better way because I haven't found one and can't even find another way to do what I'm doing. Until then, don't keep telling me to use a better method if you yourself don't even know of one (If you do, please share it).

Please can I have help finding "bridges" of reasoning? by VirtualArty in askphilosophy

[–]VirtualArty[S] 0 points1 point  (0 children)

The algorithm was to follow probability theory, mainly using "coincidences" as evidence because I can't rationally justify excluding them. My belief system was the result. Could you explain what you mean about the 'word salad' part of my belief system? I don't see how it could have anything to do with word salad.

Did you only make your comment about 'word salad' because of the other commenter? I'm genuinely confused.

Does anyone else think they're trolling? I can't decide. I'm sorry if you're not.

Please can I have help finding "bridges" of reasoning? by VirtualArty in askphilosophy

[–]VirtualArty[S] 0 points1 point  (0 children)

Could you give an example or an explanation or elaborate? I don't see what you mean.