Skip to content

Commit 5987a49

Browse files
authored
Merge branch 'N00BSC00B:main' into main
2 parents b25b251 + c4a2281 commit 5987a49

File tree

19 files changed

+900
-11
lines changed

19 files changed

+900
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,4 @@ cython_debug/
205205
marimo/_static/
206206
marimo/_lsp/
207207
__marimo__/
208+
FETCH_HEAD

CONTRIBUTORS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Thank you to all the amazing people who have contributed to this project! 🎉
88
- [@harsh-askainstein](https://github.com/harsh-askainstein)
99
- [@Ashish-Kumar-Dash](https://github.com/Ashish-Kumar-Dash)
1010
- [@shresth2708](https://github.com/shresth2708)
11+
- [@Golixco](https://github.com/Golixco)
12+
- [@ilyas829](https://github.com/ilyas829)
13+
- [@Shreekant-Bharti](https://github.com/Shreekant-Bharti)
14+
- [@Shrihari25-hub](https://github.com/Shrihari25-hub)
15+
- [@pawanrajsingh2088](https://github.com/pawanrajsingh2088)
16+
- [@AnushkaJagtap22](https://github.com/AnushkaJagtap22)
1117

1218
## How to Get Listed
1319

basics/variables_and_data_types.py renamed to basics/02_variables_and_data_types/variables_and_data_types.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,30 @@
316316
print(f"Words: {words}")
317317

318318
print("\n=== End of Tutorial ===")
319-
print("Practice tip: Try modifying the values and see how the results change!")
319+
print("Practice tip: Try modifying the values and see how the results change!")
320+
321+
# =============================================================================
322+
# 11. SUMMARY TABLE OF PYTHON DATA TYPES
323+
# =============================================================================
324+
325+
print("--- Summary of Python Data Types ---\n")
326+
327+
data_types_summary = [
328+
("int", "Whole numbers (e.g., 5, -10, 2025)"),
329+
("float", "Decimal numbers (e.g., 3.14, -2.5)"),
330+
("complex", "Numbers with real and imaginary parts (e.g., 2 + 3j)"),
331+
("str", "Sequence of characters (e.g., 'Hello')"),
332+
("bool", "Boolean values True or False"),
333+
("list", "Ordered, mutable collection (e.g., [1, 2, 3])"),
334+
("tuple", "Ordered, immutable collection (e.g., (1, 2, 3))"),
335+
("dict", "Key-value pairs (e.g., {'name': 'Alice', 'age': 25})"),
336+
("set", "Unordered collection of unique elements (e.g., {1, 2, 3})"),
337+
]
338+
339+
print(f"{'Data Type':<10} | Description")
340+
print("-" * 50)
341+
for dtype, desc in data_types_summary:
342+
print(f"{dtype:<10} | {desc}")
343+
344+
print("\n💡 Tip: Use the 'type()' function to check any variable’s data type!")
345+
print("\n=== End of Extended Tutorial ===")
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"""
2+
Title: Python Control Structures Tutorial
3+
Author: Python-Basics-to-Advanced Contributors
4+
Difficulty: Beginner
5+
Description: Detailed guide to if-else, loops, break, continue, and control flow in Python
6+
Date: October 2025
7+
"""
8+
9+
print("=== Python Control Structures Tutorial ===\n")
10+
11+
# =============================================================================
12+
# 1. CONDITIONAL STATEMENTS
13+
# =============================================================================
14+
15+
number = int(input("Enter a number: "))
16+
17+
if number > 0:
18+
print("The number is positive.")
19+
elif number == 0:
20+
print("The number is zero.")
21+
else:
22+
print("The number is negative.")
23+
24+
# =============================================================================
25+
# 2. FOR LOOP
26+
# =============================================================================
27+
28+
print("\nCounting from 1 to 5:")
29+
for i in range(1, 6):
30+
print(i)
31+
32+
# =============================================================================
33+
# 3. WHILE LOOP
34+
# =============================================================================
35+
36+
print("\nCounting down from 5 to 1:")
37+
count = 5
38+
while count > 0:
39+
print(count)
40+
count -= 1
41+
42+
# =============================================================================
43+
# 4. BREAK STATEMENT
44+
# =============================================================================
45+
46+
print("\nFinding the first number divisible by 3 between 10 and 20:")
47+
for num in range(10, 21):
48+
if num % 3 == 0:
49+
print(f"Found: {num}")
50+
break
51+
52+
# =============================================================================
53+
# 5. CONTINUE STATEMENT
54+
# =============================================================================
55+
56+
print("\nPrinting numbers between 1 and 10 skipping multiples of 3:")
57+
for num in range(1, 11):
58+
if num % 3 == 0:
59+
continue
60+
print(num)
61+
62+
print("\n=== End of Control Structures Tutorial ===")
63+
print("Practice tip: Modify the range and conditions to see different outputs and behaviors.")
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
"""
2+
Title: Python Functions Tutorial
3+
Author: Python-Basics-to-Advanced Contributors
4+
Difficulty: Beginner
5+
Description: Comprehensive guide to defining and using functions in Python with examples
6+
Date: October 2025
7+
"""
8+
9+
# =============================================================================
10+
# 1. DEFINING FUNCTIONS
11+
# =============================================================================
12+
13+
print("=== Python Functions Tutorial ===\n")
14+
15+
def greet(name):
16+
"""
17+
Greets a person by name.
18+
19+
Args:
20+
name (str): The person's name.
21+
22+
Returns:
23+
str: Greeting message.
24+
"""
25+
return f"Hello, {name}!"
26+
27+
print(greet("Alice"))
28+
29+
# =============================================================================
30+
# 2. FUNCTION PARAMETERS AND DEFAULTS
31+
# =============================================================================
32+
33+
def power(base, exponent=2):
34+
"""
35+
Calculates the power of a base number.
36+
37+
Args:
38+
base (int or float): Base number.
39+
exponent (int or float): Exponent, default is 2.
40+
41+
Returns:
42+
int or float: Result of base raised to exponent.
43+
"""
44+
return base ** exponent
45+
46+
print(f"5^2 = {power(5)}")
47+
print(f"3^3 = {power(3, 3)}")
48+
49+
# =============================================================================
50+
# 3. RETURNING MULTIPLE VALUES
51+
# =============================================================================
52+
53+
def arithmetic_ops(a, b):
54+
"""
55+
Performs basic arithmetic operations on two numbers.
56+
57+
Args:
58+
a (int or float): First number.
59+
b (int or float): Second number.
60+
61+
Returns:
62+
tuple: Sum, difference, product, and quotient.
63+
"""
64+
sum_ = a + b
65+
diff = a - b
66+
prod = a * b
67+
quo = a / b if b != 0 else None
68+
return sum_, diff, prod, quo
69+
70+
s, d, p, q = arithmetic_ops(10, 5)
71+
print(f"Sum: {s}, Difference: {d}, Product: {p}, Quotient: {q}")
72+
73+
# =============================================================================
74+
# 4. LAMBDA (ANONYMOUS) FUNCTIONS
75+
# =============================================================================
76+
77+
add = lambda x, y: x + y
78+
square = lambda x: x * x
79+
80+
print(f"Add 3 + 4 = {add(3, 4)}")
81+
print(f"Square of 6 = {square(6)}")
82+
83+
# =============================================================================
84+
# 5. FUNCTION SCOPE AND LOCAL VARIABLES
85+
# =============================================================================
86+
87+
def demonstrate_scope():
88+
x = 10 # local variable
89+
print(f"Inside function, x = {x}")
90+
91+
demonstrate_scope()
92+
# print(x) # This would raise an error because x is local
93+
94+
print("\n=== End of Functions Tutorial ===")
95+
print("Practice tip: Try creating your own functions and experimenting with parameters and returns!")
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Title: Simple Calculator
3+
Author: Python-Basics-to-Advanced
4+
Difficulty: Beginner
5+
Description: Basic calculator supporting +, -, *, / operations with input validation
6+
"""
7+
8+
def calculator():
9+
print("Simple Calculator")
10+
try:
11+
a = float(input("Enter first number: "))
12+
b = float(input("Enter second number: "))
13+
except ValueError:
14+
print("Invalid input. Please enter numeric values.")
15+
return
16+
17+
op = input("Choose operation (+, -, *, /): ")
18+
19+
if op == '+':
20+
print(f"Result: {a + b}")
21+
elif op == '-':
22+
print(f"Result: {a - b}")
23+
elif op == '*':
24+
print(f"Result: {a * b}")
25+
elif op == '/':
26+
if b == 0:
27+
print("Error: Cannot divide by zero")
28+
else:
29+
print(f"Result: {a / b}")
30+
else:
31+
print("Invalid operation")
32+
33+
if __name__ == "__main__":
34+
calculator()

basics/swap_numbers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Swap two numbers in Python
2+
3+
a = 5
4+
b = 10
5+
6+
print(f"Before swap: a={a}, b={b}")
7+
8+
# Swapping
9+
a, b = b, a
10+
11+
print(f"After swap: a={a}, b={b}")

basics/text_manipulator.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import re
2+
import base64
3+
4+
def to_upper(text):
5+
return text.upper()
6+
7+
def to_lower(text):
8+
return text.lower()
9+
10+
def capitalize_words(text):
11+
return text.title()
12+
13+
def reverse_text(text):
14+
return text[::-1]
15+
16+
def remove_spaces(text):
17+
return text.replace(" ", "")
18+
19+
def remove_punctuation(text):
20+
return re.sub(r'[^\w\s]', '', text)
21+
22+
def word_count(text):
23+
words = text.split()
24+
return len(words)
25+
26+
def char_count(text):
27+
return len(text)
28+
29+
def vowel_consonant_count(text):
30+
vowels = "aeiouAEIOU"
31+
v = sum(1 for ch in text if ch in vowels)
32+
c = sum(1 for ch in text if ch.isalpha() and ch not in vowels)
33+
return v, c
34+
35+
def find_replace(text, find, replace):
36+
return text.replace(find, replace)
37+
38+
def encrypt_text(text):
39+
return base64.b64encode(text.encode()).decode()
40+
41+
def decrypt_text(text):
42+
try:
43+
return base64.b64decode(text.encode()).decode()
44+
except:
45+
return "Invalid encrypted text!"
46+
47+
# ---------- Main Program ----------
48+
if __name__ == "__main__":
49+
text = input("Enter your text: ")
50+
51+
while True:
52+
print("\n--- TEXT MANIPULATOR MENU ---")
53+
print("1. Convert to UPPERCASE")
54+
print("2. Convert to lowercase")
55+
print("3. Capitalize Each Word")
56+
print("4. Reverse Text")
57+
print("5. Remove Spaces")
58+
print("6. Remove Punctuation")
59+
print("7. Word Count")
60+
print("8. Character Count")
61+
print("9. Vowel & Consonant Count")
62+
print("10. Find & Replace")
63+
print("11. Encrypt Text")
64+
print("12. Decrypt Text")
65+
print("13. Exit")
66+
67+
choice = input("Enter choice: ")
68+
69+
if choice == "1":
70+
print(to_upper(text))
71+
elif choice == "2":
72+
print(to_lower(text))
73+
elif choice == "3":
74+
print(capitalize_words(text))
75+
elif choice == "4":
76+
print(reverse_text(text))
77+
elif choice == "5":
78+
print(remove_spaces(text))
79+
elif choice == "6":
80+
print(remove_punctuation(text))
81+
elif choice == "7":
82+
print("Word count:", word_count(text))
83+
elif choice == "8":
84+
print("Character count:", char_count(text))
85+
elif choice == "9":
86+
v, c = vowel_consonant_count(text)
87+
print("Vowels:", v, "Consonants:", c)
88+
elif choice == "10":
89+
f = input("Word to find: ")
90+
r = input("Replace with: ")
91+
text = find_replace(text, f, r)
92+
print("Updated text:", text)
93+
elif choice == "11":
94+
text = encrypt_text(text)
95+
print("Encrypted:", text)
96+
elif choice == "12":
97+
text = decrypt_text(text)
98+
print("Decrypted:", text)
99+
elif choice == "13":
100+
print("Exiting program...")
101+
break
102+
else:
103+
print("Invalid choice! Try again.")

0 commit comments

Comments
 (0)