0

How do i add my firstname and lastname and print it out on (pycharm) python?

Print

19th Oct 2019, 4:16 PM
Nasify
8 ответов
+ 3
if you use same sample as from Ipang, its better to use ouput like: first_name = "Alfred" last_name = "Hitchcock" print(first_name, last_name) using the variables in this way, you generate automatically a space between both names, and you don't change the content of the first_name variable.
19th Oct 2019, 6:32 PM
Lothar
Lothar - avatar
+ 3
# you mentioned to do it in a function - here a sample: def print_name(first, last): print(first, last) first_name = "Alfred" last_name = "Hitchcock" print_name(first_name, last_name)
29th Oct 2019, 10:18 AM
Lothar
Lothar - avatar
+ 1
Please put Python in Relevant Tags for the sake of scope clarity 👍 first_name = "Alfred" last_name = "Hitchcock" first_name += last_name print(first_name) You can find this in the lesson and more.
19th Oct 2019, 5:15 PM
Ipang
+ 1
Nasify, it is working on pycharm IDE, as i tested it with pycharm. And what do you mean by "There's no def"? "def" is used to define a function in python. But this code does not necessarily need to have a function. May be you need to go through the python tutorial?
20th Oct 2019, 10:07 AM
Lothar
Lothar - avatar
0
There's no def. It wont print on pycharm IDE
20th Oct 2019, 6:42 AM
Nasify
0
Okay it worked
29th Oct 2019, 9:43 AM
Nasify
0
I know how to do it that way
29th Oct 2019, 9:44 AM
Nasify
0
I was thinking of something different...maybe giving it a function and adding the two strings together then print.
29th Oct 2019, 9:44 AM
Nasify