Kanta: переводы
Learn Python The Hard Way / Трудный Путь Изучения Python
→Study Drills
0 Упражнения:
→What You Should See
$ python ex8.py
1 2 3 4
'one' 'two' 'three' 'four'
True False False True
'%r %r %r %r' '%r %r %r %r' '%r %r %r %r' '%r %r %r %r'
'I had this thing.' 'That you could type up right.' "But it didn't sing." 'So I said goodnight.'
$ python ex8.py
1 2 3 4
'one' 'two' 'three' 'four'
True False False True
'%r %r %r %r' '%r %r %r %r' '%r %r %r %r' '%r %r %r %r'
'I had this thing.' 'That you could type up right.' "But it didn't sing." 'So I said goodnight.'
0 Что вы должны увидеть
$ python ex8.py
1 2 3 4
'one' 'two' 'three' 'four'
True False False True
'%r %r %r %r' '%r %r %r %r' '%r %r %r %r' '%r %r %r %r'
'I had this thing.' 'That you could type up right.' "But it didn't sing." 'So I said goodnight.
$ python ex8.py
1 2 3 4
'one' 'two' 'three' 'four'
True False False True
'%r %r %r %r' '%r %r %r %r' '%r %r %r %r' '%r %r %r %r'
'I had this thing.' 'That you could type up right.' "But it didn't sing." 'So I said goodnight.
→formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
0 formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
→Exercise 8: Printing, Printing
0 Урок 8. Печать, печать
→Is it bad that my errors are always spelling mistakes?
Most programming errors in the beginning (and even later) are simple spelling mistakes, typos, or getting simple things out of order.
Most programming errors in the beginning (and even later) are simple spelling mistakes, typos, or getting simple things out of order.
0 Это плохо, если я постоянно получаю ошибки из-за опечаток?
Большинство ошибок в коде поначалу (да и позже) это простые опечатки, или простые вещи не в том порядке.
Большинство ошибок в коде поначалу (да и позже) это простые опечатки, или простые вещи не в том порядке.
→Why do I get an error when I put spaces between the three double-quotes?
You have to type them like """ and not " " ", meaning with no spaces between each one.
You have to type them like """ and not " " ", meaning with no spaces between each one.
0 Почему я получаю ошибку, если вставляю пробелы между двойными кавычками?
Вы должны печатать их вот так """ а не вот так " " " , то есть без пробелов между ними.
Вы должны печатать их вот так """ а не вот так " " " , то есть без пробелов между ними.
→What You Should See
$ python ex9.py
Here are the days: Mon Tue Wed Thu Fri Sat Sun
Here are the months: Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
$ python ex9.py
Here are the days: Mon Tue Wed Thu Fri Sat Sun
Here are the months: Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
0 Что вы должны увидеть
$ python ex9.py
Here are the days: Mon Tue Wed Thu Fri Sat Sun
Here are the months: Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
$ python ex9.py
Here are the days: Mon Tue Wed Thu Fri Sat Sun
Here are the months: Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
→days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
0 days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
→print "Here are the days: ", days
print "Here are the months: ", months
print "Here are the months: ", months
0 print "Here are the days: ", days
print "Here are the months: ", months
print "Here are the months: ", months
→print """
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""
0 print """
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""
→Why do the \n newlines not work when I use %r?
That's how %r formatting works; it prints it the way you wrote it (or close to it). It's the "raw" format for debugging.
That's how %r formatting works; it prints it the way you wrote it (or close to it). It's the "raw" format for debugging.
0 Почему новые строки, начнающиеся с \n, не работают, если я использую %r ?
Так работает форматирование c помощью %r ; Оно печатает то, что вы напишете (или близко к тому). Это "сырой" формат для дебаггинга.
Так работает форматирование c помощью %r ; Оно печатает то, что вы напишете (или близко к тому). Это "сырой" формат для дебаггинга.
→"\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
0 "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
→Common Student Questions
What if I wanted to start the months on a new line?
You simply start the string with \n like this:
What if I wanted to start the months on a new line?
You simply start the string with \n like this:
0 Типичные вопросы:
А что если я хочу, чтобы месяцы начинались с новой строки?
Просто начните строку с \n , вот так:
А что если я хочу, чтобы месяцы начинались с новой строки?
Просто начните строку с \n , вот так:
→Study Drills
Do your checks of your work, write down your mistakes, try not to make them on the next exercise.
Do your checks of your work, write down your mistakes, try not to make them on the next exercise.
0 Упражнения:
Проверьте свою работу, выпишите ошибки, и постарайтесь в следующем уроке их не делать.
Проверьте свою работу, выпишите ошибки, и постарайтесь в следующем уроке их не делать.
→There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
0 А здесь что-то происходит.
С тремя двойными кавычками.
Мы можем печатать столько, сколько захотим.
Даже 4 строки подряд, если захотим, или 5, или 6
С тремя двойными кавычками.
Мы можем печатать столько, сколько захотим.
Даже 4 строки подряд, если захотим, или 5, или 6
→Exercise 9: Printing, Printing, Printing
0 Урок 9: Печать, печать, печать
→# Here's some new strange stuff, remember type it exactly.
0 # Вот немного странного кода, наберите его точно как тут
Резюме
- Пол:
- мужчина
- Родной язык:
- русский
- С нами:
- с 10 апреля 2013 г. (4939 дней)
- Деятельность:
-
2262 версии перевода
с общим рейтингом 0
129 комментариев
Карма: 1 (оценок: 1)
