Δημοσιεύτηκε: 17 Μάιος 2011, 13:06
από Qdata
Μμμ...Εγώ θα έλεγα να το κάνεις έτσι:
Κώδικας: Επιλογή όλων
#!/usr/bin/python3
fname = input('Please write your first name:')
lname = input('Please write your last name:')
number = input('Please write your phone number:')

if fname == '':
print('Do not leave any fields empty')
elif lname == '':
print('Do not leave any fields empty')
elif number == '':
print('Do not leave any fields empty')
else:
print('Thank you')


Ή και έτσι:

Κώδικας: Επιλογή όλων
#!/usr/bin/python3
fname = input('Please write your first name:')
lname = input('Please write your last name:')
number = input('Please write your phone number:')

a = 'Do not leave any fields empty'

if fname == '':
print(a)
elif lname == '':
print(a)
elif number == '':
print('a)
else:
print('Thank you')