Write a python program that takes a number from the user. If the number is odd, print that many "*" and if the number is even, print that many "+" as output. Use for loop.
Example 1
Sample input: 5
Sample Output: *****
Example 2
Sample input: 10
Sample Output: ++++++++++
1
Expert's answer
2021-08-28T01:36:29-0400
n = int(input('Enter number her: '))
if n % 2 == 0:
print(n * '+')
else:
print(n * '*')
Enter number her: 5
*****
Enter number her: 10
++++++++++
Comments
Leave a comment