⚠
️ DEPRECATED GITLAB INSTANCE
⚠
️ This GitLab is now read-only for reference. Please use
https://gitlab.iauro.co
for all new work.
Migration completed on September 17, 2025
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IauroAssignments
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Piyush Singh
IauroAssignments
Commits
00cecae5
Commit
00cecae5
authored
Sep 16, 2025
by
Piyush Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add files inside Python (module1)
parent
ab65f347
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
236 additions
and
0 deletions
+236
-0
Python (module1)/Calculator (tkinter).py
Python (module1)/Calculator (tkinter).py
+111
-0
Python (module1)/File_parser.py
Python (module1)/File_parser.py
+18
-0
Python (module1)/Student manager.py
Python (module1)/Student manager.py
+107
-0
No files found.
Python (module1)/Calculator (tkinter).py
0 → 100644
View file @
00cecae5
import
tkinter
as
tk
import
re
window
=
tk
.
Tk
()
window
.
grid_columnconfigure
(
0
,
weight
=
1
)
window
.
title
(
"Calculator"
)
window
.
geometry
(
"400x600"
)
window
.
grid_rowconfigure
(
0
,
weight
=
1
)
window
.
grid_columnconfigure
(
0
,
weight
=
1
)
buttons
=
[
(
"C"
,
2
,
0
),
(
"^"
,
2
,
2
),
(
"Del"
,
2
,
3
),
(
"7"
,
3
,
0
),
(
"8"
,
3
,
1
),
(
"9"
,
3
,
2
),
(
"/"
,
3
,
3
),
(
"4"
,
4
,
0
),
(
"5"
,
4
,
1
),
(
"6"
,
4
,
2
),
(
"*"
,
4
,
3
),
(
"1"
,
5
,
0
),
(
"2"
,
5
,
1
),
(
"3"
,
5
,
2
),
(
"-"
,
5
,
3
),
(
"0"
,
6
,
0
),
(
"."
,
6
,
1
),
(
"="
,
6
,
2
),
(
"+"
,
6
,
3
),
]
temp_inp
=
[]
last_result
=
None
label
=
tk
.
Label
(
window
,
text
=
''
,
font
=
(
"Arial"
,
20
),
anchor
=
"e"
,
bg
=
"white"
)
label
.
grid
(
column
=
0
,
row
=
0
,
columnspan
=
4
,
sticky
=
"nsew"
,
padx
=
5
,
pady
=
5
)
label2
=
tk
.
Label
(
window
,
text
=
''
,
font
=
(
"Arial"
,
15
),
bg
=
"white"
)
label2
.
grid
(
row
=
1
,
column
=
0
,
columnspan
=
4
,
sticky
=
"nsew"
,
padx
=
5
,
pady
=
5
)
def
handle_expression
(
expr
:
str
)
->
str
:
"""Remove leading zeros from integers like 06 → 6."""
expr
=
expr
.
replace
(
"^"
,
"**"
)
return
re
.
sub
(
r"\b0+(\d+)(?!\.)"
,
r"\1"
,
expr
)
def
store_inp
(
num
):
global
last_result
if
num
==
"Del"
:
if
temp_inp
:
temp_inp
[
-
1
]
=
temp_inp
[
-
1
][:
-
1
]
# remove last char
if
temp_inp
[
-
1
]
==
""
:
# if empty, remove it
temp_inp
.
pop
()
elif
num
==
"C"
:
temp_inp
.
clear
()
last_result
=
None
elif
num
.
isdigit
()
or
num
==
"."
:
# number or decimal
if
temp_inp
and
temp_inp
[
-
1
]
.
replace
(
'.'
,
''
)
.
isdigit
():
# If user tries to add another ".", block it
if
num
==
"."
and
"."
in
temp_inp
[
-
1
]:
pass
# ignore extra decimal
else
:
temp_inp
[
-
1
]
+=
num
else
:
if
num
==
"."
:
temp_inp
.
append
(
"0."
)
else
:
temp_inp
.
append
(
num
)
elif
num
in
[
"+"
,
"-"
,
"*"
,
"/"
,
"^"
]:
if
temp_inp
:
if
temp_inp
[
-
1
]
in
[
"+"
,
"-"
,
"*"
,
"/"
,
"^"
]:
temp_inp
[
-
1
]
=
num
# replace operator
else
:
temp_inp
.
append
(
num
)
# add operator
elif
num
==
"="
:
expr
=
""
.
join
(
temp_inp
)
expr
=
handle_expression
(
expr
)
try
:
last_result
=
eval
(
expr
)
print
(
last_result
)
temp_inp
.
clear
()
temp_inp
.
append
(
str
(
last_result
))
# reuse same list
except
ZeroDivisionError
:
label
.
config
(
text
=
"Divide by 0 Error"
)
# label2.config(text="Divide by 0 Error")
temp_inp
.
clear
()
return
except
Exception
as
e
:
print
(
"Error"
)
print
(
e
)
temp_inp
.
clear
()
return
else
:
temp_inp
.
append
(
num
)
print
(
"else called "
)
label
.
config
(
text
=
""
.
join
(
temp_inp
))
expr
=
""
.
join
(
temp_inp
)
expr
=
handle_expression
(
expr
)
try
:
last_result
=
eval
(
expr
)
label2
.
config
(
text
=
str
(
last_result
))
except
ZeroDivisionError
:
label2
.
config
(
text
=
"Divide by 0 Error"
)
except
Exception
:
# if the expression is incomplete (like "9+"), just clear label2
label2
.
config
(
text
=
str
(
last_result
))
for
(
num
,
row
,
col
)
in
buttons
:
btn
=
tk
.
Button
(
window
,
command
=
lambda
num
=
num
:
store_inp
(
num
),
text
=
num
,
width
=
5
)
btn
.
grid
(
column
=
col
,
row
=
row
,
padx
=
3
,
pady
=
3
,
ipadx
=
5
,
ipady
=
5
,
sticky
=
"nsew"
)
# Make all columns expand equally
for
i
in
range
(
4
):
window
.
grid_columnconfigure
(
i
,
weight
=
1
)
window
.
mainloop
()
\ No newline at end of file
Python (module1)/File_parser.py
0 → 100644
View file @
00cecae5
import
argparse
import
csv
import
json
def
handle_file
(
csv_path
,
json_path
,
indent
):
with
open
(
csv_path
,
'r'
)
as
f
:
reader
=
csv
.
DictReader
(
f
)
data
=
list
(
reader
)
with
open
(
json_path
,
'w'
)
as
f
:
json
.
dump
(
data
,
f
,
indent
=
indent
)
parser
=
argparse
.
ArgumentParser
(
description
=
"My File Parser"
)
parser
.
add_argument
(
"csv_path"
,
help
=
"Path to the CSV file"
)
parser
.
add_argument
(
"json_path"
,
help
=
"Path to the JSON file"
)
parser
.
add_argument
(
"--indent"
,
help
=
"Indentation for JSON file"
,
default
=
4
,
type
=
int
)
args
=
parser
.
parse_args
()
handle_file
(
args
.
csv_path
,
args
.
json_path
,
args
.
indent
)
\ No newline at end of file
Python (module1)/Student manager.py
0 → 100644
View file @
00cecae5
class
Student
:
def
__init__
(
self
,
name
,
roll_no
,
age
,
city
):
self
.
name
=
name
self
.
roll_no
=
roll_no
self
.
age
=
age
self
.
city
=
city
def
display_info
(
self
):
print
(
f
"Name = {self.name}"
)
print
(
f
"Roll No = {self.roll_no}"
)
print
(
f
"Age = {self.age}"
)
print
(
f
"City = {self.city}"
)
class
StudentManager
:
def
__init__
(
self
):
self
.
students
=
{}
def
add_student
(
self
,
student
):
if
student
.
roll_no
not
in
self
.
students
:
self
.
students
[
student
.
roll_no
]
=
student
print
(
"✅ Student added successfully."
)
else
:
print
(
"⚠️ Student with this roll number already exists."
)
def
update_student
(
self
,
roll_no
,
city
):
if
roll_no
not
in
self
.
students
:
print
(
"⚠️ Student with this roll number does not exist."
)
else
:
self
.
students
[
roll_no
]
.
city
=
city
print
(
"✅ City updated successfully."
)
def
delete_student
(
self
,
roll_no
):
if
roll_no
not
in
self
.
students
:
print
(
"⚠️ Student with this roll number does not exist."
)
else
:
del
self
.
students
[
roll_no
]
print
(
"✅ Student deleted successfully."
)
def
display_student
(
self
,
roll_no
):
if
roll_no
not
in
self
.
students
:
print
(
"⚠️ Student with this roll number does not exist."
)
else
:
self
.
students
[
roll_no
]
.
display_info
()
def
display_all_student
(
self
):
for
i
,
j
in
self
.
students
.
items
():
j
.
display_info
()
print
(
"--------------"
)
system
=
StudentManager
()
def
safe_input
(
message
):
while
True
:
try
:
return
int
(
input
(
message
))
except
ValueError
:
print
(
"⚠️ Invalid input. Please enter a number."
)
while
True
:
print
(
"
\n
===== Student Management System ====="
)
print
(
"1. Add Student"
)
print
(
"2. Update Student"
)
print
(
"3. Delete Student"
)
print
(
"4. Display All Students"
)
print
(
"5. Exit"
)
print
(
""
)
choice
=
input
(
"Enter your choice: "
)
print
(
""
)
try
:
if
choice
==
"1"
:
name
=
input
(
"Enter name: "
)
roll_no
=
safe_input
(
"Enter Roll No: "
)
age
=
safe_input
(
"Enter age: "
)
city
=
input
(
"Enter city: "
)
s
=
Student
(
name
,
roll_no
,
age
,
city
)
system
.
add_student
(
s
)
elif
choice
==
"2"
:
roll_no
=
int
(
input
(
"Enter roll no to update: "
))
city
=
input
(
"Enter new city: "
)
system
.
update_student
(
roll_no
,
city
)
print
(
"Updated student details:"
)
system
.
display_student
(
roll_no
)
elif
choice
==
"3"
:
roll_no
=
int
(
input
(
"Enter the roll no to delete: "
))
system
.
delete_student
(
roll_no
)
elif
choice
==
"4"
:
print
(
"Displaying all students:"
)
system
.
display_all_student
()
elif
choice
==
"5"
:
print
(
"👋 Exiting Student Management System. Goodbye!"
)
break
else
:
print
(
"❌ Invalid choice. Please try again."
)
except
ValueError
:
print
(
"⚠️ Invalid input. Please enter the correct data type."
)
pass
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment