-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment1.py
More file actions
76 lines (61 loc) · 1.73 KB
/
Copy pathassignment1.py
File metadata and controls
76 lines (61 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# -----------------------------
# QUESTION 1: Personal Data Collection
# -----------------------------
print("QUESTION 1: STUDENT PROFILE")
# Input
name = input("Enter your full name: ")
age = int(input("Enter your age: "))
height = float(input("Enter your height (in meters): "))
student = input("Are you a student? (True/False): ")
# Convert student to boolean
student = student == "True"
# Output
print("\n--- STUDENT PROFILE ---")
print("Name:", name)
print("Age:", age)
print("Height:", height, "meters")
print("Student:", student)
# Display data types
print("\nData Types:")
print("Name:", type(name))
print("Age:", type(age))
print("Height:", type(height))
print("Student:", type(student))
# -----------------------------
# QUESTION 2: Basic Calculator
# -----------------------------
print("\nQUESTION 2: BASIC CALCULATOR")
# Input
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
# Calculations
sum_result = num1 + num2
difference = num1 - num2
product = num1 * num2
division = num1 / num2
# Output
print("\nResults:")
print("Sum:", sum_result)
print("Difference:", difference)
print("Product:", product)
print("Division:", division)
# -----------------------------
# QUESTION 3: Simple Data Analysis
# -----------------------------
print("\nQUESTION 3: DATA ANALYSIS")
# Input
num1 = float(input("Enter first value: "))
num2 = float(input("Enter second value: "))
num3 = float(input("Enter third value: "))
# Calculations
total = num1 + num2 + num3
average = total / 3
# Find largest and smallest
largest = max(num1, num2, num3)
smallest = min(num1, num2, num3)
# Output
print("\nResults:")
print("Total:", total)
print("Average:", average)
print("Largest number:", largest)
print("Smallest number:", smallest)