Завершен

Python code

PART A:

Write code for a python function called load_data that accepts a string

that holds the name of a file on disk, a dictionaryi, and a key (string).

This function will read all characters of the file into a 2-Dimensional list (array).

All characters of the same row will form a list and each row will be an element of the 2D list

For example, if the file contains

abcd

efgh

then list_2d = [['a','b','c','d'], ['e','f','g','h']]

The function then stores this list in the dictionary

using the supplied string as key. The file must be closed after a successful read.

This function returns the entire dictionary (8 marks).

PART B:

Write the code for a python function called replace_data that accepts a

loaded dictionary from PART A, a key (string), a search character (single character),

and a replacement character (single character).

This function will replace all occurrences of search character with

replacement character for the lines in the dictionary using the supplied key and

return the total number of times the search character was replaced.

You may assume that the search and replace characters will always be valid

2D list in the dictionary (12 marks).

'''

sample file 10x10 named "[login to view URL]"

^^^^X^^^^^

^2^^^^^^8^

^PHP^^^^^^

^PYTHON^^^

^^^^^C++^^

^^JSCRIPT^

PHP^^WEB^^

GO-LANG^^^

^^^RUBY^^^

^^^^^RUST^

'''

import math

import random

import string

import collections

import datetime

import re

import time

import copy

# program: [login to view URL]

# student: your name

# student number: 123456789

# date: June 21, 2022

# purpose: solution to PRG550X Lab Test #1

# Your functions MUST be placed here...

# Your functions MUST be placed here...

def main( ) :

table1 = { }

table2 = load_data('[login to view URL]', table1, "mask")

print("Loaded Data:")

for j in range(10) :

for k in range(10) :

print(table2['mask'][j][k], end="")

print( )

print( )

num_replacements = replace_data(table2, "mask", '^','*')

table_out = table2["mask"]

print("Updated Data:")

for j in range(10) :

for k in range(10) :

print(table_out[j][k], end="")

print()

print(f"{num_replacements}")

if __name__ == "__main__" :

main( )

# If your solution to PARTS A and B have been completed correctly, the main( )

# function above will display the output EXACTLY as listed below.

Loaded Data:

^^^^X^^^^^

^2^^^^^^8^

^PHP^^^^^^

^PYTHON^^^

^^^^^C++^^

^^JSCRIPT^

PHP^^WEB^^

GO-LANG^^^

^^^RUBY^^^

^^^^^RUST^

Updated Data:

****X*****

*2******8*

*PHP******

*PYTHON***

*****C++**

**JSCRIPT*

PHP**WEB**

GO-LANG***

***RUBY***

*****RUST*

57

Навыки: Python, Архитектура ПО

О клиенте:
( 0 отзыв(-а, -ов) ) Toronto, Canada

ID проекта: #33967312

Поручен:

GhoulamIlyasse

Hello sir, I am an expert in Python. I can handle this project as required and run your code . Please contact me for more details. Best regards!

$40 CAD за 7 дней(-я)
(1 отзыв)
0.4

10 фрилансеров(-а) готовы выполнить эту работу в среднем за $56

esa59cfdec1d6569

Hi there, I checked your requirements and guarantee you it's gonna be done within the next few hours. Let's contact via chat so that I can start work immediately. Wish you the best.

$50 CAD за 7 дней(-я)
(79 отзывов(-а))
5.4
braincenter

Hello, Hope this message finds you well, I checked your details and I believe that my experience is what you are looking 4. I have been working on similar projects for the past 8 years, and I have the essential skills Больше

$100 CAD за 3 дней(-я)
(18 отзывов(-а))
5.2
amrkhaled32

Hello, I hope you are doing well, how are you? if you are looking for someone who can do the job in a fast and reliable way you are in the right place! I am an expert in python problem solving, I got great experience w Больше

$30 CAD за 1 день
(16 отзывов(-а))
4.6
alamineee

Hi, Dear Employer, I am "Al. A". I am a professional "Copywriter ". I'm an expert in Copywriting with over 7+ years of experience. I have worked on several similar projects on freelancer.com and can deliver professiona Больше

$200 CAD за 1 день
(18 отзывов(-а))
4.4
DWSol

Python code Interesting and short animated video Software Architecture and Python Hi, • This is Sairus Khalil from DW Solution online. • I'm certified in short animated video by freelancer.com. • You can also check Больше

$25 CAD за 8 дней(-я)
(2 отзывов(-а))
2.8
shasanulgoni

- - - - READY TO START WORKING NOW - - - - Hi there! I can write both python function for you. Still, I'm working(part-time) as a full-stack developer for E-Vision software ltd, one of the oldest and reputed IT farm Больше

$30 CAD за 1 день
(1 отзыв)
1.8
buibrothers27

(: Good day :) I have read your description and understood your proposal. I have rich experience in python for DL & ML, Image Processing for 6 years. As you can see my profile, I have many projects before that you are Больше

$30 CAD за 1 день
(0 отзывов(-а))
0.0
jake66405

MASTERS IN SOFTWARE DEVELOPMENT AND ARCHITECTURE. EXPERT IN JAVASCRIPT, HTML5, CSS C, C++, PYTHON, JAVA, PHP, FLUTTER, NODE.JS, REACT.JS, REACT NATIVE. Hi there! Thank you for sharing your project requirement, I have Больше

$20 CAD за 7 дней(-я)
(0 отзывов(-а))
0.0
jbubb

Hello, I'm a senior at Boston University, and I've been using Python for about 3 years now. I've completed a very similar project to this during my freshman year that involved reading words from a .txt file, and stor Больше

$30 CAD за 1 день
(0 отзывов(-а))
0.0