-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo_error.py
More file actions
82 lines (52 loc) · 1.21 KB
/
Demo_error.py
File metadata and controls
82 lines (52 loc) · 1.21 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
# 1
# x = ['1','2','1a','2a','10','20','40c','50','80']
# for i in x:
# try:
# y = int(i)
# print(y)
# except Exception as e:
# print(f"bu değer {i} tam sayıya çevrilmedi: ", e)
# continue
# # finally:
# # print("validation ok")
# 2
# # while True:
# x = input("x: ")
# if x=='q' or x=='Q':
# break
# try:
# x = int (x)
# except Exception as e:
# print(f"bu değer {x} tam sayıya çevrilmedi: ", e)
# continue
# else:
# print("nihayet sayı girebildin.....")
# def passcheck(psw):
# turkcekarakter= "ıüöçşğİ"
# for i in parola:
# if i in turkcekarakter:
# raise TypeError("türkçe karakter yok.....")
# else:
# pass
# print("geçerli parola")
# parola = input("parola: ")
# try:
# passcheck(parola)
# except Exception as e:
# print(e)
# 4
def factorial(x):
x = int(x)
y= 1
if x<0:
y =1
for i in range(1,x+1):
y = y*i
return y
for x in [5,10,20,30,-3,'10a']:
try:
y= factorial(x)
except Exception as e:
print (e)
continue
print(y)