ungleich-learning-circle/sami/learn-python-the-hard-way/python.org
2020-05-20 16:28:40 +02:00

1.1 KiB

Python

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