commit 7fb2e11dc8f8240bf8afb0c379d48cdae7c58f61
parent c498870e5013708a1a937975d2fc50a93508b17f
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Wed, 11 Feb 2026 20:29:53 +0530
[2026-02-11] : .\{root} : edited assignment files
Diffstat:
6 files changed, 171 insertions(+), 39 deletions(-)
diff --git a/Semester_1/assignment-primary/Assignment.docx b/Semester_1/assignment-primary/Assignment.docx
Binary files differ.
diff --git a/Semester_1/assignment-primary/Assignment.pdf b/Semester_1/assignment-primary/Assignment.pdf
Binary files differ.
diff --git a/Semester_1/assignment-primary/assignment-p-12_v2.c b/Semester_1/assignment-primary/assignment-p-12_v2.c
@@ -7,4 +7,35 @@
*/
/* Write a C program that takes multiple integers as command-line arguments and finds the
-maximum and minimum value among them. */-
\ No newline at end of file
+maximum and minimum value among them. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ int current_val, max_val, min_val, i;
+ if (argc < 2)
+ {
+ printf("Usage: %s <integer1> <integer2> ...\n", argv[0]);
+ return 1;
+ }
+ max_val = atoi(argv[1]);
+ min_val = atoi(argv[1]);
+ for (i = 2; i < argc; i++)
+ {
+ current_val = atoi(argv[i]);
+
+ if (current_val > max_val)
+ {
+ max_val = current_val;
+ }
+ if (current_val < min_val)
+ {
+ min_val = current_val;
+ }
+ }
+ printf("The maximum value is: %d\n", max_val);
+ printf("The minimum value is: %d\n", min_val);
+ return 0;
+}+
\ No newline at end of file
diff --git a/Semester_1/assignment-primary/assignment-p-13.c b/Semester_1/assignment-primary/assignment-p-13.c
@@ -13,6 +13,7 @@ otherwise. */
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
int isPalindrome(char[]);
@@ -25,7 +26,7 @@ int main(int argc, char *argv[])
}
if (isPalindrome(argv[1]))
{
- printf("\nThe entered string \"%s\" is a Palindrome.\n", argv[1]);
+ printf("\nThe entered string \"%s\" is Palindrome.\n", argv[1]);
}
else
{
@@ -37,21 +38,6 @@ int main(int argc, char *argv[])
int isPalindrome(char str[])
{
char *start = str;
- char *end = str;
- if (*end != '\0')
- {
- while (*(end + 1) != '\0')
- {
- end++;
- }
- }
- else
- {
- return 1;
- }
- /*
- Or we can use string.h instead of from line 33 to line 43 like this ...
-
char *end;
int len = strlen(str);
if (len == 0)
@@ -59,8 +45,6 @@ int isPalindrome(char str[])
return 1;
}
end = str + (len - 1);
-
- */
while (start < end)
{
if (*start != *end)
diff --git a/docs/index.html b/docs/index.html
@@ -1199,7 +1199,38 @@ int main(int argc, char *argv[])
*/
/* Write a C program that takes multiple integers as command-line arguments and finds the
-maximum and minimum value among them. */</div>
+maximum and minimum value among them. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ int current_val, max_val, min_val, i;
+ if (argc < 2)
+ {
+ printf("Usage: %s <integer1> <integer2> ...\n", argv[0]);
+ return 1;
+ }
+ max_val = atoi(argv[1]);
+ min_val = atoi(argv[1]);
+ for (i = 2; i < argc; i++)
+ {
+ current_val = atoi(argv[i]);
+
+ if (current_val > max_val)
+ {
+ max_val = current_val;
+ }
+ if (current_val < min_val)
+ {
+ min_val = current_val;
+ }
+ }
+ printf("The maximum value is: %d\n", max_val);
+ printf("The minimum value is: %d\n", min_val);
+ return 0;
+}</div>
</div>
<div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
@@ -1230,6 +1261,7 @@ otherwise. */
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
int isPalindrome(char[]);
@@ -1242,7 +1274,7 @@ int main(int argc, char *argv[])
}
if (isPalindrome(argv[1]))
{
- printf("\nThe entered string \"%s\" is a Palindrome.\n", argv[1]);
+ printf("\nThe entered string \"%s\" is Palindrome.\n", argv[1]);
}
else
{
@@ -1254,21 +1286,6 @@ int main(int argc, char *argv[])
int isPalindrome(char str[])
{
char *start = str;
- char *end = str;
- if (*end != '\0')
- {
- while (*(end + 1) != '\0')
- {
- end++;
- }
- }
- else
- {
- return 1;
- }
- /*
- Or we can use string.h instead of from line 33 to line 43 like this ...
-
char *end;
int len = strlen(str);
if (len == 0)
@@ -1276,8 +1293,6 @@ int isPalindrome(char str[])
return 1;
}
end = str + (len - 1);
-
- */
while (start < end)
{
if (*start != *end)
@@ -23221,6 +23236,64 @@ int main()
</div>
</div>
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-knowledge_graph-py', 'knowledge_graph.py', 'https://github.com/notamitgamer/bsc/blob/main/knowledge_graph.py')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">knowledge_graph.py</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/knowledge_graph.py" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-knowledge_graph-py" style="display:none;">import json
+import urllib.request
+import urllib.parse
+
+# Replace with your actual API Key from Google Cloud Console
+API_KEY = 'YOUR_API_KEY'
+query = 'Amit Dutta notamitgamer'
+service_url = 'https://kgsearch.googleapis.com/v1/entities:search'
+
+params = {
+ 'query': query,
+ 'limit': 5, # Increased limit to see if there are multiple Amit Duttas
+ 'indent': True,
+ 'key': API_KEY,
+}
+
+url = service_url + '?' + urllib.parse.urlencode(params)
+
+try:
+ response = json.loads(urllib.request.urlopen(url).read())
+
+ print(f"{'Name':<20} | {'Score':<10} | {'ID':<20}")
+ print("-" * 55)
+
+ if response.get('itemListElement'):
+ for element in response['itemListElement']:
+ result = element['result']
+ score = element.get('resultScore')
+ name = result.get('name')
+ kg_id = result.get('@id')
+
+ # This prints the same data structure as the Taylor Swift example
+ print(f"{name:<20} | {score:<10.2f} | {kg_id:<20}")
+
+ # Check for description or detailed data
+ description = result.get('description', 'No description yet')
+ print(f" -> Info: {description}")
+ print(f" -> Types: {', '.join(result.get('@type', []))}\n")
+ else:
+ print("No entity found in the Knowledge Graph yet.")
+
+except Exception as e:
+ print(f"An error occurred: {e}")</div>
+ </div>
+
</div>
</div>
</div>
diff --git a/knowledge_graph.py b/knowledge_graph.py
@@ -0,0 +1,43 @@
+import json
+import urllib.request
+import urllib.parse
+
+# Replace with your actual API Key from Google Cloud Console
+API_KEY = 'YOUR_API_KEY'
+query = 'Amit Dutta notamitgamer'
+service_url = 'https://kgsearch.googleapis.com/v1/entities:search'
+
+params = {
+ 'query': query,
+ 'limit': 5, # Increased limit to see if there are multiple Amit Duttas
+ 'indent': True,
+ 'key': API_KEY,
+}
+
+url = service_url + '?' + urllib.parse.urlencode(params)
+
+try:
+ response = json.loads(urllib.request.urlopen(url).read())
+
+ print(f"{'Name':<20} | {'Score':<10} | {'ID':<20}")
+ print("-" * 55)
+
+ if response.get('itemListElement'):
+ for element in response['itemListElement']:
+ result = element['result']
+ score = element.get('resultScore')
+ name = result.get('name')
+ kg_id = result.get('@id')
+
+ # This prints the same data structure as the Taylor Swift example
+ print(f"{name:<20} | {score:<10.2f} | {kg_id:<20}")
+
+ # Check for description or detailed data
+ description = result.get('description', 'No description yet')
+ print(f" -> Info: {description}")
+ print(f" -> Types: {', '.join(result.get('@type', []))}\n")
+ else:
+ print("No entity found in the Knowledge Graph yet.")
+
+except Exception as e:
+ print(f"An error occurred: {e}")+
\ No newline at end of file