-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcond.py
132 lines (95 loc) · 1.53 KB
/
cond.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
# Contional Stamtes
# Desion
# if
# if - else
# elif
# syntax
# -----------------
# if Condtion:
# statemn
# if 2>1:
# print('hello')
# ----------------------------------------
# syntax---------
# if condtion:
# body of if
# else:
# body of else
# num = int(input('Enter a nuber'))
# print(type(num))
# if num%2 == 0:
# print('Even')
# else:
# print('ODd')
# ------------------------------------------------
# num = int(input('Enter a nuber'))
# if num<0:
# print('-Ve')
# else:
# if (num == 0):
# print('Nutral')
# else:
# print('+ve')
# num = int(input('Enter a nuber'))
# if num<0:
# print('-Ve')
# elif(num == 0):
# print('Nutral')
# else:
# print('+ve')
# Nested If else:
# ==========================
# Syntax
# --------------------------
# if :
# pass
# if :
# pass
# if :
# pass
# else:
# pass
# else:
# pass
# else:
# pass
# i=int(input('Enter a no'))
# if(i<=0):
# if(i<0):
# print('Negative')
# else:
# print('Neutral')
# else:
# print('Postive')
# Loops
# -------------------
# for
# while
# For Loop
# ------------------------
# syntax
# --------------
# for var in sequence:
# body of for loop
# inbuilt function
# range()
# -----------
# syntax of range()
# range(inital val, final val, stepsize)
# 1-----10
# for var in range(0,11,1):
# print(var)
# print(60*'-')
# for var in range(1,11,1):
# if var%2 == 0:
# print(var)
# else:
# print(var)
# Whie loop
# -------------------
# while condtion:
# body of while loop
i = 0
while i<=10 :
print(i)
i = i+1