<span />
You
can move the file one of two ways. Your first option is to click and
drag the file to another folder in the Folders pane on the left side of
the window. Your second option is to right-click the file and choose
Send To. Then choose from the options shown in the submenu that appears.
Answer:
import re
def country_capita():
#opens file
file=open("inputfile.txt", "r")
dictionary=dict()
#reads line by line
for line in file.readlines():
# substitutes for multiple space a single space
line = re.sub(r"[\s]{2, }", ' ', line)
list=[]
#splits line on space
list=line.split(" ")
#put into dictionary
dictionary[list[1]]=list[2]
# get input
while True:
choice=input("Enter the country name or quit to exit: ")
if choice=="quit":
break
elif choice in dictionary.keys():
print(dictionary[choice])
else:
print("Invalid Country")
country_capita()
Explanation:
Using python to code this program. First we, (line 1) import the re module which offers us a set of functions that allows us to search a string for a match. ((line 2) Next we define a function country_capita() that will open rawdata_2004.txt, read the information within line by line and create a dictionary list. The we create a while loop with conditional statements that prompt the user to enter country names, print the corresponding values and stops when the user enters quit.
Answer:
Explanation:
def the_perfect(n):
try: #exception handling if n is a negative number
n > 0
except: #return -1 if the error is reached
return -1
else:
total = 0
for i in range(1, n): #for loop from 1 to the target number
if n % i == 0:
total += i
return total == n #should return true if number is perfect number
print(perfect_number(8))
Multiplexer. A mux converts mutiple inputs into fewer outputs, for example combined with an address bus. Then the address bus decides which part of the input is linked to the output, so the inputs use the outputs each at a different point in time (=time division multiplexing)
Answer:
Well, I would definitely advise him to buy USB hubs.
Explanation:
USB hub is a device that can give additional USB slot for the user just by consuming one single slots. In recent years, USB hubs can contain more than 9 slots with different variety, including HDMI and DVI that is required by this particular friend.
Using this device will make it easier to plug in and plug out all the devices he wants to his laptop since it all connected to one single hub.
Since he only has the budget under 100$ , Dell DA300 6-in-1 USB-C Hub could be a good option for Him.