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 new file mode 100644 index 0000000..1e41507 Binary files /dev/null and b/sami/learn-python-the-hard-way/.learn-python3-the-hard-way-nov-15-2018.pdf.swp differ diff --git a/sami/learn-python-the-hard-way/ex10.py b/sami/learn-python-the-hard-way/ex10.py new file mode 100644 index 0000000..744662c --- /dev/null +++ b/sami/learn-python-the-hard-way/ex10.py @@ -0,0 +1,16 @@ +tabby_cat = "\tI'm tabbed in." +persian_cat = "I'm split\non a line." +backslash_cat = "I'm \\ a \\ cat." + +fat_cat = """ +I'll do a list: +\t* Cat food +\t* Fishies +\t* Catnip\n\t* Grass + +""" + +print(tabby_cat) +print(persian_cat) +print(backslash_cat) +print(fat_cat) diff --git a/sami/learn-python-the-hard-way/ex11.py b/sami/learn-python-the-hard-way/ex11.py new file mode 100644 index 0000000..18fb0cf --- /dev/null +++ b/sami/learn-python-the-hard-way/ex11.py @@ -0,0 +1,8 @@ +print("How old are you?", end=' ') +age = input(29) +print("How tall are you?", end=' ') +height = input(180) +print("How much do you weigh?", end=' ') +weight = input(78) + +print(f"So, you're {age} old, {height} tall and {weight} heavy.") diff --git a/sami/learn-python-the-hard-way/ex12.py b/sami/learn-python-the-hard-way/ex12.py new file mode 100644 index 0000000..de14447 --- /dev/null +++ b/sami/learn-python-the-hard-way/ex12.py @@ -0,0 +1,6 @@ +age = input("How old are you? 27 years old ") +height = input("How tall are you? 1.80m ") +weight = input("How much do you weigh?78kg ") + + +print(f"So, you're {age} old, {height} tall and {weight} heavy.") diff --git a/sami/learn-python-the-hard-way/ex13.py b/sami/learn-python-the-hard-way/ex13.py new file mode 100644 index 0000000..c9bccd9 --- /dev/null +++ b/sami/learn-python-the-hard-way/ex13.py @@ -0,0 +1,10 @@ +#Parameters, Unpacking, Variables + +from sys import argv +# read the WYSS section for how to run this +script, first, second, third = argv + +print("The script is called:", script) +print("Your first variable is:", first) +print("Your second variable is:", second) +print("Your third variable is:", third) diff --git a/sami/learn-python-the-hard-way/ex8.py b/sami/learn-python-the-hard-way/ex8.py new file mode 100644 index 0000000..1489912 --- /dev/null +++ b/sami/learn-python-the-hard-way/ex8.py @@ -0,0 +1,13 @@ +formatter = "{} {} {} {}" + +print(formatter.format(1, 2, 3, 4)) +print(formatter.format("one", "two", "three", "four")) +print(formatter.format(True, False, False, True)) +print(formatter.format(formatter, formatter, formatter, formatter)) +print(formatter.format( +"Try your", +"Own text here", +"Maybe a poem", +"Or a song about fear" + +)) diff --git a/sami/learn-python-the-hard-way/ex9.py b/sami/learn-python-the-hard-way/ex9.py new file mode 100644 index 0000000..5572d8e --- /dev/null +++ b/sami/learn-python-the-hard-way/ex9.py @@ -0,0 +1,15 @@ +# Here's some new strange stuff, remember type it exactly. + +days = "Mon Tue Wed Thu Fri Sat Sun" +months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug" + +print("Here are the days: ", days) +print("Here are the months: ", months) + + +print(""" +There's something going on here. +With the three double-quotes. +We'll be able to type as much as we like. +Even 4 lines if we want, or 5, or 6. +""")