Plots will appear here when you create them with matplotlib
Console Output
Initializing Python environment...
name = "Alice"
age = 25
price = 19.99
# Single line comment
"""Multi-line
comment"""
print("Hello!")
print(f"Age: {age}")
fruits = ["apple", "banana"]
fruits.append("orange")
fruits[0] # Access by index
person = {"name": "Bob", "age": 30}
person["city"] = "NYC"
person.get("name")
coords = (10, 20)
x, y = coords # Unpacking
if score >= 90:
print("A")
elif score >= 80:
print("B")
else:
print("C")
for i in range(5):
print(i)
for item in my_list:
print(item)
count = 0
while count < 5:
print(count)
count += 1
def greet(name):
return f"Hello, {name}!"
result = greet("Alice")
def power(base, exp=2):
return base ** exp
power(3) # 9
power(3, 3) # 27
text = " Hello World "
text.strip() # Remove whitespace
text.lower() # Lowercase
text.upper() # Uppercase
text.split() # Split into list
"_".join(words) # Join list
name = "Alice"
age = 25
f"Name: {name}, Age: {age}"
"Name: {}, Age: {}".format(name, age)
nums = [3, 1, 4, 1, 5]
nums.append(9) # Add to end
nums.insert(0, 2) # Insert at index
nums.remove(1) # Remove first 1
nums.pop() # Remove last
nums.sort() # Sort in place
len(nums) # Length
squares = [x**2 for x in range(10)]
evens = [x for x in nums if x % 2 == 0]
import numpy as np
arr = np.array([1, 2, 3])
zeros = np.zeros((3, 3))
ones = np.ones((2, 4))
range_arr = np.arange(0, 10, 2)
arr.mean() # Average
arr.sum() # Sum
arr.max() # Maximum
arr.min() # Minimum
arr.std() # Standard deviation
arr.shape # Dimensions
import pandas as pd
df = pd.DataFrame({
'name': ['Alice', 'Bob'],
'age': [25, 30]
})
df = pd.read_csv('data.csv')
df.head() # First 5 rows
df.info() # Column info
df.describe() # Statistics
df['column'] # Select column
df[['col1', 'col2']] # Multiple columns
df[df['age'] > 25] # Filter rows
df.loc[0] # Row by label
df.iloc[0] # Row by position
import matplotlib.pyplot as plt
plt.plot(x, y)
plt.title('My Plot')
plt.xlabel('X axis')
plt.ylabel('Y axis')
plt.show()
plt.scatter(x, y) # Scatter
plt.bar(labels, values) # Bar
plt.hist(data) # Histogram
plt.boxplot(data) # Box plot
Ctrl + Enter Run line/block
Ctrl + Shift + Enter Run all code
Ctrl + K Command palette
Ctrl + Space Autocomplete
Ctrl + F Format code
Tab Indent
Backspace Smart unindent
Ctrl + Shift + R Toggle this panel
Ctrl + S Save code
Ctrl + / Shortcuts help
Navigate plots