Python Quiz 1 Welcome to your Python Quiz n°1 ! 1. How to convert the variable "stringInt" to integer ? int(stringInt) str(stringInt) cast(stringInt,"integer") integer(stringInt) 2. Which of the following is a valid list in Python? l = 1,2,3,4,5 l = {1,2,3,4,5} l = [1,2,3,4,5] l = (1,2,3,4,5) 3. How to convert the variable intString to a string ? cast(intString as string) str(intString) string(intString) int(intString,"string") 4. Which one of the following is a valid Python if statement ? if a <=30: if a <=30 {} if (a <=30) if a =<30 5. In Python, what is one function to output content to the console? print output echo console.log 6. Let's consider that we have a variable a="one word". What is the function that retrieves the type of the variable? a.type() Type(a) a.type type(a) 7. What syntax is correct for declaring a function? function test() def test(): def test(): function test(): 8. What syntax allows to replace the sub-string "abc" by "dfe" in the string variable "myword" ? myword.match(‘abc’,’dfe’) myword.replace(‘dfe’,’abc’) myword.replace(‘abc’,’dfe’) myword.swap(‘abc’, ‘dfe’) 9. How do you create a variable “number” that is equal to 5? number = 5 int number = 5 variable number = 5 var number = 5 10. What symbol can you use to comment out one line of code? # /*** /// (comment) By ayed_amira I'm a data scientist. Passionate about new technologies and programming I created this website mainly for people who want to learn more about data science and programming :) View all of ayed_amira's posts.