Write a program which asks the user for four numbers(Python)1) Write a program which asks the user for four numbers and then tells them one of the following:· That there were more even numbers than odd numbers· That there were more odd numbers than
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 10:46:55
Write a program which asks the user for four numbers(Python)1) Write a program which asks the user for four numbers and then tells them one of the following:· That there were more even numbers than odd numbers· That there were more odd numbers than
Write a program which asks the user for four numbers(Python)
1) Write a program which asks the user for four numbers and then tells them one of the following:
· That there were more even numbers than odd numbers
· That there were more odd numbers than even numbers
· That there were the same number of even and odd numbers
Write a program which asks the user for four numbers(Python)1) Write a program which asks the user for four numbers and then tells them one of the following:· That there were more even numbers than odd numbers· That there were more odd numbers than
evennum=0
oddnum=0
for i in range(0,4):
num=input("please input a number:")
if num%2==0:
oddnum+=1
else:
evennum+=1
if evennum>oddnum:
print "That there were more even numbers than odd numbers"
elif evennum<oddnum:
print "That there were more odd numbers than even numbers"
else:
print " That there were the same number of even and odd numbers"