Sure! Here are the updated scripts with user inputs:
Description: Introduce students to the basic syntax of Python by printing a simple message.
# Task 1: Print "Hello, World!"
print("Hello, World!")Description: Teach students how to perform basic arithmetic operations such as addition, subtraction, multiplication, and division.
# Task 2: Basic Arithmetic Operations
a = float(input("Enter the first number: "))
b = float(input("Enter the second number: "))
# Addition
print("Addition:", a + b)
# Subtraction
print("Subtraction:", a - b)
# Multiplication
print("Multiplication:", a * b)
# Division
print("Division:", a / b)Description: Use variables and math functions to calculate the area of a rectangle.
# Task 3: Calculate the Area of a Rectangle
length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the width of the rectangle: "))
area = length * width
print("Area of the rectangle:", area)Description: Introduce the math module to find the square root of a number.
# Task 4: Find the Square Root
import math
number = float(input("Enter a number to find its square root: "))
square_root = math.sqrt(number)
print("Square root of", number, "is", square_root)Description: Use math functions to calculate the circumference of a circle given its radius.
# Task 5: Calculate the Circumference of a Circle
import math
radius = float(input("Enter the radius of the circle: "))
circumference = 2 * math.pi * radius
print("Circumference of the circle:", circumference)Description: Teach students how to convert temperatures from Celsius to Fahrenheit.
# Task 6: Temperature Conversion (Celsius to Fahrenheit)
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print(celsius, "Celsius is equal to", fahrenheit, "Fahrenheit")Description: Use a loop to calculate the factorial of a number.
# Task 7: Calculate the Factorial of a Number
number = int(input("Enter a number to find its factorial: "))
factorial = 1
for i in range(1, number + 1):
factorial *= i
print("Factorial of", number, "is", factorial)Description: Use built-in functions to find the maximum and minimum values in a list.
# Task 8: Find the Maximum and Minimum in a List
numbers = input("Enter a list of numbers separated by spaces: ").split()
numbers = [float(num) for num in numbers]
maximum = max(numbers)
minimum = min(numbers)
print("Maximum value:", maximum)
print("Minimum value:", minimum)Description: Use conditionals to check if a number is even or odd.
# Task 9: Check for Even or Odd Number
number = int(input("Enter a number to check if it is even or odd: "))
if number % 2 == 0:
print(number, "is an even number")
else:
print(number, "is an odd number")Description: Use a loop to calculate the sum of the first N natural numbers.
# Task 10: Sum of Natural Numbers
N = int(input("Enter a number to find the sum of the first N natural numbers: "))
sum_of_numbers = 0
for i in range(1, N + 1):
sum_of_numbers += i
print("Sum of the first", N, "natural numbers is", sum_of_numbers)These tasks now take user inputs, making them more interactive and allowing students to practice entering data and seeing how the program responds.