forked from MrBlaise/learnpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput_name.py
More file actions
31 lines (21 loc) · 908 Bytes
/
input_name.py
File metadata and controls
31 lines (21 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# The program ask for the user's name
# Greets the user using his name
def main(): # Wrapper function
name = input('What is your name? ') # Asks for a string - name
print('Hello ', name, '! How are you?', sep='', end='\n')
# PRINT FUNCTION
# SEP
# The 'sep' argument in Python 3 will seperate the text
# with the given character, since now I want an exclamation mark
# after 'name' I don't like to have any space between that,
# so I set 'sep' to be nothing.
# END
# The 'end' argument is what the program prints
# after the print function.
# By default is '\n' (newline)
# so you don't need to put that there, however
# there are some cases when you don't want a newline after
# every print function, so this is good to know.
if __name__ == '__main__':
main()