Skip to content

Comments

Контрольная работа #1#16

Open
Andrew-Kochanov wants to merge 7 commits intopython-course-matmex:mainfrom
Andrew-Kochanov:main
Open

Контрольная работа #1#16
Andrew-Kochanov wants to merge 7 commits intopython-course-matmex:mainfrom
Andrew-Kochanov:main

Conversation

@Andrew-Kochanov
Copy link

Кочанов Андрей Иванович б43

cardNumber = input('Введите номер карты(или -1, чтобы выйти)')
flag = False
while cardNumber != "-1":
if flag:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ваш флаг один раз за жизнь программы может поменяться на True, а все последующие попытки ввести номер карты будут считаться неправильными...

flag = False
while cardNumber != "-1":
if flag:
print("Вы неправильно ввели номер карты, будте внимательны")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как полтзователь, что именно я неправильно ввёл? Мне бы хотелось понимать

Comment on lines +25 to +27
if i % 4 == 0:
if cardNumber != " ":
flag = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То есть если я не разделил номер карты пробелами, то я сразу неправ? Это неочевидно. В любом случаче, это условие ещё и неправильное. Я должен начинать с пробела (0 % 4 == 0)? И если так, то на позиции с индексом 4 стоит уже какая-то цифра

Comment on lines +17 to +18
def utility(cardNumber):
cardNumber = input('Введите номер карты(или -1, чтобы выйти)')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А что надо передавать в качестве аргумента? Зачем он, если я сразу перезаписываю его?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стоило позапускать свою утилиту, тогда бы вы отловили абсолютное большинство из указанных недостатков

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants