Help on Syntax


#1



https://www.codecademy.com/courses/introduction-to-python-6WeG3/0/3?curriculum_id=4f89dab3d788890003000096


Why is this not correct


Replace this line with your code.


#2

The link leads us to our own code. Best to post your full code here :slight_smile:


#3

Hi
This is what it says.
I don’t get what I did incorrectly.


#4

instead of typing to the value literally, use the assignment operator instead, which is =

i.e:
int = 7

hope this help, cheers!


#5

Hello Guys,

in "my_float = 1.23" can anyone explain why we write 'my_float' and its value as '1.23' ?
I'm new to coding, guide me guys.


#6

Mostly it's because the instructions tell you to do so. But in terms of programming, anything with decimals is considered a float in general terms.

You assign variables by using the = sign with a name on the left side and a value on the right side of it. It is best practice to name the variables something meaningful so that if you write a long piece of code, you won't get confused as to what those variables mean (you can name the variables whatever you want when you work on something yourself). Such as

my_name = "John"

instead of just

x = "John"

In terms of this, it's meaningful to assign a variable name called my_float to a float.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.