logo

Crowdly

Browser

Додати до Chrome

Questions Bank (1264290 total)

Відхилення між плановими і фактичними показниками на стадії реалізації проекту:
25%
Переглянути це питання

Finally, you should write appropriate file header documentation for the program (in previous parts).

You will need to modify your work as follows:

  • Add a parameter to the function which replaces the input variable from Part A
  • This parameter will contain / accept a list of values which meets the input requirements from the previous parts
  • You should assume that no invalid values are passed to this parameter and thus do not need to write additional validation for the parameter
  • Your program should process the values provided in the list of values via the parameter, instead of using inputs from the user

Finally, write some test code that will execute only if the file is run directly (i.e. test code won't run when imported as a module), to demonstrate that the function does not crash and works correctly when provided values via its parameter.

Переглянути це питання

Next, write some code to make the program you've written (in previous parts) into a function.

The function should be named generate_sequence.

The function should not accept any parameters (user input read inside the function instead). 

You should modify the code you wrote in part D to return a dictionary with appropriately named keys containing the information required upon program end (return should take place after the summary is printed).

You should write appropriate function header documentation for the function.

Переглянути це питання

Next, write some code (adding onto the previous part) that meets the following requirements:

  • When the program ends, it should print out a nicely formatted summary of the following information (listed below).
    • number of invalid user inputs  
    • list of all sequences generated (one list per line)

Переглянути це питання

Next, write some code (adding onto the previous part) that validates the input value provided by the user to the following requirements:

  • The user input should should be non-negative (positive), less than 500 and has no more than 3 decimal places.
  • If the input does not meet the requirements above, you should  print the message 'You must provide a valid input' and ask the user for a new input
Note: to check if a given value has no more than n decimal places, you can check if the given value is equal to the same value rounded to n decimal places. 

Переглянути це питання

Next, write some code (adding onto the previous part) that validates the input value provided by the user to the following requirements:

  • The user input should contain an integer value.
  • If the input isn't an integer value, you should print the message  'The value provided is invalid, try again' and ask the user for a new input

Переглянути це питання

Write some code meeting the requirements below (not in a function). You should assume the user will only provide valid input in this part.

  • The program should ask the user for a numeric input which should be saved to a variable named stop.
  • For now, you should cast the user input to an integer
  • Then, generate a sequence of values using the algorithm below:
    1. Generate a list of numbers, that are multiples of both 5 and 7, between 1 and stop.
    2. The last value in the list should be less than or equal to stop.
  • Then, the program should print this sequence of values out as a list of numbers
  • The program should then print an empty line and restart.
  • The program only ends if the user hits CTRL+C.

Переглянути це питання

Select all flowcharts that correctly represent the code provided below:

Переглянути це питання

Select all valid data structures from the options below.

0%
0%
0%
0%
Переглянути це питання

Given the following code snippet:

Select all the valid ways to call this function and print the return value to the terminal/console.

Переглянути це питання