I need help on these functions PYTHON 3. The information about the functions is in the first two pics.
def read_info_file(filename):
d1={}
info=[]
with open(filename,"r") as f:
f.readline()#reading headers
for line in f:
line=line.replace('"','')
count=line.count(",")
if(count==6):
str=line.split(",")
str[1]=str[1]+","+str[2]
info=[a for a in str if a.count(",")==0]
else:
info=line.split(",")
d1[info[1]]=(int(info[0]),info[2],info[3],int(info[4]),info[5]=="True")
return d1
def read_stats_file(filename):
d2={}
stats=[]
with open(filename,"r") as f:
f.readline()#reading headers
for line in f:
stats=line.split(",")
d2[int(stats[0])]=(int(stats[1]),int(stats[2]),int(stats[3]),int(stats[4]))
return d2
d1=(read_info_file("info.txt"))
d2=(read_stats_file("stats.txt"))
def combine_databases(info_db,stats_db):
finaldict={}
for names in info_db:
for id in stats_db:
a,b,c,d,e=info_db[names]
f,g,h,i=stats_db[id]
if(a==id):
finaldict[names]=(a,b,c,f,g,h,i,d,e)
break
return finaldict
print("info_db :%s "%d1)
print("stats_db :%s"%d2)
print("final_db: %s" % combine_databases(d1,d2))
I need help on these functions PYTHON 3. The information about the functions is in the...
In C++ Instructions Project 2: Gotta Catch ‘Em All Due: July 16 by Midnight For this project you will be designing and implementing a system, in C++, to catalogue Pokémon, their trainers, and the local Pokémon gyms. Your system should act as a database and allow the user to load in multiple tables of data, run basic queries on the data, and then store the data off for later use. Additionally, sample input files will not be uploaded to Canvas,...
PLEASE DO IT IN PYTHON, THANK YOU! CSV file: This is a file containing plain text where each line in the file represents one record of information, and each piece of info in the record is separated by a single comma. Luckily the values won't ever contain commas themselves for this project. But they might start or end with non visible characters (e.g. space, tab). Thus, you must remove the leading and trailing spaces when you store the data in...
Python 3 Coding Functions: Here is any code required to help code what is below: def pokemon_by_types(db, types): new_db = {} for pokemon_type in types: for key in db: # iterate through all the type in types list if db[key][1] == pokemon_type or db[key][2] == pokemon_type: if key not in new_db: new_db[key] = db[key] return new_db I need help coding the functions listed below in the image: Thank you get types(db): Given a database db, this function determines all the...
Python: def combo(): play = True while play: x = int(input('How many people\'s information would you like to see: ')) print() for num in range(x): name() age() hobby() job() phone() print() answer = input("Would you like to try again?(Enter Yes or No): ").lower() while True: if answer == 'yes': play = True break elif answer == 'no': play = False break else: answer = input('Incorrect option. Type "YES" to try again or "NO" to leave": ').lower()...
Python Help Please! This is a problem that I have been stuck on.I am only suppose to use the basic python coding principles, including for loops, if statements, elif statements, lists, counters, functions, nested statements, .read, .write, while, local variables or global variables, etc. Thank you! I am using python 3.4.1. ***( The bottom photo is a continuation of the first one)**** Problem statement For this program, you are to design and implement text search engine, similar to the one...
Help needed with Python 3: Dictionaries and Sets. The problem is one that asks the user to create a completed program that prompts the user for the name of a data file, and reads the contents of that data file, then creates variables in a form suitable for computing the answer to some questions. The format should be in the same manner as the attached .py file. All subsequent assignment details (.py and .csv files) can be found at this...
1. You will develop a Python program to manage information about baseball players. The program will maintain the following information for each player in the data set: player’s name (string) team identifier (string) games played (integer) at bats (integer) runs scored (integer) hits (integer) doubles (integer) triples (integer) homeruns (integer) batting average (real) slugging percentage (real) The first nine items will be taken from a data file; the last two items will be computed by the program. The following formulas...
Need C programming help. I've started to work on the program, however I struggle when using files and pointers. Any help is appreciated as I am having a hard time comleting this code. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 100 #define MAX_NAME 30 int countLinesInFile(FILE* fPtr); int findPlayerByName(char** names, char* target, int size); int findMVP(int* goals, int* assists, int size); void printPlayers(int* goals, int* assists, char** names, int size); void allocateMemory(int** goals, int** assists, char*** names, int size);...
I need help with my homework assignment Linux systems keep user account information in the passwd file and the encrypted password in the shadow file. The passwd file containing account information might look like this: smithj:x:1001:1001:John Smith:/home/smithj:/bin/bash The shadow file containing password and account expiration information for users might look like this: smithj:KJDKKkkLLjjwlnttqoiybnm.:10063:0:99999:7::: The fields in the shadow file are separated by a colon, with the first field being the username and the second being the password. Under normal circumstances,...
any graph that show information about candida glabrata, any info is fine I just need to follow the requirements For your results, you will need at least two graphs. For each graph that you intend to develop, provide the following information: Graph Title * Label name for X-axis Label name for y-axis What the data in your graph will show What type of graph you intend to use (line graph, bar graph) and why