#Python 3.8.3
_q_keys = {
'Question': 'Q',
'Validation': 'ValidIf'
}
_q = [
{
'Q': 'Your age:',
'ValidIf': '{} > 18',
},
'Q': 'Your main programming language:',
'ValidIf': '"{}" in ["C++", "C#", "Python", "C"]',
'Q': '''Whats your game development experience?
(Use reply codes:
1 - I have any commertial game projects
2 - I developed a lot of games, but only for me and my friends)
3 - I developed a few games only for me and my friend
4 - I delevoped 1-2 games which only i played
5 - I never tried to develop any game)''',
'ValidIf': '{} < 4',
]
def quiz(questions, keys):
for question_pair in questions:
print('Next Question:\n', question_pair[keys['Question']])
reply = input()
if not eval(question_pair[keys['Validation']].format(reply)):
print('Sorry, you dont suite us')
return
print('Congratulations, you\'re accepted in our team! Welcome ^_^')
quiz(_q, _q_keys)
Код:
revoke = "Мы вам обязательно перезвоним :)"
accept = "Вы приняты!"
next_q = "Отлично, перейдем к следующему вопросу!"
age = int(input("Сколько Вам лет? "))
if age <= 7:
print(revoke)
exit(1)
print(next_q)
ans1 = input("Есть ли у вас вредные привычки?").lower()
ans2 = input("Вы курите?").lower()
if ans1 == "да" or ans2 == "да":
ans1 = input("Есть ли у вас опыт работы с Python?").lower()
ans2 = input("Есть ли у вас опыт работы с NumPy?").lower()
if ans1 == "да" and ans2 == "да":
print(accept)
exit(0)
#Python 3.8.3
_q_keys = {
'Question': 'Q',
'Validation': 'ValidIf'
}
_q = [
{
'Q': 'Your age:',
'ValidIf': '{} > 18',
},
{
'Q': 'Your main programming language:',
'ValidIf': '"{}" in ["C++", "C#", "Python", "C"]',
},
{
'Q': '''Whats your game development experience?
(Use reply codes:
1 - I have any commertial game projects
2 - I developed a lot of games, but only for me and my friends)
3 - I developed a few games only for me and my friend
4 - I delevoped 1-2 games which only i played
5 - I never tried to develop any game)''',
'ValidIf': '{} < 4',
}
]
def quiz(questions, keys):
for question_pair in questions:
print('Next Question:\n', question_pair[keys['Question']])
reply = input()
if not eval(question_pair[keys['Validation']].format(reply)):
print('Sorry, you dont suite us')
return
print('Congratulations, you\'re accepted in our team! Welcome ^_^')
quiz(_q, _q_keys)
Код:
revoke = "Мы вам обязательно перезвоним :)"
accept = "Вы приняты!"
next_q = "Отлично, перейдем к следующему вопросу!"
age = int(input("Сколько Вам лет? "))
if age <= 7:
print(revoke)
exit(1)
print(next_q)
ans1 = input("Есть ли у вас вредные привычки?").lower()
ans2 = input("Вы курите?").lower()
if ans1 == "да" or ans2 == "да":
print(revoke)
exit(1)
print(next_q)
ans1 = input("Есть ли у вас опыт работы с Python?").lower()
ans2 = input("Есть ли у вас опыт работы с NumPy?").lower()
if ans1 == "да" and ans2 == "да":
print(accept)
exit(0)
print(revoke)
exit(1)