PYTHON VIVA
PYTHON VIVA CLASS 9th Variable – What is a variable in Python?Answer: A named memory location to store data. String – What is a string?Answer: A sequence of characters enclosed in quotes. Integer – What is an integer?Answer: A whole number without a decimal. Float – What is a float?Answer: A number with a decimal […]
Explain Dataframe functions with example: head, tail , loc, iloc, value and to_numpy().
Explain Dataframe functions with example: head, tail , loc, iloc, value and to_numpy(). SOLUTION…. DataFrame methods: head, tail, loc, iloc, values and to_numpy() — explained with examples Below is a short, original, and practical explanation of each method/attribute plus examples you can try in Python with pandas. 1) head(n=5) What it does: returns the first […]
Explain extract and write commands for csv and excel files using Dataframe.
Explain extract and write commands for csv and excel files using Dataframe. SOLUTION…. Pandas is a powerful Python library used for data manipulation and analysis. One of its most useful features is handling structured data stored in CSV (Comma-Separated Values) and Excel files. Pandas provides built-in methods to easily read (extract) and write (save) these […]
How to Set PYTHONPATH? Explain Concepts of Namespace, Scope and Packages in python.
How to Set PYTHONPATH? Explain Concepts of Namespace, Scope and Packages in python. SOLUTION…. Set PYTHONPATH PYTHONPATH is an environment variable that Python uses to add extra directories to sys.path so modules/packages in those directories can be imported. Quick check (see what Python currently searches): Temporarily (current shell session) Linux / macOS (bash / zsh): […]
How to import a CSV file into a table and Export a CSV file into a table ? Give appropriate example.
How to import a CSV file into a table and Export a CSV file into a table ? Give appropriate example. SOLUTION…. 1) MySQL / MariaDB Example table & sample CSV Table schema: CREATE TABLE employees ( id INT, name VARCHAR(100), dept VARCHAR(50), hire_date DATE, salary DECIMAL(10,2) ); Sample CSV (employees.csv): Import CSV into table […]
Explain how to Dump specific table into file and Dump only table structure providing appropriate example.
Explain how to Dump specific table into file and Dump only table structure providing appropriate example. SOLUTION…. Dumping Specific Table into a File When working with databases like MySQL, you may not always want to back up the entire database. Sometimes you only need to export (dump) a single table’s data. This can be done […]
About Us/Contact Us Page
About Us/Contact Us Page SOLUTION…. <!DOCTYPE html><html lang=”en”><head><meta charset=”UTF-8″><title>About Us / Contact Us</title><link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css”></head><body><div><h2>About Us</h2><p>We are a team providing blog and stock updates using modern web technologies.</p> <h3>Contact Us</h3><form><div><label>Name:</label><input type=”text”></div><div><label>Email:</label><input type=”email”></div><div><label>Message:</label><textarea></textarea></div><button type=”submit”>Send</button></form></div></body></html> About Us / Contact Us About Us We are a team providing blog and stock updates using modern web technologies. Contact Us […]
Stock/Blog page
Stock/Blog page SOLUTION…. <!DOCTYPE html><html lang=”en”><head><meta charset=”UTF-8″><title>Stock/Blog</title><link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css”></head><body><div><h2>Stock Market Updates</h2><p>Here you can add stock updates or blogs.</p><div><div><h5>Stock A</h5><p>Current price: $120</p></div></div><div><div><h5>Stock B</h5><p>Current price: $95</p></div></div></div></body></html> Stock/Blog Stock Market Updates Here you can add stock updates or blogs. Stock A Current price: $120 Stock B Current price: $95
Login Page
Login Page SOLUTION…. <!DOCTYPE html><html lang=”en”><head><meta charset=”UTF-8″><title>Login</title><link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css”><script>function validateLogin() {let email = document.getElementById(“email”).value;let pass = document.getElementById(“password”).value;if (email == “” || pass == “”) {alert(“Please fill all fields!”);return false;}alert(“Login Successful!”);return true;}</script></head><body><div><h2>Login Form</h2><form onsubmit=”return validateLogin()”><div><label>Email:</label><input type=”email” id=”email”></div><div><label>Password:</label><input type=”password” id=”password”></div><button type=”submit”>Login</button></form></div></body></html> Login Login Form Email: Password: Login
Registration Page
Registration Page SOLUTION…. <!DOCTYPE html><html lang=”en”><head><meta charset=”UTF-8″><title>Register</title><link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css”><script>function validateRegister() {let name = document.getElementById(“name”).value;let email = document.getElementById(“email”).value;let pass = document.getElementById(“password”).value;let confirm = document.getElementById(“confirm”).value; if (name == “” || email == “” || pass == “”) {alert(“All fields are required!”);return false;}if (pass !== confirm) {alert(“Passwords do not match!”);return false;}alert(“Registration Successful!”);return true;}</script></head><body><div><h2>Registration Form</h2><form onsubmit=”return validateRegister()”><div><label>Name:</label><input type=”text” id=”name”></div><div><label>Email:</label><input […]
