Answer:
I am doing it with python.
Explanation:
nums = '9 -8 -7 -6 -5 -4 -2 0 1 5 9 6 7 4'
myfile = open('data.txt', 'w')
myfile.write(nums)
myfile.close()
myfile = open('data.txt', 'r')
num1 = (myfile.read())
num1 = num1.split()
print(num1)
print(type(num1))
for x in num1:
x = int(x)
if x < 0:
minus = open('dataminus.txt', 'a')
minus.write(str(x) + ' ')
minus.close()
elif x>= 0:
plus = open('dataplus.txt', 'a')
plus.write(str(x)+' ')
plus.close()
The four levels of organization incorporate official chiefs, program executives, improvement chiefs, and give essayists. The meaning of business organization is a program of study offered at colleges and schools that attention on business hypothesis, practices, and administration. A case of business organization is a class on the standards of bookkeeping.
Answer:
<em>Written in Python</em>
names= []
birthday = []
name = input("Name: ")
bday = input("Birthday: ")
for i in range(1,11):
names.append(name)
birthday.append(bday)
if name == "ZZZ":
break;
else:
name = input("Name: ")
bday = input("Birthday: ")
print("Length: ", end='')
print(len(names))
checknm = input("Check Name: ")
while checknm != "ZZZ":
if checknm in names:
ind = names.index(checknm)
print(birthday[ind])
else:
print("Sorry, no entry for name")
checknm = input("Check Name: ")
Explanation:
<em>The program is written in Python and I've added the full source code as an attachment where I used comments to explain difficult lines</em>
<em />
Answer:
Here is the Python program:
d = {5:3, 4:1, 12:2}
val_of_max = d[max(d.keys())]
print(val_of_max)
Explanation:
The program works as follows:
So we have a dictionary named d which is not empty and has the following key-value pairs:
5:3
4:1
12:2
where 5 , 4 and 12 are the keys and 3, 1 and 2 are the values
As we can see that the largest key is 12. So in order to find the largest key we use max() method which returns the largest key in the dictionary and we also use keys() which returns a view object i.e. the key of dictionary. So
max(d.keys()) as a whole gives 12
Next d[max(d.keys())] returns the corresponding value of this largest key. The corresponding value is 2 so this entire statement gives 2.
val_of_max = d[max(d.keys())] Thus this complete statement gives 2 and assigns to the val_of_max variable.
Next print(val_of_max) displays 2 on the output screen.
The screenshot of program along with its output is attached.
Answer:
The program in Python is as follows:
valCount = int(input())
reports = []
for i in range(valCount):
num = int(input())
reports.append(num)
for i in reports:
print(i,"reports.")
Explanation:
This gets input for valCount
valCount = int(input())
This creates an empty list
reports = []
This gets valCount integer from the user
<em>for i in range(valCount):</em>
<em> num = int(input())</em>
<em>Each input is appended to the report list</em>
<em> reports.append(num)</em>
This iterates through the report list
for i in reports:
This prints each element of the report list followed by "reports."
print(i,"reports.")