Control Questions
  • What datatypes in python you know? Use the names as they are to be found in Python.
  • What’s the name of the data type for True and False values.
  • Is it safe to use == to compare floats?
  • How to check if the string "hello" is contained in the variable greeting.
  • What’s the difference between a statement and an expression. Provide an example for each.
  • What’s the statement used to conditionally execute a block of code?
  • How to create endless loop?
  • Iterate over each letter of the string "hello" and print it on a new line.
  • Define a function that will receive two arguments and return its sum
  • Define a function that will receive any number of arguments and will return the count of them
  • What’s the order of arguments in function definition?
  • Will code after the return executed?
  • I need to create a structure where students will be assigned their grade. What datatype is best suited for this?
  • What collection datatype(s) won’t support duplicates in python?
  • I need to change the first element in a tuple. How do I achieve that?
  • What’s the syntax that will yield the string "ell" from the string "hello" using slicing?
  • What’s the function used to determine the length of a collection?
  • What is the datatype used to represent the absence of a value?
  • How can I make the string "hello" uppercase?
  • Can strings be changed (i.e. can I replace single characters in a string)?
  • How can I add the string "Peter" to the array names?
  • Can there be duplicates an in array?
  • What datatype can help us to remove duplicates from an array?
  • What datatype will be the return value of input() if you ask the user the input a number?
  • Convert string to number.
  • What modes for opening files do you know. List at least three.
  • What’s a f-string? Provide an example.
  • How do I find out the name of the script being executed in python?
  • How do I access the first argument on the CLI that was passed to the program?
  • How do you catch the ValueError exception?
  • What is finally for?
  • How can I compute the square root of a number?
  • How to generate a random number between 1 and 100?