-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyFirstProgram.py
More file actions
348 lines (269 loc) · 6.02 KB
/
MyFirstProgram.py
File metadata and controls
348 lines (269 loc) · 6.02 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# #name="Vipin"
# #Age=21
# #Address="Noida"
# #print("My Name is",name)
# #print("My age",Age)
# #print("My Adreess",Address)
# #a=1000
# #b=500
# #sum=a+b
# #print(sum)
# a=10
# b=30
# print(a+b)
# print(a-b)
# print(a*b)
# print(b/a)
# print(a%b)
# print(a**b)
# print(a==b)
# print(a!=b)
# print(a>=b)
# print(b<=a)
# num=10
# #num=num+10
# #num+=10
# #num-+5
# #num*=10
# num/=10
# print("Number",num)
# #logical operator
# print(not True)
# print(not False)
# a=50
# b=30
# print(not (a>b))
# #val1=False
# #val2=True
# #print("AND Operator", val1 and val2)
# #print("OR Operator",val1 or val2)
# #print("OR", (a==b) or (a>b))
# #type conversion
# #a=int("2")
# #b=4.5
# #print(type(a))
# #print(a+b)
# #type casting
# name=input("Plase Enter you name")
# print(name)
# age=int(input("Please Enter your age"))
# print(type(age))
# print(age)
# marks=input("Please enter your marks")
# print(marks)
# firstnum=int(input("Input your first Number"))
# secondnum=int(input("Input your second Number"))
# sum=firstnum+secondnum
# print(sum)
# a=input("Input your first number")
# b=input("Input your second number")
# print(a>=b)
#concanate function
# a="My Compnay name is Fortune, \n Our brand name Secureye"
# b="My Compnay name is Fortune, \t Our brand name Secureye"
# print(a)
# print(b)
# str1="Live Pro"
# str2="Secureye"
# str_re=str2+" "+str1
# str3=str1[2]
# print(str_re)
# print(str3)
# str1="noida Uttar Pradesh"
# print(str1[5:len(str1)])
# print(str1.endswith("esh"))
# print(str1.capitalize())
# print(str1.replace("a","T"))
# #First Example
# inputfirstname=input("Enter you first Name:")
# print(len(inputfirstname))
# #second Example
# str="My name is $ and location is $"
# print(str.count("$"))
#IF elif else
# age=22
# if(age>=18):
# print("He can vote")
#Light Example
# light="pink"
# if(light=="Red"):
# print("STOP")
# elif(light=="Green"):
# print("GO")
# elif(light=="Orange"):
# print("Look and GO")
# else:
# print("Light not working")
# print("End of Code")
#Vote Example
# age=16
# if(age>=18):
# print("he can Vote")
# else:
# print("Can not Vode")
#Example of Grade System
# mark=int(input("Input your marks"))
# if(mark>=90):
# print("Grade : A")
# elif(mark>=80 and mark<90):
# print("Grade: B")
# elif(mark>=70 and mark<80):
# print("Grade C")
# else:
# print("Your are Fail")
# print("End of Code")
# #Nested If
# age=95
# if(age>=18):
# if(age>80):
# print("Can not drive")
# else:
# print("can not drive")
#Example of ODD and Even Number
# num=int(input("Enter your number"))
# rem=num % 2
# if(rem==0):
# print("Even")
# else:
# print("ODD")
#list=[12,15,18,50,60]
#list.sort()
#list.short(reverse=True)
#list.append(80)
# print(list)
# list.insert(1,100)
# list.pop(5)
# print(list)
# #While Loop Example
# count =1
# while count <=5:
# print("Hello")
# count +=1
# i=5
# while i>=1:
# print(i)
# i-=1
# print("end of while loop")
# i = 1
# while(i <=100):
# print(i)
# i += 1
# print("end of while loop")
# i = 100
# while (i >=1):
# print(i)
# i -=1
# print("while loop end")
# n =int(input("Enter you number"))
# i = 1
# while (i <=10):
# print(n*i)
# i += 1
# num = [10,12,56,88,10]
# idx = 0
# while idx > len(num):
# print(num[idx])
# idx += 1
# nums = ["T", "S", "J"]
# idx =0
# while idx <len(nums):
# print(nums[idx])
# idx += 1
# num = (10,12,56,88,10,36)
# x = 36
# idx=0
# while idx < len(num):
# #print(num[idx])
# if(num[idx] == x):
# print("found x value",x)
# if(idx ==x):
# break
# else:
# ("not found")
# idx += 1
#Break statement
# i = 0
# while i <= 5:
# print(i)
# if(i == 3):
# break
# i += 1
# print("end of loop")
# num1= [55,66,88,21,66]
# for el in num1:
# print(el)
# num1= [55,66,88,21,66]
# for el in num1:
# if (el ==66):
# print("66 found")
# print(el)
# for i in range(1, 101):
# print(i)
# for el in range(100,0, -1):
# print(el)
#FUNCATION
# def cal_sum(a, b):
# return a+b
# sum=cal_sum(10,20)
# print(sum)
# def cal_fac(n):
# fact=1
# for i in range(1,n+1):
# fact *=i
# print(fact)
# def convertor(usd_val):
# inr_val=usd_val * 83
# print(usd_val,"USD", inr_val, "INR")
# convertor(73)
#recursing function
# def show(n):
# if(n ==0):#base case
# return
# print(n)
# show(n - 1)
# print("END")
# show(4)
# class Student:
# collagename="ApnaCollage"
# def __init__(self, name, marks):
# self.name=name
# self.marks=marks
# def welcome(self):
# print("Wel Come Student", self.name)
# def get_marks(self):
# return self.marks
# s1 = Student("Karna", 97)
# s1.welcome()
# print(s1.get_marks())
# class Employee:
# def __init__(self, name, marks):
# self.name = name
# self.mark =marks
# def getresult(self):
# return self.mark
# e1 = Employee("Rohit", 98)
# e1.getresult()
# print(e1.getresult())
# class Student:
# def Studentdata(self, name, age, marks):
# name = input("Enter your Name")
# self =self
# age = int(input("Input your Age"))
# age =age
# marks = int(input("Input your Marks"))
# marks =marks
# if(marks >=1):
# print("Marks is Valid")
# else:
# print("Marks is Invalid, Please enter valid marks")
# st =Student()
# st.Studentdata(name="ram",marks=44, age=23)
# age = int(input("Enter you age"))
# if age >= 18:
# print("Yes")
# else:
# print("No")
with open('sample.txt', 'w') as f:
f.write('hello cctv how are you')
f.write("I am adding text")
f.close