0

help me please

I need program when I input 5 output : ***** * * ***** * * ***** with formula : n-1 % 2 = 0 and n >= 5 when user not follow formula this program return to n again please help

27th Oct 2016, 5:22 AM
Gabriel Leon Kristi
Gabriel Leon Kristi - avatar
2 Answers
+ 3
Here It is num = int(input("Enter the Number : ")) for n in range(1, num+1): if (n-1) % 2 == 0 or n >= num: print ("*****") else: print ("* *") Formula which you are suggesting because of (and) condition will never be true. So need to use (or) instead of (and).
27th Oct 2016, 8:07 AM
Waqas Asghar Bhalli
Waqas Asghar Bhalli - avatar
0
thanks
27th Oct 2016, 8:50 AM
Gabriel Leon Kristi
Gabriel Leon Kristi - avatar