Skip to content

changing#1

Merged
MuhammadHuzaifaChaudhary merged 1 commit into
mainfrom
ui
Jul 13, 2026
Merged

changing#1
MuhammadHuzaifaChaudhary merged 1 commit into
mainfrom
ui

Conversation

@MuhammadHuzaifaChaudhary

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 13, 2026 22:05
@MuhammadHuzaifaChaudhary MuhammadHuzaifaChaudhary merged commit 4f56e0e into main Jul 13, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates a set of small Python example scripts, primarily by adding explanatory comments, minor formatting tweaks, and introducing several new beginner-focused example files (nested ifs, lambda, local/global scope, etc.).

Changes:

  • Added/expanded educational comments across multiple existing scripts.
  • Added new example scripts: nested_if.py, local_ global.py, lambda_function.py, func_argument.py, and hello.py.
  • Minor cleanup of whitespace/formatting and a few comment edits.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
while_loop.py Adds an f-string explanation comment above the infinite loop example.
switch case.py Adds explanatory comments for the case _ default branch.
strings,methods,slicing.py Minor comment cleanup and trailing newline.
nested_if.py Adds new nested-if examples (driving eligibility and a login flow).
local_ global.py Adds a new example demonstrating local vs global variables and global.
lambda_function.py Adds a new lambda usage examples script.
input.py Adds expanded explanatory comments about input types and printing.
if else.py Minor formatting change to a chained comparison example.
hello.py Adds a minimal “hello world” script.
functions.py Adds a short pass statement example at the end.
function_overloading.py Adds/adjusts comments around singledispatch and whitespace.
func_argument.py Adds a new script demonstrating positional/default/keyword arguments.
for loop.py Adds a small clarifying comment about range().
f_string.py Adds more f-string explanation/examples.
day 1.py Adds a triple-quoted block intended as a multi-line comment example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread while_loop.py
Comment on lines +28 to +29
# f string is also used to format the string in python and
# it is more efficient than + operator to concatenate the string and variable.
Comment thread switch case.py
Comment on lines +16 to +17
# if day is not 1, 2, 3, 4, or 5, this block will execute
# its just like else
Comment thread function_overloading.py
# or by using single dispatch function


# or by using singled ispatch function
Comment thread input.py
Comment on lines +9 to +17
#as age is string here suppose we take it in
# int(input(enetr your age:)) then we we will use commas instead
# of + to print the age because we cannot concatenate
# string and integer.

# if you want to use + then you have to do str(age) means
# again convert it into string to print
# because + can only concatenate string and string not
# string and integer.
Comment thread input.py
Comment on lines +27 to +28
# we can also do print(int(gpa)+int(cgpa))
# if gpa and cgpa are string type but it is not a good practice
Comment thread func_argument.py
Comment on lines +33 to +45
def describe_pet(name, animal_type, age):
print(f"{name} is a {animal_type} and is {age} years old")

# Positional
describe_pet("Max", "dog", 3)

# Keyword (order doesn't matter!)
describe_pet(animal_type="cat", name="Whiskers", age=5)
describe_pet(name="Buddy", age=2, animal_type="bird")

# Mix positional and keyword (positional must come first!)
describe_pet("Max", animal_type="dog", age=3) # ✅ Correct
# describe_pet(name="Max", "dog", age=3) # ❌ SyntaxError!
Comment thread lambda_function.py
@@ -0,0 +1,24 @@
# lambda then variable name then : then expression
Comment thread day 1.py
Comment on lines +9 to +12
"""hello how are you my gng
i am fine and you
i am also fine"""
# and these comments are multiple line comments
Comment thread nested_if.py
Comment on lines +96 to +120
username = input("Enter username: ")
password = input("Enter password: ")
account_locked = False
login_attempts = 0

if username == "admin": # Level 1
print("Username found") # Level 1

if account_locked: # Level 2
print("Account is locked") # Level 2
else: # Level 2
if password == "admin123": # Level 3
print("Login successful!") # Level 3

if login_attempts > 3: # Level 4
print("Warning: Multiple failed attempts") # Level 4
else: # Level 3
print("Incorrect password") # Level 3
login_attempts += 1 # Level 3

if login_attempts >= 5: # Level 4
print("Account locked due to too many attempts") # Level 4
account_locked = True # Level 4
else: # Level 1
print("Username not found") # Level 1 No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants