Skip to content

Conversation

@ParsaSoroush
Copy link
Owner

master

sampleDict = {
    class: {
        student: {
            name: Mike,
            marks: {
                physics: 70,
                history: 80
            }
        }
    }
}
Expected output:
80
  'Physics': 82,
  'Math': 65,
  'history': 75
}
Expected output:
Math
…m 20.

Given:
list1 = [5, 20, 15, 20, 25, 50, 20]
Expected output:
[5, 15, 25, 50]
…a dictionary in a way that item from list1 is the key and item from list2 is the value
sample_dict = {
    'name': 'Parsa',
    'age': 13
    'city': 'urmia'
}

# Keys to remove
keys = ['name', 'salary']
Expected output:
{'city': 'New york'}
…is required to check if the given value is present.

Write a Python program to check if value 200 exists in the following dictionary.
… with items that exist only in the first set and not in the second set.
ParsaSoroush and others added 11 commits September 7, 2024 08:11
…e, inserts sample data, and reads the data in a specific order. It uses the mysql.connector module to interact with the MySQL server. The code creates a connection, cursor, and database, then creates a table named employees with columns for Name, Height, and Weight. It inserts four sample employees and commits the changes. The code then reads the data in descending order of height and ascending order of weight, and prints each employee's data. Finally, it closes the cursor and connection.
…le to select a random color from a list of 15 colors. The color_guess function chooses a random color and asks the user to guess it. The user's guess is compared to the chosen color, and if it's incorrect, the user is asked to try again. This continues until the user guesses the correct color, at which point a congratulatory message is printed. The game continues to prompt the user for input until the correct color is guessed. The color_guess function is then called to start the game.
…addresses) and passwords in a SQLite database. It uses regular expressions to validate email and password formats. The code creates a users table with username and password columns. It then enters an infinite loop, prompting the user to enter their email and password. The validate_email and validate_password functions check the input formats, and if valid, the store_credentials function inserts the data into the database. If the inputs are invalid, the user is prompted to try again.
… regular expressions. It defines a function check_email that takes an email as input, checks if it matches the pattern, and returns OK if it does or WRONG if it doesn't. The pattern allows for letters, numbers, and special characters in the local part, followed by @, then letters, numbers, and - in the domain, and finally a period and letters, numbers, and - or . in the top-level domain. The user is prompted to input their email, and the result is printed in uppercase.
…re the country data.

We send a GET request to the website and parse the HTML content using BeautifulSoup.
We find all country rows by searching for tr elements.
We extract the country data from each row by searching for td elements.
We store the country data in the database using SQL queries.
Finally, we commit the changes and close the connection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants