-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic.py
43 lines (37 loc) · 921 Bytes
/
basic.py
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
#data types - ints and floats
age = 15
height = 5.6
add = age+height
print(type(add))
addint = int(add)
print(type(add))
#data types - strings
name = "Blake F"
name2 = "Philip P"
name3 = "Jacob H"
#list - creating a list
memberList = ["Blake F", "Philip P", "Jacob H"]
print(memberList)
memberList.append("Will B")
print(memberList)
#list - find the length of a list
print(len(memberList))
member_number = len(memberList)
#for loops - go through a list
for i in range(member_number):
print(memberList[i])
#functions - creating a function
def greet(name,afternoon):
if afternoon == True:
print("Hello "+name+" good evening!")
if afternoon == False:
print("Hello You Nerd Mr"+name+"tis a good mrning we are having today")
greet("Ethan",False)
#functions - return a value
def EOnumber(number):
if number % 2 == 0:
return "even"
else:
return "odd"
numberval = EOnumber(14)
print(numberval)