i've tried every code everyone has posted and mine keeps saying it is wrong. so someone please tell me the code and explain briefly how they got it.. please!! my assignment is due Monday! thank you!
Heh, what exactly are you talking about? Explain the problem please.
everyone is saying the code is:
if > 5:
elif < 5:
print greater_less_equal 5(4)
print greater_less_equal 5(5)
print greater_less_equal 5(6)
mine keeps saying the "if" line is wrong and the "elif" lines are wrong...so i was wondering what the actual code is?
Which Unit and Lesson are you on?
unit: conditionals & control flow
lesson: i got 99 problems but a string ain't one
1) On line 2, fill in the [if] statement to check if answer is greater than 5.
(It is basically telling you to fill in [if](referring to expressions that use 'greater than and less than') if the 'answer' is greater than 5) Meaning if the 'answer'(can be any number) IS greater than 5 you would put the correct operator to express the problem.
2) On line 4, fill in the [elif] so that the function outputs -1 if answer is less than 5.
(Again simple math if the 'answer'(can be any number is less than 5) you would put the correct operator to express the problem.)
One last thing for these tutorials make sure you use whatever line they tell you to use if you are still having problems. I hope i explain everything correctly, i am still new to this, but i wish you the best in succeeding further through out this program. Good luck on your assignment.
1.def greater_less_equal_5(answer): 2. if answer > 5: 3. return 1 4. elif answer < 5 : 5. return -1 6. else: 7. return 0 8. 9.print greater_less_equal_5(4) 10.print greater_less_equal_5(5) 11.print greater_less_equal_5(6)
Please check the correct answer below
if answer > 5:
elif answer < 5:
Yes, that's it.
Remember sometimes they mean literal.
You have to put 'answer' because they have not given the full expression only 5 in this case. I posted the code, but i guess they do not allow cheats? I used it in an educational way, rather than blatantly giving the code with out explanation.
was stuck on the problem,thanks to u ,ur answer solved it.
Could you help me? my code keeps saying,
Oops, try again.
Your indentation looks off! Did you change it? Click Reset to reset your code and try again. The code that I am on is I got 99 problems but a sting ain't one.
The problem IS :
Same her I trye to just print : and the mmmmmm do ad a smily
IF I VANT TO WRITE A SMILRY I just print i dont print :
and error need to be abel to define it laking a : not jst error in code