Python Input Handling and String Manipulation Quiz
15 Questions
2 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Be able to use the string functions which can analyze string input input.______()

isdigit

Be able to create a method which does math and returns values def ______(x): return (9/5)x+32

celsiusToFahrenheit

Be able to handle value errors. try: num1 = float(input("Enter a number: ")) except ______: print("The number input was not a number.")

ValueError

Be able to handle divide by zero errors. try: num1 = float(input("Enter a number: ")) answer = 43/num1 except ______: print("You cannot divide by zero")

<p>ZeroDivisionError</p> Signup and view all the answers

Know about class creation, how constructors are used, how to instantiate an object, how to change member variables and class variables. class phone: type = "telecommunications" yearInvented = 1876 def init(self, a, b, c): self.make = a self.yearReleased = b self.stor.

<p>phone</p> Signup and view all the answers

Be able to accept user input, which is a string value, and typecast it into an int value. x = input('Enter a number: ')

<p>xNum = int(x)</p> Signup and view all the answers

Be able to use the string functions which can analyze string input input.isdigit()

<p>x.isdigit()</p> Signup and view all the answers

Be able to create a method which does math and returns values ______

<p>def celsiusToFahrenheit(x): return (9/5)x+32</p> Signup and view all the answers

Be able to handle value errors. try: ______ except ValueError: print('The number input was not a number.')

<p>num1 = float(input('Enter a number: '))</p> Signup and view all the answers

Be able to handle divide by zero errors. try: ______ except ZeroDivisionError: print('You cannot divide by zero')

<p>num1 = float(input('Enter a number: ')) answer = 43/num1</p> Signup and view all the answers

Be able to input te______t theInput = input(\“Enter some input here: \“) 2. Be able to accept user input, which is a string value, and typecast it into an int value. ______ = input("Enter a number: ")
______Num = int(\underline{\hspace{0.5cm}})

<p>x</p> Signup and view all the answers

Be able to create a method which does math and returns values def celsiusToFahrenheit(x):
 return (9/5)x+32

<p>celsiusToFahrenheit(x) = \frac{9},{5}x + 32</p> Signup and view all the answers

Know about class creation, how constructors are used, how to instantiate an object, how to change member variables and class variables. class phone:
 type = "telecommunications"
 yearInvented = 1876
 def init(self, a, b, c):
 self.make = a
 self.yearReleased = b
 self.\underline{\hspace{0.5cm}}

<p>stor</p> Signup and view all the answers

Be able to input text theInput = \underline{\hspace{0.5cm}}(\“Enter some input here: \“) 2. Be able to accept user input, which is a string value, and typecast it ______o an ______ value. x = input("Enter a number: ")
xNum = ______(age)

<p>int</p> Signup and view all the answers

Be able to use the string functions which can analyze string ______ \underline{\hspace{0.5cm}}.isdigit()

<p>input</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser