Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions day 3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,21 @@ sets, list, tuples
#learnt about dictionary, boolean data type, binary data type.
#swap and delete in python is so easy. about operator and all


#jun 3 - day 5
Type Casting
Type casting is explicitly converting a variable from one data type to another using built-in functions like int, float, str

Conditional statements like if-else, if elif-else:
Nested a loop .

Jun 4 - day 6
string mehtods like strip(), lower(),title()]
the input dyanmics

Jun5 - day 7
while condition with boolean flags
break and continue usage
append() and len() function uses
list use

38 changes: 38 additions & 0 deletions day5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
age_input = "19" #here it is string data type

#age = age_input+1 #ERROR: Can not add number to a string
#print(age)

#solution: type casting
age_input = int(age_input) #type casted to integer

print(age_input + 1)

raw_score = "3.96"

#Casting string to float
final_score = float(raw_score)
print(f"Converted {raw_score} to float: {final_score}")


user_score = float(input("Enter your GPA score(0.00 - 4.00): "))

#Conditional decision making:
if user_score >= 3.60:
print("Good Peformance | A Grade")
elif user_score >= 3.00:
print("Solid work | B Grade")
elif user_score >= 2.00:
print("Satisfactory | C Grade")
else:
print("Needs Improvement | D Grade")

user_input = input("Enter any integer to check if it is even or odd:")

#checking using nested loops:
if user_input.isdigit(): #checking if the input is a digit
number = int(user_input) #type casted to integer
if number % 2 == 0:
print(f"{number} is an even number.")
else:
print(f"{number} is an odd number.")
22 changes: 22 additions & 0 deletions day6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#DAY 6

# input
raw_name = input("Enter your full name: ")

# Cleaning the data
clean_name = raw_name.strip().title()

# Using the data in a logical check
department = input("Enter your department (CSE/CE/AR): ").strip().upper()

print(f"\n--- Student Profile Created ---")
print(f"Name: {clean_name}")
print(f"Department: {department}")

# 4. Checking content within strings
email = input("Enter your email address: ").strip().lower()

if "@" in email and email.endswith(".com"):
print("Email Status: Valid format.")
else:
print("Email Status: Invalid. Please check your email entry.")
38 changes: 38 additions & 0 deletions day7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
print("-------------------------")
print("---System Registration---")
print("-------------------------")

active = True

registered_users = []

while active:
username = input("\nCreate a username.Or type 'exit' to quit: ").strip().lower()

if username == "exit":
print("Closing registration system")
break #Loop ends immediately.

if len(username) < 4:
print("⚠️ Error: Username must be at least 4 characters long.")
continue # skips the rest of the code, it goes to the top

#only if the input passes validation above
print(f"✅ Username '{username}' is available!")

#storing users into a list
registered_users.append(username)

current_count = len(registered_users)
print(f"Total users registered till now are: {current_count}")

#adding more users
choice = input("Register another user?(yes/no): ").strip().lower()
if choice != "yes":
active = False
#since the while runs for the true so the loop will end if user puts anything beside yes

print("\nSystem shut down successfully.")
print("\n---Final Database Summary---")
print(f"Total successfull registrations: {len(registered_users)}")
print(f"Registered List: {registered_users}")
29 changes: 29 additions & 0 deletions projec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
print("-----Should I go to College?-(Bot)-----")

#The initialize scenario
today_status = {
"is_raining": True,
"is_assignment_due" :False,
"is_practical_day": True
}

#Input from user
energy_level = int(input("How is the energy level today(1-10): "))
feeling_lazy = input("Are you feeling extra lazy today?(yes/no):").lower()=="yes"

#Let's make a decision
print("\n--Decision Making--")

if today_status["is_practical_day"] or today_status["is_assignment_due"]:
print("Verdict! YOU MUST GO Practical marks and assignments are too important to skip!")

elif today_status["is_raining"] and feeling_lazy:
print("Verdict: STAY HOME. It's raining and you're tired. Perfect day for self-study in VS Code.")

elif energy_level > 7 and not feeling_lazy:
print("Verdict: GO TO CLASS. You have the energy, don't waste the day!")

else:
print("Verdict: YOUR CHOICE. Maybe just join the theory session and come back early.")

print("\n==========================================")