forked from MojahiMotaung/python_dataTypes_test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_test.py
More file actions
92 lines (62 loc) · 1.51 KB
/
basic_test.py
File metadata and controls
92 lines (62 loc) · 1.51 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def int_division():
"""
Task:
- Perform integer division of 7 by 2.
Return:
- The result of the division (integer).
"""
return 7 // 2
def float_multiplication():
"""
Task:
- Multiply 3.0 by 2.
Return:
- The result of the multiplication (float).
"""
ans = 3.0 * 2
return float(ans)
def combine_operations():
"""
Task:
- Add the result of integer division and multiplication.
Return:
- The combined result (float).
"""
def extract_word():
"""
Task:
- Extract the word 'awesome' from the string 'Python is awesome!'.
Return:
- The extracted word ('awesome').
"""
string = 'Python is awesome !'
return string.split()[2]
def to_lowercase():
"""
Task:
- Convert the string 'Python is awesome!' to lowercase.
Return:
- The lowercase version of the string.
"""
string = 'Python is awesome!'
return string.lower()
def count_o():
"""
Task:
- Count how many times the letter 'o' appears in the string 'Python is awesome!'.
Return:
- The count of the letter 'o'.
"""
string = 'Python is awesome!'
# count = 0
# for i in string:
# if 'o' in string:
# count += 1
return string.count('o')
def evaluate_boolean():
"""
Task:
- Evaluate the expression 'not (5 > 3) and (10 == 5 * 2)'.
Return:
- The boolean result of the expression.
"""