Learn practical skills, build real-world projects, and advance your career
Updated 2 years ago
Q-1 Write a program to display "Hello" if a number entered by user is a multiple of five , otherwise print "Bye".
b=int(input('Enter a number'))
if (b%5==0):
print('hello')
else:
print('bye')
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
/tmp/ipykernel_35/3316664121.py in <module>
----> 1 b=int(input('Enter a number'))
2
3 if (b%5==0):
4 print('hello')
5 else:
/opt/conda/lib/python3.9/site-packages/ipykernel/kernelbase.py in raw_input(self, prompt)
1004 "raw_input was called, but this frontend does not support input requests."
1005 )
-> 1006 return self._input_request(
1007 str(prompt),
1008 self._parent_ident["shell"],
/opt/conda/lib/python3.9/site-packages/ipykernel/kernelbase.py in _input_request(self, prompt, ident, parent, password)
1049 except KeyboardInterrupt:
1050 # re-raise KeyboardInterrupt, to truncate traceback
-> 1051 raise KeyboardInterrupt("Interrupted by user") from None
1052 except Exception:
1053 self.log.warning("Invalid Message:", exc_info=True)
KeyboardInterrupt: Interrupted by user
Q-2 Write a program to check whether a number is divisible by 7 or not.
b=int(input('Enter a number'))
if (b%7==0):
print('yes')
else: print('no')
Enter a number77
yes