Epython Lab
6.45K subscribers
660 photos
31 videos
104 files
1.22K links
Welcome to Epython Lab, where you can get resources to learn, one-on-one trainings on machine learning, business analytics, and Python, and solutions for business problems.

Buy ads: https://telega.io/c/epythonlab
Download Telegram
#PROJECTCHALLENGE #LOOP #DICTIONARY #LIST #FUNCTIONS

Scrabble

In this project, you will process some data from a group of friends playing scrabble. You will use dictionaries to organize players, words, and points.

There are many ways you can extend this project on your own if you finish and want to get more practice!

N.B: You should go through each task to complete this project.
Post your solution via
@PYTHONETHBOT
Don't post your solution in the group
Follow instructions accordingly

Tasks
letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

points = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]

1. I have provided you with two lists, letters and points. You would like to combine these two into a dictionary that would map a letter to its point value.

Using a list comprehension and zip, create a dictionary called
letter_to_points that has the elements of letters as the keys and the elements of points as the values.

2. Our letters list did not take into account blank tiles. Add an element to the
letter_to_points dictionary that has a key of " " and a point value of 0.

3. We want to create a function that will take in a word and return how many points that word is worth.
Define a function called
score_word that takes in a parameter word.

4. Inside score_word, create a variable called point_total and set it to 0.

5. After defining point_total, create a for loop that goes through the letters in word and adds the point value of each letter to point_total.

You should get the point value from the letter_to_points dictionary. If the letter you are checking for is not in letter_to_points, add 0 to the point_total.

6. After the for loop is finished, return
point_total.

7. Let’s test this function! Create a variable called asibeh_points and set it equal to the value returned by the score_word() function with an input of "ASIBEH".

8. We expect the word ASIBEH to earn 11 points:

(A + S + I + B + E + H)

Let’s print out asibeh_points to make sure we got it right.

9. Create a dictionary called
player_to_words that maps players to a list of the words they have played. This table represents the data to transcribe into your dictionary:
player1 wordNerd Lexi Con Prof Reader
BLUE EARTH ERASER ZAP
TENNIS EYES BELLY COMA
EXIT MACHINE HUSKY PERIOD

10. Create an empty dictionary called player_to_points.

11. Iterate through the items in
player_to_words. Call each player player and each list of words words.

Within your loop, create a variable called
player_points and set it to 0.

12. Within the loop, create another loop that goes through each word in words and adds the value of score_word() with word as an input.

13. After the inner loop ends, set the current player value to be a key of
player_to_points, with a value of player_points.

14. player_to_points should now contain the mapping of players to how many points they’ve scored. Print this out to see the current standings for this game!

If you’ve calculated correctly, wordNerd should be winning by 1 point.

====GOOD LUCK=====
Epython Lab pinned a photo
Numpy Code Snippet.pdf
88.5 KB
Hi, this is a simple example to practice Numpy. Go through each line of code and ask if you have any questions.
[Fern_ndez_Vill_n,_Alberto]_Mastering_OpenCV_4_wit (1).epub
50.5 MB
Mastering OpenCV 4 with Python - 2019

@python4fds
object_oriented_python_tutorial.pdf
3.3 MB
Object oriented python tutorial
#Python #book
@python4fds
#CODE_CHALLENGE_3 #LIST #SWAP_TWO_NUMBERS


#Q: The next iteration of Asibeh Tenager will feature an extra-infuriating new item, the Purple Shell. When used, it warps the last place racer into first place and the first place racer into last place. Write a python function purple_shell and implement the Purple Shell's effect.

Note: Given a list of racers, set the first place racer (at the front of the list) to last
place and vice versa.
N.B: use swap mechanism

given list: racers = ["Asibeh", "Naol", "Obang"]
output list = ["Obang", "Naol", "Asibeh"]
Post
your solution at @pythonethbot
When applying machine learning to real-world data, there are a lot of steps involved in the process -- starting with collecting the data and ending with generating predictions. (We work with the seven steps of machine learning, as defined by Yufeng Guo.)
Epython Lab
#CODE_CHALLENGE_3 #LIST #SWAP_TWO_NUMBERS #Q: The next iteration of Asibeh Tenager will feature an extra-infuriating new item, the Purple Shell. When used, it warps the last place racer into first place and the first place racer into last place. Write a…
#Solution for #CODE_CHALLENGE_3

# Given a list of racers, set the first place racer (at the front of the list)
# Use swap mechanism
def purple_shell(lst):
# swap list items
temp = lst[0]
lst[0] = lst[2]
lst[2] = temp

return lst

# code driver
racers = ['Asibeh', 'Naol', 'Obang']

purple_shell(racers)

#Output: ['Obang', 'Naol', 'Asibeh']
Artificial Intelligence for Big Data.pdf
24.3 MB
Artificial Intelligence for Big Data

@python4fds
Fuzzy matching Algorithm: The process of automatically finding text strings that are very similar to the target string. In general, a string is considered "closer" to another one the fewer characters you'd need to change if you were transforming one string into another. So "apple" and "snapple" are two changes away from each other (add "s" and "n") while "in" and "on" and one change away (rplace "i" with "o"). You won't always be able to rely on fuzzy matching 100%, but it will usually end up saving you at least a little time.
🎲 Quiz 'Python List'
What are the output of a, b and c respectively?
🖊 1 question · 1 min
Scikit_Learn_Cheat_Sheet_Python.pdf
145.7 KB
Scikit-learn cheat sheet python
@python4fds
Best Machine Learning Algorithms
@python4fds
#KeyNote
#ANN #Keras #DEEPLEARNING #AI #TensorFlow
Keras is a deep learning API written in Python that can run on top of TensorFlow. It is quite popular among deep learning users because of its ease of use. TensorFlow is an end-to-end open-source deep learning framework developed and maintained by Google. Similar to Numpy, TensorFlow allows for mathematical computations and manipulation between numerical tensors, runs on CPUs, GPUs, and TPUs. Keras was incorporated in TensorFlow 2.0 (the recent version) as tf.keras (high-level API) and can run on the aforementioned hardwares. TensorFlow also allows for low-level operations with the TensorFlow Core API.
What is data science?
- Data science is the study of large quantities of data, which can reveal insights that help organizations make strategic choices.
- There are many paths to a career in data science; most, but not all, involve a little math, a little science, and a lot of curiosity about data.
- New data scientists need to be curious, judgemental and argumentative.
- Why data science is considered the sexiest job in the 21th century, paying high salaries for skilled workers.
#KeyNote #DataScience