Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

strings InputType.py Submit Run Grades Reset #Recall that input from a user is always in the form of a string 2 #Ilrite a function called

image text in transcribedstrings

InputType.py Submit Run Grades Reset #Recall that input from a user is always in the form of a string 2 #Ilrite a function called "input-type" that gets user input and 3 #dete ines what kind of string the user entered. The user input 4 #will be supplied as an argument to the function like normal 5# 6 # -Your function should return "integer" if the string only 7 # contains characters 0-9 8 # Your function should return "float" if the string only boolean boolean boolean boolean # contains the numbers 0-9 and at most one period 10 # -You should return "boolean" if the user enters "True" or 11# "False" 12 # -otherwise, you should return "string". 14 te your function here! 16 def input type(xxx): 17 18 19 try: if xxxTrue" or "False": if xxx.isdigit): if xxx-count("-")--1: return "string return "boolean" return "floot" except: 26 27 #Below are some lines of code that will test your function 28 #You can change the value of the variable(s) to test your 29 #function with different inputs 30# 31 #If your function works correctly, this will originally 32 #print: 33 #string 34 #boolean 35 #float 36 #integer 37 print (input type() 38 print (input type("False) 39 print (input_typ(7.432621)) 40 print (input_type( "2788")) 41

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 89 2nd Symposium On Mathematical Fundamentals Of Database Systems Visegrad Hungary June 26 30 1989 Proceedings

Authors: Janos Demetrovics ,Bernhard Thalheim

1989th Edition

3540512519, 978-3540512516

More Books

Students also viewed these Databases questions

Question

Describe how early experiences can modify the brain.

Answered: 1 week ago