Answer:
Enter a number: 7
Enter a number: 10
Traceback (most recent call last):
File "main.py", line 3, in <module>
print (numi + num2)
NameError: name 'numi' is not defined
Explanation:
The typo in the print statement causes a run-time error, where obviously num1+num2 was expected, and an output of 17.
Answer:
Determine if the software or service is authorized
Explanation:
:)
Answer: Queries
Explanation: A database management system(DBMS) is a system that contains the data/information in the form of content or tables.There is a software that can populate the system by the excess data usually found in the SQL format
A query is the demand for the extraction of the information that is present in the database table or content.It helps in presenting extracted data in the readable data.The most commonly used language for the queries is the SQL (structured query language) queries.Thus, the correct option is queries.
Answer:
import random
def simulate_observations():
#this generates an array of 7 numbers
#between 0 and 99 and returns the array
observations = random.sample(range(0, 100), 7)
return observations
#here,we call the function created above and print it
test_array = simulate_observations()
print(str(test_array))
Answer:
Following are the code to this question:
file= open('book.txt') #open file
li= {} #define an empty list
for lines in file: # use for loop Split file data into words
d= lines.lower().strip(' !?').split() #define variable d that Add it to map
for val in d: #define loop to store data
if val not in li: #check value is not in list
li[val] = 0 #define list and assign value in 0
li[val] = li[val] + 1 #Sort the book data and add its value
m = sorted(li.items(),key = lambda x : -x[1]) #sorted value into the m variable
print(m[:10]) #print value
Output:
please find the attachment.
Explanation:
In the given python code first, we open the file "book.txt", in next line, an empty list is defined, that uses the for loop which can be described as follows:
- In the for loop is used, that reads the file data, and defines a variable "d", that stores the values into the map.
-
In the next line another loop is used, that check file values, if values are the same type so, it adds values and writes it.
- In the last line, m variable is used, that sorts the values and use the slicing to print its value.