LearnPythonTheHardWay2ndEdition

Go to https://www.python.org/downloads/release/python-360/ and download the version titled“Mac OS X 64-bit/32-bit installer.” Install it like you would any other software. 

In your Terminal program, run python3.6. You run things in Terminal by just typing the nameand hitting RETURN.

Type quit(), Enter, and get out of python3.6.

Strings can contain any number of variables that are in your Python script. Remember that a vari-able is any line of code where you set a name = (equal) to a value. In the code for this exercise,types_of_people = 10 creates a variable named types_of_people and sets it = (equal) to 10.You can put that in any string with {types_of_people}. You also see that I have to use a special typeof string to “format”; it’s called an “f-string” and looks like this:

    f"some stuff here {avariable}"
    f"some other stuff {anothervar}"
  1. print("." * 10

  1. end1 = "C"

  2. 7  end2 = "h"

  3. 8  end3 = "e"

  4. 9  end4 = "e"

  5. 10  end5 = "s"

  6. 11  end6 = "e"

  7. 12  end7 = "B"

  8. 13  end8 = "u"

  9. 14  end9 = "r"

  10. 15  end10 = "g"

  11. 16  end11 = "e"

  12. 17  end12 = "r"

18

  1. 19  # watch end = ' ' at the end. try removing it to see what happens

  2. 20  print(end1 + end2 + end3 + end4 + end5 + end6, end=' '

 create a class :

class MyStuff(object):def __init__(self):

self.tangerine = "And now a thousand years between"

def apple(self):
print("I AM CLASSY APPLES!"


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值