forked from ronitraj74/python-Learning-code
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path07_practice.py
More file actions
99 lines (93 loc) · 2.92 KB
/
07_practice.py
File metadata and controls
99 lines (93 loc) · 2.92 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
# n = int(input("Enter the number to print table :"))
# for i in range(1,11):
# {
# print(f"{n} * {i} = {n*i}")
# }
# -------------------------------------------------------------------------------------
# l = ["Harry", "Ronit" , "Sahil", "soham", "Sachine"]
# for name in l:
# if(name.startswith("S")):
# print(f"Hello {name}")
# -------------------------------------------------------------------------------------
# n = int(input("Enter the number to print table :"))
# i = 1
# while i <= 10:
# print(f"{n} * {i} = {n*i}")
# i += 1
# #-----------------------------------------------------------------------------------
# num = int(input("Enter any number to cheack it is prime or not : "))
# for i in range (2,num ):
# if(num % i) == 0:
# print("Number is not prime ")
# break
# else:
# print("Number is prime")
# --------------------------------------------------------------------------------------
# num = int(input("Enter the number to print sum : "))
# i = 1
# sum = 0
# while(i<=num):
# sum += i
# i += 1
# print(sum)
# --------------------------------------------------------------------------------------
# ----------------------factorial using while loop--------------------------------------
# num = int(input("Enter the number to find factorial : "))
# i = 1
# factorial = 1
# while(i<=num):
# factorial *= i
# i +=1
# print(factorial)
# --------------------------------------------------------------------------------------
# ----------------------factorial using for loop--------------------------------------
# num = int(input("Enter the number to find factorial :"))
# fact = 1
# for i in range(1 , num+1):
# fact = fact * i
# print(f"factorial of number {num} is {fact}")
# --------------------------------------------------------------------------------------
'''
Docstring for 07_07question
*
* *
* * *
# r = int(input("Enter the number of rows to print star pyramid : "))
# for i in range(1,r+1):
# print(" "*(r-i),end=" ")
# print("*"*(2*i-1),end=" ")
# print("\n")
'''
'''
*
* *
* * *
* * * *
'''
# r = int(input("Enter the number of rows :"))
# for i in range(1,r+1):
# for j in range(1,i+1):
# print("*",end=" ")
# print()
# r = int(input("Enter the number of the rows : "))
# for i in range(1,r+1):
# print("*"*i)
# print("")
'''
* * *
* *
* * * n = 3
'''
# n = int(input("Enter the number of rows : "))
# 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()
# -----------------multiplication table in reversed order-------------------------------
# n = int(input("Enetr the number to print its table in reverse order : "))
# for i in range(1,11):
# print(f"{n}*{11-i}={n*(11-i)}")