python – TypeError: argument of type ‘float’ is not iterable

tenho um programa, e sempre que vou rodar imprime

TypeError: argument of type ‘float’ is not iterable

O que isso siginifica?

class CCorrente:
    def __init__(self, **D):
        self.numConta = D.pop('nc', '------ -')
        self.cliente = D.pop('cli', 'Não informado')
        self.__saldo = D.pop('s', 0.00)
    def getSaldo(self):
        return self.__saldo
    def fazSaque(self, saque):
        if saque in self.__saldo:
    def fazDeposito(self, deposito):
        if deposito not in self.__saldo:
class Cliente:
    def __init__(self, **D):
        self.codigo   = D.pop('cod','--')
        self.nome     = D.pop('n','--')
        self.fone     = D.pop('fone','(--) ----- ----')     = D.pop('dt','--/--/----')
        self.Endereco = D.pop('end','--')
        self.Cidade   = D.pop('cid','--')
        self.UF       = D.pop('uf','--')

c = Cliente(cod = 44, n= 'Juan Carlos', fone ='(41)9 93356-8903',
                   dt ='10/04/2021', end = 'Rua X,123', cid ='Curitiba',
                       uf = 'Pr', tipo = 'PF')
conta1 = CCorrente(nc= '127830-0', cli = c, s = 231.00)
saque = conta1.fazSaque(20.00)
for s in conta1.__saldo():    

r language question: Error in terms.formula(formula, data = data) : ‘.’ in formula and no ‘data’ argument

i’m using
to do random forest

   >sample = sample.split(processed_cleveland$num, SplitRatio = .75)

   >train = subset(processed_cleveland, sample == TRUE)

    >test  = subset(processed_cleveland, sample == FALSE)

    >rf <- randomForest(
         num ~ .,

And then it shows

   >Error in terms.formula(formula, data = data) : 
       '.' in formula and no 'data' argument

I don’t know how to resolve it

typescript – Force argument object with a certain key

This seems like something fairly simple, but I have tried searching it multiple ways and couldn’t find an answer.

I want to specify a type for an argument that allows any objects that contain a certain key, like this:

type Action = {type : string};
function reducer(state : object, action : object extends Action) {

Something like this, but this syntax doesn’t work. That is, I want the action argument only to accept objects that contain the key “type” that is a string. If I just do this:

function (state : object, action : {type : string}) {...};

The function only accepts objects that only have the key “type”. How can I achieve this?

Thanks in advance.

entities – How to expand NodeForm so new argument can passed to it

I have a content type called service request, which have some conditional fields that each might appear or disappear based on an other field value called service type.

I have used conditional field and they work just right but for better user experience I want node form to be called using one of the service types.

so I tried to follow this instructions provided by Jaypan to extend NodeForm, but when overriding form function of NodeForm, it leads to Error: Call to a member function getEntityTypeId() on null in DrupalCoreEntityEntityForm->getBaseFormId()

this is how I used to create $form:

class ServiceBuilderForm extends NodeForm {
   * {@inheritdoc}
  public function form(array $form, FormStateInterface $form_state, $serviceType = NULL) {
    // Added as a fallback in case a developer uses this form without passing
    // $someId:
    if (is_null($serviceType)) {
      $form = (
        '#prefix' => '<p class="error">',
        '#suffix' => '</p>',
        '#markup' => $this->t('Form is missing Service Type which is required'),
    else {
      $form = parent::form($form, $form_state);
      // Do something with $form and $some_id

    return $form;

and in my Controller I have get my form using:

$form = Drupal::formBuilder()->getForm('Drupal{my_module}FormServiceFormBuilder', $serviceType);

javascript – the easiest way to assign a function call to another with an extra argument

I have a function call like :

externals: (ctx, request, callback) => externalsHandler(ctx, request, callback, ('a', 'b'))

as you can see, I’m calling a function inside externals and passing all of its arguments plus one array

I want to know if there is an easier way to do that.

one thing i found working is:

externals: (...args) => externalsHandler(...args, ('a', 'b'))

Is there any way to write this simpler?

integration – Definite Gaussian integral of error function with even powers in the argument

I am trying to solve the following definite integral,

$int_{-infty}^{infty} dx , phi(x) x^2 Phi( a + bx)$


$phi (x) = frac{1}{sqrt{2 pi}} exp(-x^2/2)$ and $Phi(x)$ is defined as,
$Phi(x) = int_{-infty}^{x} phi(x) = frac{1}{2}left(1 + erfc left(frac{x}{sqrt{2}} right) right)$

I have looked in tables, but I don’t seem to find an answer.

Could someone help?


How do I convert the argument of a dirac delta function from cartesian coordinates to spherical coordinates?

I have V(x)=Aδ(x) where I needed to convert the argument from cartesian to spherical, namely from δ(x) to δ(r) so I can compute an integral involving V in dr. I don’t understand the dirac delta quite well so I have little idea how to do this. Any help would be greatly appreciated. Thanks!

algorithm – Returning a vector having squared, sorted (ascending) of the argument (vector)

struct Solution {
nums: Vec<i32>,

impl Solution {
    pub fn sorted_squares(nums: Vec<i32>) -> Vec<i32> {
        let mut b: Vec<i32> = nums.iter().map(|x| x * x).collect();

fn main() {
    let a = Solution {
        nums: (12, 1, 2, 3, 4, 6, 9).to_vec(),

    let mut b: Vec<i32> = Solution::sorted_squares(a.nums);

    println!("{:?}", b);

What should be done so that .sort_unstable() return value be converted into vector to return to the function.
Please review and make suggestions

Proving the following argument is valid

“Farmer Bob builds a fence. If Farmer Bob doesn’t own cows, then he doesn’t
build a fence. If Farmer Bob owns cows, then he sells milk or he sells beef. Farmer
Bob doesn’t sell milk. Therefore, Farmer Bob sells beef.”

H(x): Farmer Bob builds a fence
S(x): Farmer Bob owns cows
P(x): Farmer Bob sells milk
L(x): Farmer Bob sells beef
  1. H
  2. $lnot$S $to$ $lnot$H
  3. S $to$ (P $lor$ L)
  4. $lnot$P
  5. $therefore$ L

Here’s my proof

  1. S (Modus Tollens: 1, 2)
  2. P $lor$ L (Modus Ponens: 6, 3)
  3. L (Rule of Disjunctive Syllogism: 7, 4)

I’m pretty new to doing proofs and was hoping someone could let me know if I’m doing this correctly. Thanks

Error: fatorial() takes 1 positional argument but 2 were given

from threading import Thread
import time

class variaveis():
    name = 0
    valor = 0

def informa(vetor):
    variavel = variaveis()
    qnt = int(input('Quantos cálculos? '))
    for i in range(1, qnt + 1): = i
        n = int(input('{}° Fatorial: '.format(i)))
        variavel.valor = n
    return vetor

def fatorial(vetor):
    for i in range(len(vetor)):
        print('Thread',vetor(i).name, "iniciou!")
        fat = 1
        while vetor(i).valor > 1:
            fat *= vetor(i).valor
            vetor(i).valor -= 1
            print('Thread',vetor(i).name, "-", vetor(i).valor + 1, "(cálculo iteração:",fat,')')
    print('Thread',vetor(i).name, "Resultado",fat)

def inicia_thread(vetor):
# define as threads
    for i in range(len(vetor)):
        # Inicia as threads
        Thread(target=fatorial, args=("Thread {}".format(vetor(i).name), vetor(i).valor)).start()

def main():
    vet = ()
    vet = informa(vet)