forked from junaid238/gunturClasses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassSixOnline.py
184 lines (146 loc) · 3.11 KB
/
classSixOnline.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# PYTHON -- online -- 29-05-2018 --- Conditional Statements
# ---------------------------------------------------------
# Conditional Statement
# ---------------------
# descision tree
# --> op1 True
# --> op2 false
# --> op1 --> true 1
# --> op2 --> true 2
# --> op3 --> true 3
# --> ....
# --> ....
# --> ....
# ---> if else --> 2 outcomes --> true or flase
# ---> if elif else --> multiple outcomes --> true1 , true2 , true 3 false
# --> condition --> T / F
# --> Statement 1 -> T
# --> Statement 2 -> F
# Syntax
# ------
# if condition:
# Statement 1
# else:
# Statement 2
# ------------------
# if (condition):
# Statement 1
# else:
# Statement 2
# ------------------
# if (condition1):
# Statement 1
# elif(condition1 2):
# Statement 2
# else:
# Statement 3
# ---------------------
# if(condition1):
# Statement
# ------------------------
# a = 10
# a>5 --> True
# a==5 --> False
# a<3 --> False
# if a>5:
# print(a , "is greater than 5 ")
# else:
# print("not greater than 5")
# if(a>5):
# print(a , "is greater than 5 ")
# else:
# print("not greater than 5")
# a< 5 --> F
# a==5 --> f
# a>20 --> F
# a==10 --> t
# if (a<5): # true
# print("hai ")
# elif(a==5):
# print("equals")
# elif(a>20):
# print("20 is greater than 10 ")
# elif(a==10): # true
# print("true one")
# else:
# print("error")
# print(a)
# condition and Statement are a pair
# control Statement --> pass
# pass
# -> not implement anything
# -> ifelse , for , functions and classes
# c = 19
# if(c==10):
# pass
# else:
# print("bye")
# greeting
# time -> 0 - 23
# Good morning
# Good afternoon
# Good evening
# Good night
# go to sleep
# time = 4
# if(time>7 and time<=11):
# print("Good morning")
# elif(time>11 and time<=16):
# print("Good afternoon")
# elif(time>16 and time<=20):
# print("Good evening")
# elif(time>20 and time<=23):
# print("Good night")
# else:
# print("goto sleep")
# Nested Conditional Statements
# -----------------------------
# indentation
# if ():
# if():
# if():
# else:
# else:
# else:
# time = int(input("enter the time"))
# if(time>=0 and time<24):
# if(time>7 and time<=11):
# print("Good morning")
# elif(time>11 and time<=16):
# print("Good afternoon")
# elif(time>16 and time<=20):
# print("Good evening")
# elif(time>20 and time<=23):
# print("Good night")
# else:
# print("goto sleep")
# else:
# print("invalid time")
# input from keyboard
# -------------------
# input() --> 2.7 and 3.6 ---> string
# raw_input() --> 2.7
# === scanf() in C and CPP
# Syntax
# ------
# varName = input("Dialouge / User help text")
# a = input("enter a number")
# input vs output
# ---------------
# digitallyncs-MacBook-Air:guntur junaid$ python classSixOnline.py
# enter the time13
# Good afternoon
# digitallyncs-MacBook-Air:guntur junaid$ python classSixOnline.py
# enter the time19
# Good evening
# digitallyncs-MacBook-Air:guntur junaid$ python classSixOnline.py
# enter the time200
# Task
# ----
# enter a string " iam in hyd now "
# length of string : 16
# ["iam" , "in" , "hyd" , "now"]
# enter a number 10
# 10 is an even number
# enter a number 15
# 15 is an odd number