Answer:
Code is given as below:
Explanation:
def open_file():
fpointer = open('example.txt')
return fpointer
def main():
dictlist = []
dict_of_words = dict()
fp = open_file()
# loop to iterate over lines in file
for line in fp:
for word in line.split():
if(not dict_of_words.get(word)):
dict_of_words[word] = 1
else:
dict_of_words[word] += 1
for key, value in dict_of_words.items():
temp = (key.lower(), value)
dictlist.append(temp)
print(sorted(dictlist))
main()
Answer:
The solution code is written in Python 3.
- import random
-
- count = 0
- flag = False
- guess = int(input("Input your guess (2-12): "))
-
- while(count <=3):
- dice1 = random.randint(1, 7)
- dice2 = random.randint(1, 7)
-
- if((dice1 + dice2) == guess):
- flag = True
-
- count += 1
-
-
- if(flag):
- print("User wins!")
- else:
- print("Computer wins!")
Explanation:
A Random generator is needed for this question and therefore we start by importing Python random class (Line 1)
Next, create one counter variable,<em> count</em>, to ensure there will be only three rolling of the dices (Line 3). We need another variable, <em>flag</em>, to track the status if the two dices equal to the <em>guess</em> number chosen by user (Line 4).
Next, prompt use to input a guess number (Line 5).
Within the while loop, we can use random class method <em>randint() to </em>generate random integer. The arguments 1 and 7 will give one random number ranged from 1 to 6 for <em>dice1</em> and<em> dice2</em>, respectively (Line 8 - 9).
If the total of<em> dice1 + dice2</em> equal to user <em>guess</em>, we turn the<em> flag </em>to <em>True</em>. If not, the <em>flag </em>will remain <em>False</em> after completing entire while loop.
If the <em>flag </em>turned to <em>True</em>, print the message "User Wins!" else print the message ("Computer wins!")
The answer is Progressive Website Applications. This specific type of website allows the user to have a particular website function similarly as to when you download the app natively on your device. One main advantage is that you wouldn't need to download the actual app to use its functions. As the applications we use in our mobile phone increase, the more application we need to download, and could be troublesome to have hundreds of app installed on your mobile device.
Because you never know if the person over the phone is trying to scam you or not, so if you were to give them your ssn they would use your identity for stuff that they want. I hope this helps :)
To enter data in a cell, you must first select the cell.