0
How do i add my firstname and lastname and print it out on (pycharm) python?
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.
+ 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)
+ 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.
+ 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?
0
There's no def. It wont print on pycharm IDE
0
Okay it worked
0
I know how to do it that way
0
I was thinking of something different...maybe giving it a function and adding the two strings together then print.