-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathweek3-numbers.py
More file actions
96 lines (65 loc) · 1.92 KB
/
Copy pathweek3-numbers.py
File metadata and controls
96 lines (65 loc) · 1.92 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
#storing numbers within variables
#using the str() function to convert a number to a string
my_num = 50
print(str(my_num))
my_num2 = 69
print(str(my_num2) + " Is nuaghty, but it is ""\"NOT\" practical!")
my_num3 = 30
print(str(my_num3) + " Is my age")
my_num4 = 1992
print(str(my_num4) +"\nIs the year I was born")
my_num5 = 91
print(str(my_num5))
#ABS function - This prints the absolute value of a number
abs_num1 = -100
print(abs(abs_num1))
abs_num2 = -4
print(abs(abs_num2))
abs_num3 = -24
print(abs(abs_num3))
abs_num4 = -1001
print(abs(abs_num4))
abs_num5 = -1500
print(abs(abs_num5))
#power function - This allows us to pass in two pieces of numerical information to get the power result from the number
print(pow(2,4))
print(pow(3,9))
print(pow(4,8))
print(pow(5,10))
print(pow(6,12))
#Max function - This gives you the highest number out of the numbers you put in the brackets
print(max(2,6,9))
print(max(5,9))
print(max(4,16))
print(max(723,537,928))
print(max(74963986396,34593579793,13238948048))
#Min function - This is the opposite of the max function - the minimum number from numerical values
print(min(2,6,9))
print(min(5,9))
print(min(4,16))
print(min(723,537,928))
print(min(74963986396,34593579793,13238948048))
#Round function - This rounds numbers to its correct whole value
print(round(16.1))
print(round(1.4))
print(round(123.6))
print(round(7.7))
print(round(35.5))
#Import function - Used to import other maths functions to use in your python program
#print(sqrt(50)) #ERROR - must import function from Python library
from math import *
print(sqrt(99))
print(sqrt(88))
print(sqrt(77))
print(sqrt(66))
print(sqrt(55))
#tan - returns the tangent of a number
print(tan(44))
print(tan(33))
print(tan(22))
print(tan(22))
print(tan(11))
#Closing statement
feeling = "bless up"
time = "week 3"
print("That is the end of my "+time+" homework.\n""\""+feeling+"\" big bro IP for all his dedication to the Passport Bros.")