Python初学者8号 发表于 2021-8-8 15:54:18

Jetbrains学习计划——zookeeper

本帖最后由 Python初学者8号 于 2021-8-8 16:25 编辑

Multi-line programs First, second, third
Write a program that prints the following three words in a column: first, second, third.


答案是两种 :
人家给的提示是
solution=]我自己写的是:
print('first','second','third',sep='\n')Multi-line programs LinesHow many lines will this code print?
print()
print("Monday")
print("Tuesday Wednesday")
print()
print("Thursday")
注意哦,print()输出的是一个空!!不是空格
>>> a =print()

>>> a
>>> type(a)
<class 'NoneType'>Multi-line programs SquareWrite a program that prints this square out of * symbols.
* * * *
*   *
*   *
* * * *Don't forget about the spaces between the asterisks!


我的答案是
print("* * * * \n*   *\n*   *\n* * * *")还有些可以的答案是:print("* " * 4)
print("*   *")
print("*   *")
print("* " * 4)
print('''
* * * *
*   *
*   *
* * * *
''')Multi-line programs We need to learn Python这里面的一些回答还是很有意思,问题很简单,但是回答很开放


Python初学者8号 发表于 2021-8-8 16:43:11

本帖最后由 Python初学者8号 于 2021-8-8 17:10 编辑

import this
这个有点意思

还有,人家管#叫hash mark

single or double quotes单引号和双引号

Python初学者8号 发表于 2021-8-12 10:04:58

本帖最后由 Python初学者8号 于 2021-8-12 10:07 编辑

Naming variables EverestIn your program, you need a variable to store the height of mount Everest (8, 848 m). There are other heights and other mountains in the program, so you cannot simply call it height . The name of the variable should reflect the fact that the value is constant and refer to the measure and the object.What would be an optimal name for that variable?the_height_of_everest_in_meters
height_of_everest
everest_height
MOUNTAIN_HEIGHT
mount_everest
EVEREST_HEIGHT




最后答案的讨论认为的是,一般变量最好大写???

哦 ,知道 了,就是说,认为的是在不变的变量用大写upercase,比如PI圆周率

Python初学者8号 发表于 2021-8-17 11:30:31

Program with numbersThe first digit of a two-digit number

关于取余数啊,直接用%10很好啊,十进制就可以用这个取个位数
页: [1]
查看完整版本: Jetbrains学习计划——zookeeper