Skip to content

Commit c3db3d2

Browse files
authored
Add files via upload
1 parent 1bb69ca commit c3db3d2

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

00_python_basics.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Python from NON Programmers
2+
3+
# Variables -- holds modifiable data
4+
5+
wallet_int = 10 # example of integer available
6+
wallet_float = 9.9 # example of float variable
7+
wallet_str = "test" # example of string variable
8+
wallet_boolean = True # example of boolean variable ( booleans can only be True or False)
9+
10+
# Access the value or status of a variable by using print statement
11+
print(wallet_float)
12+
13+
day_1 = 8
14+
15+
# Ints ( integer ) and Floats -- holds modifiable number values
16+
17+
temp_1 = -15 # ints and floats cand have negative numbers
18+
height = 180.5 # example of float
19+
20+
print(height / temp_1) # arithmetic operations can be done using ints and floats
21+
22+
# Strings -- refers to words and sentences, requires the usage of " " or ' '
23+
24+
shirt = "blue"
25+
print(shirt)
26+
27+
# use \' or \" to tell the program not to treat the marks as string ender.
28+
29+
store = 'this is a really "nice" string to test\'s'
30+
movie = "Shawshank Redemption"
31+
32+
# Variables in Strings
33+
34+
day = 21
35+
month = "October"
36+
temp = 65
37+
38+
print(f"Today is {day} of {month} and there are {temp} degrees")
39+
40+
# Boolean -- represents the state of True or False
41+
42+
light_is_on = True
43+
44+
if light_is_on:
45+
print("The light is on")
46+
47+
# Comparison and Else
48+
49+
light_is_on = False
50+
51+
if light_is_on:
52+
print("The light is on")
53+
else:
54+
print("no light")
55+
56+
weight = 115
57+
58+
if weight < 119:
59+
print("you are good")
60+
else:
61+
print("kinda heavy :d")
62+
63+
age_target = 38
64+
65+
if age_target < 18:
66+
print("You are a child")
67+
else:
68+
print("You are an adult")
69+
70+
71+
# ODD / EVEN exercise
72+
# number var
73+
# return True if odd and return False if even
74+
75+
def your_code():
76+
number = 7
77+
if number % 2 == 0:
78+
return False
79+
else:
80+
return True
81+
82+
83+
your_code()

0 commit comments

Comments
 (0)