forked from junaid238/gunturClasses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassNineOnline.py
148 lines (130 loc) · 2.65 KB
/
classNineOnline.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
# PYTHON -- ONline -- 1/06/2018 --- Loops part 3
# -----------------------------------------------
# for --> nested
# patterns -> number and string
#Prime composite between a limit
# taking a start point
# s = int(input("enter a start number"))
# # taking a end point
# e = int(input("enter a end number"))
# # iterating b/w start and end
# for i in range(s , e+1):
# count = 0
# # between 1 and i= 4
# for j in range(1,i+1): # 1 1 , 1 2 , 1 3 , 1 4
# if i%j == 0 :
# count += 1
# if count > 2:
# print(" %d is a %s number" %(i , "composite"))
# else:
# print(" %d is a %s number" %(i , "prime"))
# # reinitialising to previos state
# count = 0
# While loop
# ----------
# -> initialisation
# -> limit / condition
# -> statement / implementation ( pass )
# SYNTAX
# < initialisation >
# while < condition >:
# < implementation > / pass
# < inc / dec >
# condition --> t --> execute --> implementation
# condition --> f --> exit execution
# print 1 - 9 using while inc
# a = 0 # initialisation
# while a<10: # condition
# print(a) # implementation
# a += 1 # inc /dec
# print 9 - 1 using while dec
# b = 10 # range(9,0,-1)--> for
# while b>0:
# print(b)
# b -= 1 # b = b-1
# infinite loop --> mostly while
# using condition always true
# a = 10
# while a == 10:
# print("hai")
# using True keyword
# while True:
# print("hello")
# pass
# Control statements:
# -------------------
# keywords
# pass
# -->overcome non implemented blocks ( ifelse , for , while , method , class)
# break
# --> only for loops
# --> condition --> stop the loop
# continue
# --> only for loops
# --> condition --> pauses the loop
# --> next statements
# pass statement
# for i in range(0,12):
# pass
# break statement
# for i in range(0,12):
# print(i , end = " ")
# if i == 6:
# break
# print()
# for i in range(0,12):
# if i == 6:
# break
# print(i, end = " ")
# i = 0 --> 0
# i = 1 --> 1
# i = 2 --> 2
# i = 3 --> 3
# i = 4 --> 4
# i = 5 --> 5
# i = 6 --> 6 break
# break for numbers using for loop
# tech = "qwertyuioplkjhgfdsazxcvbnm"
# for i in tech:
# print(i)
# if i == "p":
# break
# continue with for
# for i in range(0,12):
# if i == 6:
# continue # stop for 6 and then continue
# print(i)
# continue with while
# a = 0
# while a<10:
# a += 1
# if a == 6:
# continue # skips 6 from printing
# print(a)
# continue with string and for
# tech = "Python and Data Sceinces"
# for i in tech:
# if i == "a":
# continue
# print(i , end ="")
# task
# ----
# *
# **
# hello # 3
# ****
# *****
# hello # 6
# *******
# ********
# hello # 9
# 1
# 22
# 333
# 4444
# ***** # 5
# 666666
# 7777777
# 88888888
# 999999999
# ********** # 10