print("Hello, world!") # Output: Hello, world!
Hello, world!
fruits = ["apple", "banana", "orange"] len(fruits) # Output: 3
3
name = input("Enter your name: ") print("Hello, " + name + "!") # Output: Hello, [user's name]!
x = 5 type(x) # Output: <class 'int'>
int
numbers = [10, 5, 8, 12] max(numbers) # Output: 12
12
numbers = [10, 5, 8, 12] min(numbers) # Output: 5
5
numbers = [1, 2, 3, 4, 5] sum(numbers) # Output: 15
15
x = 3.14159 round(x, 2) # Output: 3.14
3.14
x = 10 print("The value is " + str(x)) # Output: The value is 10
The value is 10
numbers = [5, 2, 8, 1, 9] sorted_numbers = sorted(numbers) print(sorted_numbers) # Output: [1, 2, 5, 8, 9]
[1, 2, 5, 8, 9]