辅导案例-QUIZ 3
QUIZ 3
COMP9021 PRINCIPLES OF PROGRAMMING
Reading the number written in base 8 from right to left, keeping the leading 0’s, if any:
0: Move North
1: Move North-East
2: Move East
3: Move South-East
4: Move South
5: Move South West
6: Move West
7: Move North-West
We start from a position that is the unique position where the switch is on.
Moving to a position switches on to off, off to on there.
$ python3 quiz_3.py
Enter a non-strictly negative integer: 0
Keeping leading 0's, if any, in base 8, 0 reads as 0.


$ python3 quiz_3.py
Enter a non-strictly negative integer: 00
Keeping leading 0's, if any, in base 8, 00 reads as 00.



$ python3 quiz_3.py
Enter a non-strictly negative integer: 0256
Keeping leading 0's, if any, in base 8, 0256 reads as 0400.

$ python3 quiz_3.py
Enter a non-strictly negative integer: 032
Keeping leading 0's, if any, in base 8, 032 reads as 040.
$ python3 quiz_3.py
Enter a non-strictly negative integer: 3654
Keeping leading 0's, if any, in base 8, 3654 reads as 7106.
⚪⚫
⚫⚪
⚪⚫
⚪⚪
Date: Term 3, 2019.
2 COMP9021 PRINCIPLES OF PROGRAMMING
$ python3 quiz_3.py
Enter a non-strictly negative integer: 100738324
Keeping leading 0's, if any, in base 8, 100738324 reads as 600222424.
⚪⚫⚫⚪⚪
⚪⚪⚫⚫⚪
⚫⚪⚪⚪⚪
$ python3 quiz_3.py
Enter a non-strictly negative integer: 73776
Keeping leading 0's, if any, in base 8, 73776 reads as 220060.
⚪⚪⚪
⚪⚫⚫
⚪⚪⚫
⚫⚪⚫
$ python3 quiz_3.py
Enter a non-strictly negative integer: 7704322
Keeping leading 0's, if any, in base 8, 7704322 reads as 35307402.
⚪⚫
⚪⚫
⚫⚫
⚫⚪
$ python3 quiz_3.py
Enter a non-strictly negative integer: 206537612
Keeping leading 0's, if any, in base 8, 206537612 reads as 1423701614.
⚪⚫⚫⚫
⚫⚫⚪⚪
⚫⚪⚪⚫
⚫⚪⚫⚫
⚪⚫⚫⚫
$ python3 quiz_3.py
Enter a non-strictly negative integer: 000123456789
Keeping leading 0's, if any, in base 8, 000123456789 reads as 000726746425.
⚪⚫⚫⚫
⚪⚫⚫⚫
⚪⚫⚫⚪
⚪⚫⚪⚪
⚪⚫⚪⚪
⚫⚫⚪⚫
51作业君 51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: ITCSdaixie