Answer: True
Explanation:
A language is said to be closed under a operation here the complement is the operation then if upon application of that operation to any members of that language always yields a member of that language.
regular languages are closed under complement. A proof of the statement is
If a regular language 'L' is regular then there is a DFA X recognizing that regular language 'L'. to show that L' (compliment) is regular we need to have another DFA X' recognizing L'.
The initial state and transition function of both the DFAs are same except their accepting state. Then we can say that X' accepts L'.
So, we can say that regular languages are closed under complement.
Answer:
import random
import math
smaller = int(input("Enter the smaller number: "))
larger = int(input("Enter the larger number: "))
count = 0
print()
while True:
count += 1
myNumber = (smaller + larger)
print('%d %d' % (smaller, larger))
print('Your number is %d' % myNumber)
choice = input('Enter =, <, or >: ')
if choice == '=':
print("Hooray, I've got it in %d tries" % count)
break
elif smaller == larger:
print("I'm out of guesses, and you cheated")
break
elif choice == '<':
larger = myNumber - 1
else:
smaller = myNumber + 1
Explanation:
- Inside an infinite while loop, add the smaller and larger number and assign that value to myNumber variable.
- Check the choice and then print the relevant display message.