I need help with this bit of code: /u/Disastrous_Talk_4888 Python Education

Hi, I’m doing a personal proyect to attempt to learn more the language and currently I’m stuck with this:

 cuentaAh = CuentaAhorros datosUsuarios = [] case 1: nombreCuenta = input(f"Insert a name for the user with id {idU}: ") balanceNew = float(input("Balance of the account: ")) metodoRecuperacion = input("Insert recovery method(Phone/Email): ").capitalize() nuevacuenta = cuentaAh(nombreCuenta,balanceNew,metodoRecuperacion) datosUsuarios.append({f"id": {idU} , "account": {nuevacuenta}, "interests": {nuevacuenta.tasaInteres}}) idU+=1 case 2: buscaID = int(input("ID a buscar: ")) for value in datosUsuarios: if buscaID == value["id"]: print(f"ID: {value['id']}, Interests:{value['account'].tasaInteres}") 

The main issue that I currently have is with the case 2, in which after adding an object to a list, I’m unable to print, I’ve tried it in many ways, but it doesn’t seem to work meanwhile when others bit of code whenever I do:

 case 4: try: buscaID = int(input("ID a buscar: ")) for value in datosUsuarios: if buscaID == value["id"]: print(f"Data of the account:") print(f"ID: {idU}") print(f"Account Details: {value["account"]}") deposito = float(input("Withdraw: ")) value["account"].retirar(deposito) print(f"The new balance is: {value["account"].balance}") 

I’m able to print and access the attributes held in the object so I do not know what I’m doing wrong.

PS: The code is far larger , I have selected this since these are giving me the issues which are that the data that I’m trying to access is not being printed in case 2 meanwhile in case 4 it’s able.

submitted by /u/Disastrous_Talk_4888
[link] [comments]

​r/learnpython Hi, I’m doing a personal proyect to attempt to learn more the language and currently I’m stuck with this: cuentaAh = CuentaAhorros datosUsuarios = [] case 1: nombreCuenta = input(f”Insert a name for the user with id {idU}: “) balanceNew = float(input(“Balance of the account: “)) metodoRecuperacion = input(“Insert recovery method(Phone/Email): “).capitalize() nuevacuenta = cuentaAh(nombreCuenta,balanceNew,metodoRecuperacion) datosUsuarios.append({f”id”: {idU} , “account”: {nuevacuenta}, “interests”: {nuevacuenta.tasaInteres}}) idU+=1 case 2: buscaID = int(input(“ID a buscar: “)) for value in datosUsuarios: if buscaID == value[“id”]: print(f”ID: {value[‘id’]}, Interests:{value[‘account’].tasaInteres}”) The main issue that I currently have is with the case 2, in which after adding an object to a list, I’m unable to print, I’ve tried it in many ways, but it doesn’t seem to work meanwhile when others bit of code whenever I do: case 4: try: buscaID = int(input(“ID a buscar: “)) for value in datosUsuarios: if buscaID == value[“id”]: print(f”Data of the account:”) print(f”ID: {idU}”) print(f”Account Details: {value[“account”]}”) deposito = float(input(“Withdraw: “)) value[“account”].retirar(deposito) print(f”The new balance is: {value[“account”].balance}”) I’m able to print and access the attributes held in the object so I do not know what I’m doing wrong. PS: The code is far larger , I have selected this since these are giving me the issues which are that the data that I’m trying to access is not being printed in case 2 meanwhile in case 4 it’s able. submitted by /u/Disastrous_Talk_4888 [link] [comments] 

Hi, I’m doing a personal proyect to attempt to learn more the language and currently I’m stuck with this:

 cuentaAh = CuentaAhorros datosUsuarios = [] case 1: nombreCuenta = input(f"Insert a name for the user with id {idU}: ") balanceNew = float(input("Balance of the account: ")) metodoRecuperacion = input("Insert recovery method(Phone/Email): ").capitalize() nuevacuenta = cuentaAh(nombreCuenta,balanceNew,metodoRecuperacion) datosUsuarios.append({f"id": {idU} , "account": {nuevacuenta}, "interests": {nuevacuenta.tasaInteres}}) idU+=1 case 2: buscaID = int(input("ID a buscar: ")) for value in datosUsuarios: if buscaID == value["id"]: print(f"ID: {value['id']}, Interests:{value['account'].tasaInteres}") 

The main issue that I currently have is with the case 2, in which after adding an object to a list, I’m unable to print, I’ve tried it in many ways, but it doesn’t seem to work meanwhile when others bit of code whenever I do:

 case 4: try: buscaID = int(input("ID a buscar: ")) for value in datosUsuarios: if buscaID == value["id"]: print(f"Data of the account:") print(f"ID: {idU}") print(f"Account Details: {value["account"]}") deposito = float(input("Withdraw: ")) value["account"].retirar(deposito) print(f"The new balance is: {value["account"].balance}") 

I’m able to print and access the attributes held in the object so I do not know what I’m doing wrong.

PS: The code is far larger , I have selected this since these are giving me the issues which are that the data that I’m trying to access is not being printed in case 2 meanwhile in case 4 it’s able.

submitted by /u/Disastrous_Talk_4888
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *