Num = int(input("enter a number: ")) num = num % 4 if (num == 1): print ("a") elif (num == 2): print ("b") elif (num == 3): print ("c") elif (num == 4): print ("d") else: print ("e") if the user enters 5 what is output?
Answers
Answered by
0
a will be printed.
- When working with numbers in your code, Python allows a wide variety of arithmetic operators. The modulo operator (percent), which returns the leftover after dividing two numbers, is one of these operators.
- Like the other arithmetic operators, the modulo operator can be applied to the int and float numeric types. It can also be used with other kinds, such as math.fmod(), decimal.Decimal, and your own classes, as you'll see in the next sections.
- Because of the way math.fmod() determines the outcome of the modulo operation, the official Python documentation advises using it instead of the Python modulo operator when working with float numbers.
Here, when 5 is entered, the operation 5 % 4 will be done, which is nothing but 1 since remainder is 1 when 5 is divided by 4.
Hence, a will be printed.
Learn more here
https://brainly.in/question/47276240
#SPJ9
Answered by
0
Answer:
7
Explanation:
Because it works
Similar questions