Question: python codes Task 1: For each of the following questions type in IDL.E shell. Include sereenshot of result. The first is done for your reference.

python codes
python codes Task 1: For each of the following questions type in
IDL.E shell. Include sereenshot of result. The first is done for your
reference. 1) What type of value is 3.14986746545 ? How can you
find our? It is a floating point number. type() function was used.

Task 1: For each of the following questions type in IDL.E shell. Include sereenshot of result. The first is done for your reference. 1) What type of value is 3.14986746545 ? How can you find our? It is a floating point number. type() function was used. num=3.14986746545 print (type (num)) 2) What output do you expect of this Python statement? Why? print("string to float:", float("Hello world!")) 3) Are the lines correct? Why? If no, how do you rectify the same? staying alive= print(staying_alive) 4) Variable num is defined as 10 (num =10 ). Using num, print the statement, 1 drank 10 glasses of water today! 5) Using one print ( function , print on two lines: I'm a student of Khalifa University. I study ENGR114. 6) A is a character and Apple is a string. Print the character and string onto the console. Is the syntax the same? Why? 7) Write a code that allows the user to enter a word and store it in a variable called word. It will then use the print() function to output the word that they entered. 8) In Python, it is possible to reassign variables to change the values stored in them. Is this statement true? Why? Also, find the output of the following code snippet: val = 'Hello' print(val) val =100 print(val) val =12e5 print(val) 9) The user enters an input as num =56.78. Write the print() function to output 56. 10) Will the statement print( "Hello \# World") be executed ? Why? Task 2: Create a new file on IDLE text editor. Save file as Lab1_task2. Write a program that prompts user to enter his first name and last name and then displays the message: Hello firstname lastname Welcome to Python! Task 3: On the IDLE text editor, write a Python program that allows the user to enter his address details (House Number, Street Name, Name of city, Name of the Country and store them in different variables. The print() function is then used to output all of the information. A sample output should be as follows: Address Details: Street: Villa No. 1, Happy Street City: Abu Dhabi Country: UAE Task 4: Write a program code for the user to enter their weight in kilograms (this could be a decimal). However, it is desired to print the output by approximating to first decimal. 1) Identify the correct variable name in Python? a) this is a variable =7 b) 123abc=10.22 c) ThisBook="Python" d) % name='A' 2) A variable can be removed using which keyword? a) remove b) del c) clear d) delete 3) The input() function takes user's input as a : a) integer b) float c) string d) character 4) Which of these is a valid string literal? a) "Spring" b) "Spring" c) "'Spring" d) All of these 5) Select the interger literal a) " 9" b) ' 9 ' c) 9 d) All of these 6) What is the output of : s= 'Dad said, "Do it now!"' print(s) 7) What is the output of : s= "'This sentence runs over a few lines.". print(s) 8) What is the output of : s= "This sentence runs in over a In few lines" print(s) 9) Identify the invalid literal in Python? a) 5678 b) 5,678 c) 5678.0 d) 0.5678

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!