diff --git a/sami/learn-python-the-hard-way/.learn-python3-the-hard-way-nov-15-2018.pdf.swp b/sami/learn-python-the-hard-way/.learn-python3-the-hard-way-nov-15-2018.pdf.swp deleted file mode 100644 index 1e41507..0000000 Binary files a/sami/learn-python-the-hard-way/.learn-python3-the-hard-way-nov-15-2018.pdf.swp and /dev/null differ diff --git a/sami/learn-python-the-hard-way/ex14.py b/sami/learn-python-the-hard-way/ex14.py new file mode 100644 index 0000000..d6fe2ba --- /dev/null +++ b/sami/learn-python-the-hard-way/ex14.py @@ -0,0 +1,21 @@ +from sys import argv + +script, user_name = argv +prompt = '> ' + +print(f"Hi {user_name}, I'm the {script} script.") +print("I'd like to ask you a few questions.") +print(f"Do you like me {user_name}?") +likes = input(prompt) + +print(f"Where do you live {user_name}?") +lives = input(prompt) + +print("What kind of computer do you have?") +computer = input(prompt) + +print(f""" +Alright, so you said {likes} about liking me. +You live in {lives}. +And you have a {computer} computer. + """) diff --git a/sami/learn-python-the-hard-way/python.org b/sami/learn-python-the-hard-way/python.org index eb95b25..510c220 100644 --- a/sami/learn-python-the-hard-way/python.org +++ b/sami/learn-python-the-hard-way/python.org @@ -2,3 +2,27 @@ ** Numbers and Math: Every programming language has some kind of way doing numbers and math ** Variables and Names : we need to use underscore with means an imaginary space between words in variable names ** a variable is nothing more than a name for something. + + +* Ex6 String and Text +** A string is usually a bit of text you want to display to someone or ”export” out of the program you are +writing +** Python knows you want something to be a string when you put either " (double-quotes) or ' +(single-quotes) around the text + + +* Ex7 More Printing +** sometimes you cant use f string, f string can also be used as .format and pass it to variables +*** Example + - print("Its fleece was white as {}.".format('snow')) + - print(f"Its fleece was white as {'snow'}." + +** You can multiply strings by a number +*** print ("." * 10) this will extend the string which is the . 10 times + +** You can also combine strings +*** - print(end1 + end2 + end3 + end4 + end5 + end6, end=' ') + - print(end7 + end8 + end9 + end10 + end11 + end12) + +* Ex8 Printing, Printing +**