What data type is returned when we use python

Assignment Help Python Programming
Reference no: EM133087548

Introduction to Python, Operators and Data Types

Exercises

Question 1: There are three main ways in which high-level source code can be converted into machine code suitable for running on a processor - Compilation, PureInterpretation and Hybrid Implementation. In your own words, describe each of these different techniques and also rank them from fastest to slowest.

Question 2: Which of the above techniques does Python 3 use? Why do you think this might be? Do a spot of research if you're not sure!

Question 3: Give at least two examples of each of the following types of data:
Data Type
Integer
Boolean
Float
Double
String

Question 4: Provide the operator symbol for each of the following operators:
Operation
Addition
Subtraction
Multiplication
Division (floating point)
Division (integer)
Modulus
Raise to a power
Equivalence
Not equal to
Assignment

Question 5: What is the resulting data type when we combine the following data types in the following ways.Try them out in the Python interpreter if you're not sure (some of them might surprise you), like this for example:

Question 6: What data type is returned when we use Python 3's input function? Assuming the user entered a whole number, give an example of casting this data type into an integer.

Question 7: Write a small Python 3 script that asks the user to enter their birthday as three separate values (day, monthand year) and then prints out how old they are in the following format (for example):

If you were born on 18/01/1978 then that was day 18 of the year.
Use the format function to substitute values into your output. You can use the following snippet of code to calculate the day of the year:
import datetime as dt
date = dt.date(birth_year, birth_month, birth_day) # Create a date from user data
day_of_year = date.timetuple().tm_yday # Get day number from date
This code assumes that when you got the user's birthday details you stored them in variables called birth_day, birth_month and birth_year - if you didn't then either do so or substitute your own variable names into the date line (i.e. the middle line) above!

Question 8: Challenge Task - try this if you're feeling adventurous! You won't get any help with it, it's just to ‘stretch' you a little bit if you're finding all this too easy!

Write a program that outputs the lyrics to the classic love-song 99 Bottles of Beer On The Wall - using a loop!
The song's lyrics are as follows:
99 bottles of beer on the wall, 99 bottles of beer.
Take one down, pass it around, 98 bottles of beer on the wall...
The same verse is repeated, each time with one bottle fewer, until there are none left. On the very last verse when there are zero bottles left, the lyrics change to:
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall...

Reference no: EM133087548

Questions Cloud

Create an ai model : What are the two options we have when want to create an AI model? Which two types of learning do we have available?
Explain globalization and complexity : Explain Globalization and its Complexity's. As well as positives and negatives.
What does missing information reference mean : What does "missing information: reference" mean? Can you give some examples of reference when my source was my teacher who sent us a picture of what to do?
Topic of sustainability in business : The theme of your introduction should be connected in some way to answering an essay question that is connected to the topic of sustainability in business.
What data type is returned when we use python : What data type is returned when we use Python 3's input function? Assuming the user entered a whole number, give an example of casting this data type
Development of juvenile justice and juvenile courts : Explain the concept of parens patriae. Outline the history and development of juvenile justice and juvenile courts.
Find human resource management : Outline the strategies you would like to see used for Human Resource Management in your organization or one that you have been associated with. Be sure to cite
How employees perceptions of fairness affects motivation : Use equity theory to explain how employees' perceptions of fairness affects motivation
Huawei analysis in terms of exports and global sourcing : Huawei analysis in terms of exports and global sourcing?

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd