Python Input Handling and String Manipulation Quiz

AdmiringVictory avatar
AdmiringVictory
·
·
Download

Start Quiz

Study Flashcards

15 Questions

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")

ZeroDivisionError

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.

phone

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

xNum = int(x)

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

x.isdigit()

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

def celsiusToFahrenheit(x): return (9/5)x+32

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

num1 = float(input('Enter a number: '))

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

num1 = float(input('Enter a number: ')) answer = 43/num1

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}})

x

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

celsiusToFahrenheit(x) = \frac{9},{5}x + 32

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}}

stor

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)

int

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

input

Test your Python skills with this quiz on input handling, typecasting, string functions, and creating methods for mathematical operations. Practice converting user input to different data types and manipulating strings, as well as writing functions for calculations.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser