bookmate game
en
Chris Sheridan

Learn Python In a Weekend, Python for Beginners

Értesítsen, ha a könyv hozzá lesz adva
Ennek a könyvnek az olvasásához töltsön fel EPUB vagy FB2 formátumú fájlt a Bookmate-re. Hogyan tölthetek fel egy könyvet?
  • b9510430212idézett5 évvel ezelőtt
    use square brackets [ ] when declaring a list.
  • b9510430212idézett5 évvel ezelőtt
    The %f formatter is used to format floats (numbers with decimals). Here we format it as %4.2f where 4
  • b9510430212idézett5 évvel ezelőtt
    brand = ‘Apple’ exchangeRate = 1.235235245
    message = ‘The price of this %s laptop is %d USD and the exchange rate is %4.2f USD to 1 EUR’ %(brand, 1299, exchangeRate)
  • b9510430212idézett5 évvel ezelőtt
    Peter’.upper() will give us the string “PETER
  • b9510430212idézett5 évvel ezelőtt
    Peter” + “Lee” is equivalent to the string “PeterLee”
  • b9510430212idézett5 évvel ezelőtt
    To declare a string, you can either use variableName = ‘initial value’ (single quotes) or variableName = “initial value” (double quotes)
  • b9510430212idézett5 évvel ezelőtt
    Instead of writing x = x + 2, we can also write x += 2
  • b9510430212idézett5 évvel ezelőtt
    Modulus: x%y = 1 (gives the remainder when 5 is divided by 2)
  • b9510430212idézett5 évvel ezelőtt
    variable names are case sensitive. username is not the same as userName
  • b9510430212idézett5 évvel ezelőtt
    We can also define multiple variables at one go. To do that simply write
    userAge, userName = 30, ‘Peter’
    This is equivalent to
    userAge = 30 userName = ‘Peter
fb2epub
Húzza és ejtse ide a fájljait (egyszerre maximum 5-öt)