Printing Star Pattern In Python

This Is A Python Language Project

Star Pattern.py

Adopted From http://www.codewithharry.com

Here’s The Code

# Exercise 4
# Pattern Printing
# Input = Integer n
# Boolean = True or False
#
# True n=5
# *
# **
# ***
# ****
#
# False n=5
# ****
# ***
# **
# *
# print(“Pattern printing”)
# num = int(input(“Enter num how many rows you want : “))
# print(“Enter 1 or 0”)
# bool_val = input(“1 for True value or 0 for False : “)
# if bool_val==”1″:
# for i in range(0,num+1):
# print(“*”*i)
#
# if bool_val==”0″:
# for i in range(num,0,-1):
# print(“*”* i)


a = int(input(“please add number of line you want to print”))
b = bool(int(input(“please add 0 for False”)))


def star(a, b):
if b == True:
c = 1
while c <= a:
print(c * “*”)
c = c + 1
else:
while a > 0:
print(a * “*”)
a = a – 1


star(a, b)

Note- Take Revision Of The Code.

Making A Calculator In Python

Note This Is A Python Language Project It Means The Extension Will Be( .py)

Here’s The Complete Code Of Working Calculator

I Added Faulty Calculator Code In It.So I AM Commenting It.

Calculator.py

num1 =int(input(“First Number”))
op =input(“Choose Operator +,*,/,-,%”)
num2 =int(input(“Second Number”))
new_input =num1+num2
“‘if new_input ==”5+5”:
print(“Your Total Is 12”)
elif new_input ==”6*5″:
print(“Your Total Is 15”)
elif new_input ==”7/7″:
print(“8”)”‘
elif op ==”+”:
print(num1+num2)
elif op ==”*”:
print(num1*num2)
elif op ==”/”:
print(num1/num2)
elif op ==”%”:
print(num1%num2)

Healthy Weeknight Meals

Cooking can sometimes feel like a chore at the end of a busy day. It’s often tempting to throw a ready meal in the oven or call for take out. But preparing a simple and healthy family meal doesn’t have to be hard or time-consuming. Here are some quick wholesome dishes that you and your family will love. They can even be prepared in advance.

Breakfast at my House

During the week we’re often walking out the door with a coffee in one hand and slice of toast in the other, but on weekends breakfast is never rushed. It’s a late affair, sometimes spilling over to lunch, with lots of reading and chatter in between courses of fruits, poached eggs, honey and toast. One of our favorite things we like to serve when friends are visiting are buckwheat blueberry pancakes.

Design a site like this with WordPress.com
Get started