Python 100 Challenges

1

Challenge 1/100:

I have a pdf which has more than 5 pages. In the first page alone, I have a sensitive information like user address.

I need to find the user address section and erase that address by using python and ML libs

Give me code for it.

ChatGPT: 100%


2

Challenge 2/100:

bijective function

What is it?

Do some code base to show a demo on it


3

Challenge 3/100: Date: Aug 5, 2024

Create a text file named input.txt with some sample text. Write a Python script to read the contents of the file. Count the number of words in the file. Output the word count.

Duration: 30 mins CG (ChatGPT): 0% GLE (Google): 0% MyLearings: Yes Team Assignment: No


4

Challenge 4/100: Date: Aug 5, 2024

Content: Toronto is the largest city in Canada and the capital of the province of Ontario. It is known for its diverse population, vibrant arts scene, and significant cultural landmarks. Here are some key points about Toronto:

Population and Diversity: Toronto is one of the most multicultural cities in the world, with over 140 languages spoken and more than half of its residents born outside of Canada.

Economy: It is a major international center for business and finance, with a strong economy that includes sectors like technology, finance, healthcare, and media.

Landmarks: Notable landmarks include the CN Tower, one of the tallest free-standing structures in the world, and the Royal Ontario Museum, which is among the largest museums in North America.

Neighborhoods: Toronto is home to many distinct neighborhoods, each with its own unique character, such as Kensington Market, known for its bohemian vibe, and the Distillery District, famous for its historic architecture and arts scene.

Sports: The city is passionate about sports, hosting major teams like the Toronto Raptors (NBA), Toonto Maple Leafs (NHL), and Toronto Blue Jays (MLB).

Education: Toronto boasts several world-renowned educational institutions, including the University of Toronto, Ryerson University, and York University.

Events: The city hosts numerous festivals and events throughout the year, such as the Toronto International Film Festival (TIFF), Caribana, and Pride Toronto.

Public Transit: The Tornto Transit Commission (TTC) provides extensive public transportation options, including subways, buses, and streetcars, making it easy to navigate the city.

Green Spaces: Despite being a bustling urban center, Toronto offers numerous parks and green spaces, including High Park, Trinity Bellwoods Park, and the Toronto Islands.

Toronto's dynamic culture, economic opportunities, and quality of life make it a sought-after destination for both residents and visitors alike.

--

  1. Dump the above content called "ciy.txt"

  2. Write a module name city.py to replace "Toronto" to user given values.

  3. When I call, it should read the file, replace necessary value and then dump into city_new.txt

  4. How to call? python city.py "New York"

    1. If I call the above, I should see "New York" in all places wherever "Toronto" mentioned

--

Duration: 40 mins ChatGPT: 0% Google: 10% MyLearings: Yes Team Assignment: No

--

Collect 10 Interview questions from this requirement.


5

Line Numbering

Content:

Toronto is the largest city in Canada and the capital of the province of Ontario. It is known for its diverse population, vibrant arts scene, and significant cultural landmarks. Here are some key points about Toronto:

Population and Diversity: Toronto is one of the most multicultural cities in the world, with over 140 languages spoken and more than half of its residents born outside of Canada.

Economy: It is a major international center for business and finance, with a strong economy that includes sectors like technology, finance, healthcare, and media.

Landmarks: Notable landmarks include the CN Tower, one of the tallest free-standing structures in the world, and the Royal Ontario Museum, which is among the largest museums in North America.

Neighborhoods: Toronto is home to many distinct neighborhoods, each with its own unique character, such as Kensington Market, known for its bohemian vibe, and the Distillery District, famous for its historic architecture and arts scene.

Sports: The city is passionate about sports, hosting major teams like the Toronto Raptors (NBA), Toonto Maple Leafs (NHL), and Toronto Blue Jays (MLB).

Education: Toronto boasts several world-renowned educational institutions, including the University of Toronto, Ryerson University, and York University.

Events: The city hosts numerous festivals and events throughout the year, such as the Toronto International Film Festival (TIFF), Caribana, and Pride Toronto.

Public Transit: The Tornto Transit Commission (TTC) provides extensive public transportation options, including subways, buses, and streetcars, making it easy to navigate the city.

Green Spaces: Despite being a bustling urban center, Toronto offers numerous parks and green spaces, including High Park, Trinity Bellwoods Park, and the Toronto Islands.

Toronto's dynamic culture, economic opportunities, and quality of life make it a sought-after destination for both residents and visitors alike.

--

Get the content above and put them into city.txt

Write a Python script to read the contents of the file.

Add line numbers to each line of the text.

Save the modified text to a new file named city1.txt.

--

Duration: 40 mins

ChatGPT: 0%

Google: 10%

MyLearings: Yes

Team Assignment: No

--

Collect 10 Interview questions from this requirement.


6

Log Analyzer

--

Copy the content above and put them in error.log

Write a Python script to read the contents of the log file.

Extract and print all lines that contain the word "ERROR".

--

Duration: 40 mins

ChatGPT: 0%

Google: 10%

MyLearings: Yes

Team Assignment: No

--

Collect 10 Interview questions from this requirement.


7


8


9


10


11


12


13


14


15


16


17


18


19


20


21


22


23


24


25


Last updated