Skip to content

Commit d2b420d

Browse files
committed
add directories with their files
1 parent 6ee7208 commit d2b420d

3 files changed

Lines changed: 34 additions & 15 deletions

File tree

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77
#String— Text data:
88
first_name = "Marcus"
99
last_name = 'Aurelius' # single or double quotes both work
10-
full_name = first_name + " " + last_name # joining strings is called concatenation
10+
full_name = first_name + " " + last_name # joining strings is called concatenation
1111
print(full_name) # Output: Marcus Aurelius
1212

1313
#Integer — whole numbers:
1414

1515
age = 25
1616
year = 2025
1717
score = -10
18-
print(age + 5) # Output: 30
18+
print(age + 5) # Output: 30
1919
print(year - 36)
2020
print("My score is: ", score)
2121

22-
#float — decimal numbers
22+
#float — decimal numbers
2323
gpa = 3.75
2424
price = 9.99
2525
pi = 3.14159
2626

27-
#Boolean — True or False only
27+
#Boolean — True or False only
2828
is_logged_in = True
2929
has_permission = False
3030
# Industry note: Booleans power almost every decision in programming
3131

32-
#Nonetype The absence of value
32+
#Nonetype The absence of value
3333
result = None
3434
# Used when a variable exists but has no value yet
3535
print(result)
@@ -40,13 +40,13 @@
4040
gpa = 3.5
4141

4242
# Check what type a variable is
43-
print(type(name)) # <class 'str'>
44-
print(type(age)) # <class 'int'>
45-
print(type(gpa)) # <class 'float'>
43+
print(type(name)) # <class 'str'>
44+
print(type(age)) # <class 'int'>
45+
print(type(gpa)) # <class 'float'>
4646

4747
# Convert between types (called Type Casting)
4848
age_as_string = str(age) # "20"
49-
gpa_as_int = int(gpa) # 3 (drops the decimal, doesn't round)
49+
gpa_as_int = int(gpa) # 3 (drops the decimal, doesn't round)
5050
number = float("3.14") # 3.14
5151

5252
#Taking input from the user:
@@ -62,7 +62,11 @@
6262
#f-Strings — The Industry Standard Way to Format Output
6363
name = "Marcus"
6464
age = 20
65-
print(f"Hello {name}, you are {age} years old.")
65+
print(f"Hello {
66+
name
67+
}, you are {
68+
age
69+
} years old.")
6670
# Output: Hello Marcus, you are 20 years old.
6771

6872
#Lesson1 Summary:
@@ -76,8 +80,18 @@
7680
birth_year = 2025 - age
7781

7882
# Display using f-strings
79-
print(f"Name : {name}")
80-
print(f"Age : {age}")
81-
print(f"City : {city}")
82-
print(f"Born in : {birth_year}")
83-
print(f"Adult? : {age >= 18}")
83+
print(f"Name : {
84+
name
85+
}")
86+
print(f"Age : {
87+
age
88+
}")
89+
print(f"City : {
90+
city
91+
}")
92+
print(f"Born in : {
93+
birth_year
94+
}")
95+
print(f"Adult? : {
96+
age >= 18
97+
}")

Python/02-lesson/conditional.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Basic If statements
2+
age = 20
3+
4+
if age >= 18:
5+
print("You are an adult.")

0 commit comments

Comments
 (0)