syntax-error

Updated Python Starred Expressions Error in Numpy Indexing

Updated Python Starred Expressions Error in Numpy Indexing Question: I have some code that I have been running in Python 3.6, but when I move to Python 3.9 I recieve the below error: SyntaxError: can’t use starred expression here I understand some syntax related to expressions of the form (*something) was implemented in 3.9 that …

Total answers: 1

How to detect #N/A in a data frame (data taken from xlsx file) using pandas?

How to detect #N/A in a data frame (data taken from xlsx file) using pandas? Question: The blank cells with no data can be checked with: if pd.isna(dataframe.loc[index_name, column_name] == True) but if the cell has #N/A, the above command does not work nor dataframe.loc[index, column_name] == ‘#N/A’. On reading that cell, it shows NaN, …

Total answers: 1

Cannot import name 'get_cloud_client' from 'gretel_client'

Cannot import name 'get_cloud_client' from 'gretel_client' Question: I keep getting the error Cannot import name ‘get_cloud_client’ from ‘gretel_client’ when I import using from gretel_client import get_cloud_client client = get_cloud_client(prefix="api", api_key="prompt") client.install_packages() I have followed all documentation and tutorials which say to just install using !pip install -U gretel-client and I have checked that the package …

Total answers: 1

SytanxError with sg. argument from PySimpleGUI in Python

SytanxError with sg. argument from PySimpleGUI in Python Question: I want to make a widget window, but the Bottom and Text part aren’t working properly and it keps getting sintax errors at the same part: import PySimpleGUI as sg layout = [ [sg.Text("Hello from PySimpleGUI")], [sg.Button("Close")] window = sg.Window("Demo, layout") ] while true: event, values …

Total answers: 2

Checking conditionals Python

Checking conditionals Python Question: Hi I am stuck on a question. I am new to coding and in order to attend a bootcamp I need to answer some questions. Nothing I write works, I always get a syntax error. This is the question: At your school, the front gate is locked at night for safety. …

Total answers: 4

I`m stuck in this code. Always getting an error when I`m trying to execute this code. (I`m beginner in python)

I`m stuck in this code. Always getting an error when I`m trying to execute this code. (I`m beginner in python) Question: Current Code: weight_lbs=float(input("How much do you weigh(lbs)? : " )) weight_kg=float(input("My weight is " + weight_lbs/2.205 + "kg")) print(weight_kg) Error Message: Traceback (most recent call last): File "<string>", line 9, in <module> TypeError: can …

Total answers: 3

Why does my python code run perfectly fine on runestone but not on vscode?

Why does my python code run perfectly fine on runestone but not on vscode? Question: def CreditPay(rate, payment, verbose): balance = 1000 # Amount currently owed month = 1 #Number of months paid = 0 # Amount paid so far while balance > payment: balance = balance + balance*rate/100 – payment paid += payment if …

Total answers: 2

python throws an error on different parts of the code as "invalid syntax"

python throws an error on different parts of the code as "invalid syntax" Question: I’m writing code for my discord bot on discord.py. At one point, he began to give a "syntax invalid" error for everything, even if he hadn’t done it before. The last two versions of the code and errors: @client.command(aliases = [‘balance’, …

Total answers: 1

Python Syntax Error : Invalid Syntax in My Code

Python Syntax Error : Invalid Syntax in My Code Question: I am getting errors in my code. Please Help me, I am trying to hit the given api in the code. msgid = 123 obj = f"{"inline_keyboard": [[{"text": "Rename","callback_data": "/rename_link_start {msgid}"}]]}" obj2 = urllib.parse.quote_plus(obj) hit = requests.get(f"https://api.telegram.org/bot{token}/sendMessage?chat_id={id}&text=streaam&reply_markup={obj}" Error: Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", …

Total answers: 4