-
Notifications
You must be signed in to change notification settings - Fork 0
/
Week6.py
132 lines (92 loc) · 2.1 KB
/
Week6.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 14 14:20:01 2024
@author: marcus
"""
newList = []
val = ''
while val != "x":
val = input()
newList.append(val)
print(newList)
aList = ["server1",
"server2",
"server3",
"server4"]
print(len(aList))
print(aList[2])
print(aList[:2])
## this is a string
something = "This is something. It is really long"
count = 0
# for each in something:
# print(each)
for each in something:
if each == "t":
count = count + 1
print(count)
print(something)
print(len(something))
# print(something[19:])
# print(something[:19])
# print(something[:-4])
# print(something[1:20:5])
# import random
# print(random.randrange(0,100,5))
# print(random.randrange(0,-66,-5))
# def numberCheck(num):
# '''
# Parameters
# ----------
# num : int or float
# The input to check
# Returns
# -------
# bool
# True if a number
# False is not a number.
# '''
# try:
# float(num)
# return True
# except ValueError:
# return False
# help(numberCheck)
# print(numberCheck())
# print(numberCheck(12))
# print(numberCheck("Test"))
# print(numberCheck(14.2))
# print(numberCheck("-2"))
# print(numberCheck("-2.5"))
# assert numberCheck("test") == True, "Should be True"
# assert numberCheck("test") == False, "Should be False"
# print("You are here")
# x = "hello"
# #if condition is False, AssertionError is raised:
# assert x == "goodbye", "x should be 'hello'"
# num = "test"
# print(int(num))
# import random
# random_number = random.randint(1, 6)
# print(random_number)
# def debugger(x, y):
# breakpoint()
# result = x / y
# return result
# print(debugger(5, 0))
# import logging
# x = 5
# y = 0
# logging.warning("This is a warning")
# x = 1.2
# y = 0
# try:
# print("Division", x/y)
# # except ZeroDivisionError:
# # print("Division by zero is not possible")
# # except TypeError:
# # print("Wrong types buddy")
# except :
# print("Generic error message")
# #print("Division", x/y)