- 4
A program that takes as input a single line of text and display whether there are an odd or even number of dashes. In python
6 Réponses
0
What do you meant? Specify more of that please?
0
I need help with a python program that inputs a single line of text . The line may consist of any number of spaces or dashes but no other characters. Given this line, display whether there are an even or odd number of dashes
0
Show. Your. Attempt.
0
I'm new on this app
- 1
# ===================== 1st PROBLEM ================================ dash=input("Enter the dashes :") counter=0 for charr in dash: if charr=="-": counter+=1 if counter%2==0: # checks if counter is even or odd print("0") else: print("1") #========================================================================== #=================== 2nd PROBLEM ======================================== # # # dashess= {"":first,"":second} # dash1=input("Enter the 1st row dashes :") # dash2=input("Enter the 2nd row dashes :") # dash3=input("Enter the 3rd row dashes :") # dash4=input("Enter the 4th row dashes :") # dash5=input("Enter the 5th row dashes :") # dash6=input("Enter the 6th row dashes :") # dash7=input("Enter the 7th row dashes :") # dash8=input("Enter the 8th row dashes :") # dash9=input("Enter the 9th row dashes :") # dash10=input("Enter the 10th row dashes :") # dash11=input("Enter the 11th row dashes :") # dash12=input("Enter the 12th row dashes :") # dash13=input("Enter the 13th row dashes :") # dash14=input("Ente