-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.py
More file actions
56 lines (44 loc) · 1.53 KB
/
Copy pathpattern.py
File metadata and controls
56 lines (44 loc) · 1.53 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
""" Q1. write a program to print the following star pattern ..
*
***
***** for n = 3
"""
# user input in the form of number ..
n = int(input("Enter the number: "))
for i in range (1,n+1): # range from 1 to n tak ..
print(" " * (n-i), end = " ") # ye wala space ke liye h ..
print("*" * (2*n-i), end = " ") # ye wala star ke liye h ..
print(" ") # ye wala line add krega ..
""" Q2. Write a program to print the following star pattern.
*
**
***
****
***** for user input ..
"""
# user input in the form of number ..
n = int(input("Enter the number: "))
for i in range (1,n+1):
print("*"*i, end = " ")
print(" ")
""" Q3. write a program to print the following star pattern.
* * * * *
* *
* *
* *
* *
* *
* * * * * isme basically itna gap nhi rahega star ke bich me mai ya visible ke liye dekha rha hu ..
"""
# user input in the form of number ..
n = int(input("Enter the number: "))
for i in range (1,n+1):
if (i == 1 or i == n):
print("*"*n, end = " ")
else:
print("*", end = " ")
print(" "* (n-2), end = " ")
print ("*", end = " ")
print(" ")
# ye code ke bahr wala code h!
print("code will terminate ..")