ex14
This commit is contained in:
parent
ed8222535a
commit
d2e57f15f2
Binary file not shown.
|
@ -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.
|
||||||
|
""")
|
|
@ -2,3 +2,27 @@
|
||||||
** Numbers and Math: Every programming language has some kind of way doing numbers and math
|
** 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
|
** 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.
|
** 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
|
||||||
|
**
|
||||||
|
|
Loading…
Reference in New Issue