-
Notifications
You must be signed in to change notification settings - Fork 844
Practice python #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Practice python #39
Conversation
Updated the README to reflect the purpose of the repository and added a status section.
This script demonstrates data analysis techniques using loops, including filtering high sales, cleaning data, and handling errors.
Implemented a basic Student Management System in C++ that allows adding and displaying student information.
from code with harry course i got knowledge and hand on code data types in python
Fix variable name from 'joke' to 'jokes' for correct output.
This script lists the contents of a specified directory using the os module.
i learned in dictonary how i can use in daily life eg. marks gain via python programming dictonary
Fix syntax errors in multiplication table generation.
Fix function name and syntax errors in inches_to_cm.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a set of small Python practice scripts and updates the repository README to reflect personal learning/experimentation.
Changes:
- Introduces multiple new beginner-level scripts covering input/typecasting, operators, loops, slicing, lists/tuples/dicts, and simple calculations.
- Adds a
my_practice/folder with additional examples and a folder README. - Replaces the top-level README with a shorter “learning & practice” description.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| usertypetable.py | Adds a multiplication-table practice script (currently has parsing/logic issues). |
| typecast.py | Adds a simple input() + type() demonstration. |
| tabspaceandneline.py | Adds an escape-sequence string example (currently not valid Python syntax). |
| table.py | Adds a multiplication-table script variant (currently has parsing/runtime issues). |
| remainder.py | Adds a modulus/remainder example. |
| operators.py | Adds examples for arithmetic/assignment/comparison/logical operators. |
| negative_slicing.py | Adds string slicing/negative slicing examples (one slice prints empty output as written). |
| my_practice/pyjokes.py | Adds a pyjokes example (currently uses wrong API/variable name). |
| my_practice/practice-loops | Adds a loop-based “data analysis practice” script (filename lacks .py). |
| my_practice/datatypes.py | Adds basic datatype variable examples. |
| my_practice/README.md | Adds a short description of the my_practice/ folder. |
| list_methodft.wwe.py | Adds list-method practice (currently calls prints() which is undefined). |
| list.py | Adds list indexing/mutation practice (currently invalid identifier/undefined variables). |
| inches_to_cm.py | Adds an inches-to-cm conversion function (currently has syntax/name issues). |
| fvarible{},py | Adds an f-string greeting example (filename is not a valid/portable Python module name). |
| diconary.py | Adds a dictionary example (currently indexes a non-existent key). |
| calcualte_bmi.py | Adds a BMI calculation example (filename appears misspelled). |
| avgfunction.pty | Adds an average calculation example (non-standard file extension). |
| age_eligibility.py | Adds an if/else age eligibility example. |
| README.md | Updates the repository README to describe it as a learning/practice fork. |
| FileExplorer.Py | Adds an os.listdir directory listing example (unusual .Py casing). |
| 4tuple_methods.py | Adds tuple methods example (currently has assignment/value errors). |
| 03_tuple.py | Adds a basic tuple creation/type print example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| joke=pyjokes.getjokes() | ||
| print(jokes) |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyjokes.getjokes() is not the API used elsewhere in this repo (see Chapter 1/module.py:6 which uses pyjokes.get_joke()), and print(jokes) references an undefined variable (you assigned to joke). Update the call and print the correct variable.
| joke=pyjokes.getjokes() | |
| print(jokes) | |
| joke = pyjokes.get_joke() | |
| print(joke) |
| @@ -0,0 +1,11 @@ | |||
| candidates = ["John cena","undertaker","Roman Reings",5,4.45,True] | |||
| prints(candidates) | |||
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prints(candidates) will raise NameError because prints is not defined. Use print(candidates) if the intent is to display the list.
| prints(candidates) | |
| print(candidates) |
| @@ -0,0 +1,9 @@ | |||
| # BMI 🏋️♀️ | |||
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename calcualte_bmi.py appears to be misspelled ("calcualte" vs "calculate"), which can make it harder to find/import later. Consider renaming the file to calculate_bmi.py.
| import os # 📦 Import the built-in 'os' module to interact with the operating system | ||
|
|
||
| # 📂 Select the directory whose contents you want to list | ||
| directory_path = '/' |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename uses an uncommon casing/extension (.Py). On case-sensitive systems this can be easy to mistype and may not match import expectations. Consider renaming to file_explorer.py (or at least FileExplorer.py).
| "Rihan":100, | ||
| "Nihal":99, | ||
| } | ||
| print(marks["Rihan:"]) |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marks["Rihan:"] will raise a KeyError because the dictionary key is "Rihan" (no colon). Use the exact key name when indexing the dict.
| print(marks["Rihan:"]) | |
| print(marks["Rihan"]) |
| def inch_to_cm(inch) | ||
| return inch * 2.54 | ||
| n = int(input('enter value in inches: ")) | ||
| print(f"the corresponding vlaue in cms is (inches_to_cms(n)}") |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function/file won’t run due to syntax errors: missing : after the def line, inconsistent string quotes in the input(...) call, and the final print(...) references a different name (inches_to_cms) than the function defined. Fix the function signature and use the correct function name in the f-string.
| def inch_to_cm(inch) | |
| return inch * 2.54 | |
| n = int(input('enter value in inches: ")) | |
| print(f"the corresponding vlaue in cms is (inches_to_cms(n)}") | |
| def inch_to_cm(inch): | |
| return inch * 2.54 | |
| n = int(input("enter value in inches: ")) | |
| print(f"the corresponding vlaue in cms is {inch_to_cm(n)}") |
| @@ -0,0 +1,5 @@ | |||
| a = 12 | |||
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename uses a non-standard extension (.pty), which prevents Python tooling (linters, test discovery, editors) from recognizing this as a Python script. Consider renaming the file to use .py.
|
|
||
| # Comparison Operators | ||
|
|
||
| d = 5==5 |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparison of constants; use 'True' or 'False' instead.
| d = 5==5 | |
| d = True |
| import pyjokes | ||
|
|
||
| # print("printing jokes") | ||
|
|
||
| # this prints a random jokes | ||
| joke=pyjokes.getjokes() | ||
| print(jokes) |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module 'pyjokes' imports itself.
| import pyjokes | |
| # print("printing jokes") | |
| # this prints a random jokes | |
| joke=pyjokes.getjokes() | |
| print(jokes) | |
| import random | |
| # print("printing jokes") | |
| # this prints a random jokes | |
| _JOKES = [ | |
| "Why do Python developers wear glasses? Because they can't C.", | |
| "There are only 10 kinds of people in this world: those who know binary and those who don't.", | |
| "A programmer walks into a bar and orders 1.000000119 beers.", | |
| ] | |
| def getjokes(): | |
| """Return a random joke from the local joke list.""" | |
| return random.choice(_JOKES) | |
| joke = getjokes() | |
| print(joke) |
| joke=pyjokes.getjokes() | ||
| print(jokes) |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print statement may execute during import.
| joke=pyjokes.getjokes() | |
| print(jokes) | |
| def main(): | |
| joke = pyjokes.getjokes() | |
| print(joke) | |
| if __name__ == "__main__": | |
| main() |
No description provided.