Software Engineering Lab Task 2
HU22CSEN0101658
Songa Mrudula
Step 1: Hardcoding Variables
Hardcoding variables means defining variables with predefined or fixed values in your code.
This is useful for demonstrating functionality without needing user input or external data
Keyboard Input in Python
Using Python's input() function, you can accept data directly from the user through the
keyboard.
Read From File (Single Input) in Python
To read a single input from a file, use Python's open() function and the read() method.
Save Different Versions in Different Cells Save Each Version of the Program in Different Cells/Files
Debug and Fix Errors in Python
In Python, errors can arise due to various reasons such as incorrect file paths, invalid input, or
logical mistakes. Here are common error types and how to handle them:
Push Versions to GitHub from Google Colab
To push versions of your code to a GitHub repository directly from Google Colab, follow these
steps:
Step 1: Log in to Your GitHub Account
1. Open a web browser and go to GitHub.
2. Log in using your GitHub username/email and password.
Step 2: Start Creating a Repository
1. Once logged in, look for the + icon in the top-right corner of the GitHub homepage.
2. Click on the + icon and select "New repository" from the dropdown menu.
Step 3: Fill Out Repository Details
1. Repository Name:
o Enter a name for your repository in the Repository name field (e.g., ColabPrograms).
o Make sure the name is unique within your account.
2. Description (Optional):
o Add a description to explain the purpose of the repository (e.g., "Repository for Google
Colab programs").
3. Visibility:
o Choose Public if you want others to see your repository.
o Choose Private if you want only yourself (and collaborators you add) to see it.
4. Do Not Initialize with a README:
o Leave the checkbox "Add a README file" unchecked. This will create an empty
repository.
5. Other Options (Optional):
o You can also skip adding a .gitignore or license file during this setup.
6. Click the green "Create repository" button at the bottom to finalize.
Step 4: Repository Created
After clicking "Create repository," you will see a page with the following:
Instructions for cloning, pushing, and working with your repository.
The HTTPS or SSH URL of your repository (e.g.,
[Link]
Step 5: Copy the Repository URL
1. On the repository page, you will see a section labeled "Quick setup".
2. Select the HTTPS or SSH URL (e.g.,
[Link]
3. Copy this URL. You’ll use it to connect the repository to your local machine or Colab.
Connect Google Colab to Google Drive
To connect Google Colab to your Google Drive, you can use the following code to mount your Google
Drive and access its files directly from Colab: