Starting from:
$30

$24

Homework 01 Solution.

Program 1:

-Input a string and press Enter to add it to the list. You may continue this process indefinitely.

-When you wish to stop, press ctrl-D or ctrl-Z.

-When finished with collecting input, the program will print all input strings in reverse order.




Program 2:

-Input an integer and press Enter to add it to the list. You may continue this process indefinitely.

-Inputing anything other than an integer will generate an error, but the program will continue asking for input.

-When you wish to stop, press ctrl-D or ctrl-Z.

-When finished with collecting input, the program will print True if any 2 distinct numbers added to the list have an odd product. It will print False otherwise.




Program 3:

-Input an integer and press Enter to add it to the list. You may continue this process indefinitely.

-Inputing anything other than an integer will generate an error, but the program will continue asking for input.

-When you wish to stop, press ctrl-D or ctrl-Z.

-When finished with collecting input, the program will print all possible permutations of the input list of integers.




Program 4:

-Input an integer and press Enter. The program will ask for 2 integers.

-The first integer must be at least 0.

-The second integer must be less than 2 to the 31st power.

-Inputting anything other than an integer or inputting an out-of-range integer will generate an error, and the program will reset.

-When finished with collecting input, the program will convert the 2 integers to binary strings and print their Hamming distance.

-If the binary strings are unequal in length, the shorter string will have 0s added to the left until the 2 strings are equal in length.

More products