Questions tagged [syntax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Ive been getting a syntax error for this Python code. Id appreciate If someone could help me

This is from a python course by mosh The code is this -> import pandas as pd from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn....
0
votes
1answer
14 views

Syntax Highlighting Error

I am working on my mario problem. I write my code in C, but it's not getting highlighted, meaning the program doesn't understand it. How can I get it to understand my code? for example #include is in ...
2
votes
2answers
273 views

Understanding how memory is allocated in driver code PSET 4, Filter (Less Comfortable)?

What does the following line do, step by step (filter.c L:78) RGBTRIPLE(*image)[width] = calloc(height, width * sizeof(RGBTRIPLE)); I am most confused by the syntax of RGBTRIPLE(*image)[width] ...
0
votes
1answer
166 views

Why can't I print the entire string from the read file?

For the DNA assignment in pset6, I'm trying to print out the output of slicing the string that was read from one of the DNA sequence text files, which reads as follows: ...
1
vote
1answer
246 views

cs50 pset7 buy syntax error

i cannot see any syntax error for several days, so if anything can help is highly appropriated here is my code : @app.route("/buy", methods=["GET", "POST"]) @login_required def buy(): """Buy ...
0
votes
1answer
20 views

What is correct syntax when declaring a pointer? (i.e. where to place the *?)

I'm a bit confused as to where to place the * when declaring a new pointer. For example, let's say I've made a linked list and declared a custom structure node. I've noticed when I was making ...
0
votes
1answer
104 views

Problem with && and || operators in credit

Forgive me for the confusing syntax, I am new to coding. My question is simple. In my last statement, >> "else if (digits[15] == 5 (&&) digits[14] == 1 || digits[14] == 2 || digits[14] == 3 || ...
0
votes
1answer
1k views

Mario Less Comfortable, do-while loop problem

Hi everyone I made sure to do my research and go through the already posted questions. I am certain my while condition is wrong after research but don't understand the correction. my program runs but ...
0
votes
0answers
23 views

ps3 fifteen move and won : error : control may reach end of non-void function [-Werror,-Wreturn-type] }

Im so close to finish fifteen. I have a mistake about syntax with the last } for my function Move() and Won(). Here the error message when I compile : fifteen.c:279:1: error: control may reach end of ...
0
votes
1answer
266 views

PSET 6: Caesar.py - stuck on “SyntaxError: invalid syntax”

For my caesar implementation in Python, the CS50 IDE keeps telling me that I have a syntax error at the else portion of my for loop as shown below. Any help would be GREATLY appreciated! Haha, thanks ...
0
votes
1answer
20 views

Why do header files have different symbols in C?

why do we use different syntax for header files in C. I mean, why stdio.h uses greater than and less than symbols < > while bmp.h uses quotation marks " "? #include <stdio.h> #include <...
0
votes
3answers
2k views

python invalid syntax end=“”

The first print line I use , end="" in has a red dot next to it and is marked as invalid syntax. The python code still works with no problems but the invalid syntax is always there. I even copied ...
3
votes
3answers
11k views

MARIO LESS COMFORTABLE

I have been working at this pset for hours. within 5 minutes i got the hello.c and water.c assignments completed. But when it comes to mario.c, I am utterly lost. I have watched every video. I ...
1
vote
1answer
72 views

The syntax “<%- place_name %>” in pset8

To me, it just magically insert the variable into the string for suggestion. I wonder what kind of the syntax is this, any reference? Thanks.
0
votes
1answer
6 views

What's is wrong with this php code

The interpreter won't interpret my code for some syntax error in line 13 and I can't figure out what's the problem. <?php extract($_GET) for($i = 0; $i < key; $i++) ...
0
votes
1answer
94 views

caesar store ascii value as int, in loop

I have tried using single quotes notation to store the ascii value of a char in an int, but only as a hard coded character. I can't get it to work as it loops through the chars in the string. I tried ...
0
votes
1answer
159 views

What does VALUES(shares) refer to in the ON DUPLICATE KEY UPDATE clause?

This is the working snippet: query("INSERT INTO portfolio (id, symbol, shares) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)", $_SESSION['id'], $_POST["...
0
votes
2answers
65 views

How come you can declare variables in C in the middle of a block?

In Week 1 of CS50, I saw that David sir was declaring variables in the middle of the block...Isn't this a violation of the standard C syntax ? Aren't we supposed to declare the variable at the start ...
0
votes
1answer
71 views

php syntax questions

I am having trouble with formatting php correctly. Specifically, when I need to use two sets of double quotes, how do I make it group them correctly? eg: query("INSERT INTO Holdings (id, symbol, ...