+ 4

Whats the difference between string and print?

hi guys whats the differen between a string an a print? why would i use print to echo it out if i can just write it down to echo it out?

15th Jan 2017, 3:07 PM
pietje hatje
pietje hatje - avatar
6 Réponses
+ 7
a string is a type of value. 1 is an integer. 3.5 is a float. 'hello' is a string. print means, like you said, a way to show things on your screen. they don't have anything in common though, and you can use string to transform numbers into words and add them together to form numbers such as print(str(1)+str(2)) #12 print(1+2) #3
15th Jan 2017, 9:07 PM
Badmephisto
Badmephisto - avatar
+ 5
print() is a function only, displays something; string is first of all data type, secondary - func to convert any other type into string. Syntax: str(non_string_var). example: number = 10 string = "spam" print(number*3) #30 print(string*3) #spamspamspam test = number + string #error test = str(number) + string #10spam test = number + int(string) #error
17th Jan 2017, 7:15 PM
Алексей БутылкУс
Алексей БутылкУс - avatar
+ 2
A string is something that you can use to make words in without vars. A print is a function that prints a string, number and or variables.
16th Jan 2017, 1:32 AM
Nate
+ 1
there are three types of data :- 1) integer- it contains whole numbers and variables example- 1,50,a,b,z. 2) floats- it contain decimal values example- 5.5,0.9,6.99. 3)strings- it contains words or a string of alphabets example - name,car,pathway to print the values of any of the above three data types we use the print function:- 1) printing an integer print(5+4) output=9 2) printing a float print(5.0+4.0) output=9.0 3) printing a string print ("path"+"way")
18th Jan 2017, 3:54 AM
vaishali
vaishali - avatar
+ 1
string is an variable and stores text , on the other hand print gives the output of string or output of parameter written in it.
22nd Jan 2017, 11:43 AM
arvinder singh
arvinder singh - avatar
0
lo scroto
30th Jan 2017, 10:25 AM
Luca B.
Luca B. - avatar