-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasics.py
More file actions
36 lines (29 loc) · 1.02 KB
/
Copy pathbasics.py
File metadata and controls
36 lines (29 loc) · 1.02 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
# Phase 1: Python Foundations Exercise
# --------------------------------------
# 1. Variables & Data Types
# TODO: Create a variable for your name (string), age (int), and if you like Python (bool)
name = "Supdawg"
age = 17
likes_python = True
print(f"Hi, I'm not {name}. I am not {age} days old.")
# 2. Conditionals (If/Else)
# TODO: Write an if statement that prints "Adult" if age is 18+, else "Minor"
if age >= 18:
print("Status: Adult")
else:
print("Status: Minor")
# 3. Loops (For)
# TODO: Create a list of 3 goals and loop through them to print each one
goals = ["Learn Syntax", "Build a Project", "Master FastAPI"]
print("\nMy Python Goals:")
for goal in goals:
print(f"- {goal}")
# 4. Functions
# TODO: Complete this function to return the square of a number
def square_number(number):
return number * number
result = square_number(5)
print(f"\nThe square of 5 is: {result}")
# --------------------------------------
# Execution Tip:
# To run this, make sure your .venv is active and type: python basics.py