Loading dataset
How do i load a dataset frommy local disk to the online compiler?
3 Answers
@Ryton you can create a new file and paste the content of your dataset.
You can rename the dataset file to .csv
or .json
based on your usecase.
To load a dataset from your local disk to an online compiler, you first need to upload the dataset to the online compiler's server. The method for doing this will depend on the specific online compiler you are using, but most online compilers have a file upload feature that allows you to upload files from your local disk to the compiler's server.
Here's a general outline of the steps you can follow to upload a dataset to an online compiler:
-
Open the online compiler's website and navigate to the file upload feature. This is usually located in the file menu or in a toolbar.
-
Click on the file upload button and select the dataset file from your local disk. The file upload button may be labeled differently depending on the online compiler you are using, but it is usually an icon that looks like an arrow pointing upwards or a box with an upward arrow.
-
Wait for the file to upload. Depending on the size of the file and the speed of your internet connection, this may take a few seconds or several minutes.
-
Once the file has finished uploading, you can access it from within your code. The exact method for accessing the file will depend on the programming language you are using and the specific online compiler you are using. In general, you can use the file's path or URL to read its contents into your program.
Note that some online compilers may have restrictions on the size or type of files that can be uploaded. Be sure to check the documentation or help files for the online compiler you are using to ensure that your dataset can be uploaded and used in your program.
CAESAR CIPHER
def encrypt(plaintext, shift):
result = ""
for char in plaintext:
if 'A' <= char <= 'Z':
result += chr((ord(char) - ord('A') + shift) % 26 + ord('A'))
elif 'a' <= char <= 'z':
result += chr((ord(char) - ord('a') + shift) % 26 + ord('a'))
elif '0' <= char <= '9':
result += chr((ord(char) - ord('0') + shift) % 10 + ord('0'))
else:
result += char
return result
def decrypt(ciphertext, shift):
result = ""
for char in ciphertext:
if 'A' <= char <= 'Z':
result += chr((ord(char) - ord('A') - shift + 26) % 26 + ord('A'))
elif 'a' <= char <= 'z':
result += chr((ord(char) - ord('a') - shift + 26) % 26 + ord('a'))
elif '0' <= char <= '9':
result += chr((ord(char) - ord('0') - shift + 10) % 10 + ord('0'))
else:
result += char
return result
Main interaction
def main():
choice = input("Do you want to (E)ncrypt or (D)ecrypt? ").strip().upper()
message = input("Enter the message: ")
shift = int(input("Enter the shift value: "))
if choice == 'E':
encrypted = encrypt(message, shift)
print("Encrypted message:", encrypted)
elif choice == 'D':
decrypted = decrypt(message, shift)
print("Decrypted message:", decrypted)
else:
print("Invalid choice. Please enter E or D.")
if name == "main":
main()