- 2

help with variables

its 13.3 my problem, i have understand value of "x" and "y" ... i have unterstand the command print (x) ... but i havent understand how i get 1 string with both ...example: x="Jay" y="30" output : Jay have 30 years old i can get this output without variables, only with print :(

3rd Nov 2021, 9:06 PM
andrea vitale
andrea vitale - avatar
4 Respostas
+ 2
13.3 what course?
3rd Nov 2021, 9:50 PM
Solo
Solo - avatar
0
im not understand the concept of variables
3rd Nov 2021, 10:03 PM
andrea vitale
andrea vitale - avatar
0
andrea vitale A variable is used to store data and data maybe of type integer, String or float. For example x = 10 # this is integer y = "AJ" #this is string, anything which is inside double quotes or single quotes that would be String z = 20.20 this is float If you have integer value and string value and you want to concat both then you have to first convert integer to string because you can't directly concat integer and string value, you will get type error. So to convert integer in string use str function so if x = "Jay" and y = 30 then print (x + str(y)) #this will print Jay30
4th Nov 2021, 3:20 AM
A͢J
A͢J - avatar
- 1
ok thanks... lesson 13.3 i have resolve with: name= jay age=20 print(name +" have only" + age + "years old")
4th Nov 2021, 1:50 PM
andrea vitale
andrea vitale - avatar