@Brawn/

Problems Python

Python

No description

fork
loading
Files
  • main.py
main.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#myList=[0,1,2,3,4,5,6,7,8,9,10,11,12]
#for x in myList:
#	myList.remove(x)
#print(myList)

'''
myList=[0,1,2,3,4,5,6,7,8,9,10,11,12]
for i in range(0, 7):
	myList.pop(i)
print(myList)
'''

"""
USE EITHER 3 APPOSTROPHYS OR a #
for the range you put 7 instead of 13
because when it take a number out each
time there is only 7 elements to remove 
"""

"""
PROBLEM 1

import datetime
print('Allan Abraham: {:%m-%d-%Y %H:%M:%S}'.format(datetime.datetime.now()))
i = int(input("Pick a number, any number: "))
if i % 3 == 0:
    print("{} is divisible by 3.".format(i))
else:
    print("{} is not divisible by 3.".format(i))



PROBLEM 2

import datetime
print('Allan Abraham: {:%m-%d-%Y %H:%M:%S}'.format(datetime.datetime.now()))
vowel = ["a", "e", "i", "o", "u"]
s = input("Enter a single letter: ")
if s in vowel:
    print("{} is a vowel.".format(s))
else:
    print("{} is not a vowel.".format(s))



PROBLEM 3

import datetime
print('Allan Abraham: {:%m-%d-%Y %H:%M:%S}'.format(datetime.datetime.now()))
i = int(input("Pick a number 1 through 100: "))
if i % 2 == 0:
    print("{} is divisible by 2.".format(i))
elif i % 3 == 0:
    print("{} is divisible by 3.".format(i))
else:
    print("{} is not divisible by 2 or 3.".format(i))



PROBLEM 4

import random; import datetime
print('Allan Abraham: {:%m-%d-%Y %H:%M:%S}'.format(datetime.datetime.now()))
myList = sorted(random.sample(range(1, 21), 5))
#This creates a list of 5 random integers ranging from 1-20.
print(myList)
myNewList = []
for i in myList:
    if i%2 == 0:
        myNewList.append(i)
print(myNewList)



PROBLEM 5

alphabetC = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
alphabetL = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
a = input()
b = ""
for i in a:
    if i in alphabetC:
        b += i
    else:
        b += alphabetC[alphabetL.index(i)]
print(b)



#PROBLEM 6

i = int(input("How many minutes per day do you look at your phone?"))
if i < 15:
	print("{} minutes? Do you own a phone?".format(i))
elif i < 60:
	print("{} minutes is good. You're staying healthy.".format(i))
elif i < 120:
	print("{} minutes is a bit much. You're phone can be distracting to you.".format(i))
elif i < 180:
	print("{} minutes is too much. You're phone is a problem for you.".format(i))
else:
	print("You have an addiction.")


PROBLEM 1 TIP CALC W/O ARGUMENTS

def myMethod():
	total = float(input("What is the bill total?"))
	tipPercent = float(input("What percentage do you wish to tip? "))
	total = total*tipPercent+total
	print(total)

PROBLEM 1 TIP CALC W ARGUMENTS

def myMethod(a,b):
	total = a
	tipPercent = b
	total = total*tipPercent+total
	print(total)


PROBLEM 2 PYTHAGOREAN THEOREM W/O ARGUMENT

def myMethod():
	a = int(input("What is a?"))
	b = int(input("What is b?"))
	c = (a**2 + b**2)**.5
	print(c)

PROBLEM 2 PYTHAGOREAN THEOREM W ARGUMENT

def myMethod(a,b):
	c = (a**2 + b**2)**.5
	print(c)

PROBLEM 3 QUADRATIC FORMULA W/O ARGUMENT

def myMethod():
	a = int(input("What is a?"))
	b = int(input("What is b?"))
	c = int(input("What is c?"))
	xPlus = (-b+(b**2-4*a*c)**.5)/2*a
	xMinus = (-b-(b**2-4*a*c)**.5)/2*a
	print(xPlus, xMinus)


def myMethod():
	myList = [9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4]
	mean = sum(myList)/len(myList)
	meanSqrList = []
	for i in myList:
		meanSqrList.append((i - mean)**2)
	variance = sum(meanSqrList)/len(meanSqrList)
	standardDeviation = (variance)**.5
	print(standardDeviation)

"""