l. Given expression 10/3 (1) Is there any type conversion in the following expre
ID: 3601727 • Letter: L
Question
l. Given expression 10/3 (1) Is there any type conversion in the following expression, and why? (2) What is the type of the result? 2. Write a a piece of python program based on the following grammer if stmt "if" expression"." suite "elif" expression ":" suite ["else"suite You will want to have the following function (1) Once the program runs, it will show the information: (2) If you input a number less than 50, it will print out information: (3) If you input a number equal to 50, it will print out information: (4) Otherwise,t will print out information Reference 1 t-in function: input([prompt) "Please input a number: "It's less than 50! It's 50! It's over 50! If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string 2. Built-in function int Inumber | string[, radix]) Convert a number or string to an integer 3. ][. sep='1[, end='n][. file=sys.stdout) Built-in function: print([object, Print object(s) to the stream file, separated by sep and followed by end. sep,end and file, if present, must be given as keyword arguments.Explanation / Answer
1) Given expression: 10/3
1. No, there is no any type conversion in the given expression; / is normal division or called floating point division.
2. In pyhton 3, / performs floating point division; so the result will be: 3.3333333333333335
.2) Python code
x = int(input("Enter a number: "))
if x<50: print("It's less than 50!" )
elif x==50: print("It's 50!")
else:print("It's over 50!")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.