how to declare variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to declare variables

30th Sep 2016, 2:58 PM
Bharghavi Ganesan
Bharghavi Ganesan - avatar
4 Answers
+ 2
In the course, Basic Concepts module 10: Variables. Basically assign something a value. like... a=1 edit: Thomas's answer looks better :)
30th Sep 2016, 3:38 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
in python you can declare variables everywhere, just make sure you do so before using the variable ex: a=5 print(a) not: print(a) a=1
30th Sep 2016, 4:26 PM
POZEIDON Thomas
POZEIDON Thomas - avatar
+ 1
In the beginning of the program declare the variables for eg, x=10 print(x)
1st Oct 2016, 2:49 AM
Balach Raza
Balach Raza - avatar
+ 1
You don't have to declare it separately. You need to initialise it anywhere in the code before you print the variable.
12th Oct 2016, 5:02 PM
Priyanka Sahu
Priyanka Sahu - avatar