Question

In: Computer Science

Write some python programs which demonstrate the following concepts: Input data of all the variable types...

Write some python programs which demonstrate the following concepts:

  • Input data of all the variable types we've covered so far (https://realpython.com/python-variables/)
  • Test input of strings with various quoting styles as previously discussed
  • Output all the variables you read.
  • Format output of all variables to create columnar output.
  • Format output of numbers to 2 decimal places
  • Output using both the string formatting and the 'f' formatted string literals notation.

TURN IN

Submit your source code and execution of your code.

Solutions

Expert Solution

integer_data=int(input("Enter an integer:"))
float_data=float(input("Enter a float data:"))#reads user data
boolean_data=bool(input("Enter a boolean value:"))
string_data=input("Enter string data:")

s1='string using single quotes'
s2="string using double quotes"
s3='''string using triple quotes'''

print(s1,s2,s3,sep="\n")#print all the strings defined above
print("Integer value is {0}".format(integer_data))#various format of output
print("Float value is {:.2f}".format(float_data))
print("Boolean value is ",boolean_data)
print(f"String value is {string_data}")

Screenshots:

The screenshots are attached below for reference.

Please follow them for output and proper indentation.



Related Solutions

In this assignment, you are going to write a Python program to demonstrate the IPO (Input-Process-Output)...
In this assignment, you are going to write a Python program to demonstrate the IPO (Input-Process-Output) cycle that is the heart of many imperative programs used for processing large amount of data. Daisy is recently hired by a warehouse. One of her job is to keep track the items ordered by all the branches of the company. The company wants to automate the task using a computer program. Being a friend of Daisy, she knows you are a Computer Science...
Can all nonprofit programs and services be evaluated? Think of some types of nonprofit programs or...
Can all nonprofit programs and services be evaluated? Think of some types of nonprofit programs or services that might be very difficult or impossible to evaluate. What accounts for the difficulties? How might evaluation design be used to be used to address these difficulties?
In this assignment, you need to demonstrate your ability in using input, output, data types, and...
In this assignment, you need to demonstrate your ability in using input, output, data types, and if statement in C++ program. Assume that you need write a C++ program for a cash register. There are only four items in the store: Cereal, $3.99 Milk, $3.99 Egg, $0.25 Water, $ 1.50 Once a customer purchases items, you will ask her/his how many of them are bought. The quantity can be in the range of 0-10 (including 0 and 10). Then, calculate...
in python please Q1) Create a Singly link list and write Python Programs for the following...
in python please Q1) Create a Singly link list and write Python Programs for the following tasks: a. Delete the first node/item from the beginning of the link list b. Insert a node/item at the end of the link list c. Delete a node/item from a specific position in the link list Q2) Create a Singly link list and write a Python Program for the following tasks: a. Search a specific item in the linked list and return true if...
(Python) Write a program which accomplishes the following tasks: set a variable to the result of...
(Python) Write a program which accomplishes the following tasks: set a variable to the result of mathematical expression including +, -, * and / and of both Integer and Float values (or variables) set a variable to the result of a combination of string values (or variables) set a variable to the result of a combination of string, Integer and Float values (you may need to use the type casting functions) Using the following variables: a = 1.3 b =...
PYTHON Write a python program that encrypts and decrypts the user input. Note – Your input...
PYTHON Write a python program that encrypts and decrypts the user input. Note – Your input should be only lowercase characters with no spaces. Your program should have a secret distance given by the user that will be used for encryption/decryption. Each character of the user’s input should be offset by the distance value given by the user For Encryption Process: Take the string and reverse the string. Encrypt the reverse string with each character replaced with distance value (x)...
In python write a function whose input is a string. This function determines the data type...
In python write a function whose input is a string. This function determines the data type of the input string. The data types can be a float, int, or string. Most pass the following assertions: assert determine_data_type('1.2') == float assert determine_data_type('4') == int assert determine_data_type('EAS503') == str
Need this program in python. The data must be taken from user as input. Write a...
Need this program in python. The data must be taken from user as input. Write a program that prompts the user to select either Miles-to-Kilometers or Kilometers-to-Miles, then asks the user to enter the distance they wish to convert. The conversion formula is: Miles = Kilometers X 0.6214 Kilometers = Miles / 0.6214 Write two functions that each accept a distance as an argument, one that converts from Miles-to-Kilometers and another that converts from Kilometers-to-Miles The conversion MUST be done...
1. What are the main data types in Python? Which data types are sequences? 2. What...
1. What are the main data types in Python? Which data types are sequences? 2. What are some general guidelines for naming a ‘variable’ in Python? Give at least three examples of variable names that follow these guidelines 3. Provide an example of the Python syntax to create a variable to hold the age of a building (for example,40 years old). a. Provide the Python syntax to test whether the variable created above is more than 35, and print the...
All functions are written in python Write a function cube_evens_lc(values) that takes as input a list...
All functions are written in python Write a function cube_evens_lc(values) that takes as input a list of numbers called values, and that uses a list comprehension to create and return a list containing the cubes of the even numbers in values (i.e., the even numbers raised to the third power). For example: >>> cube_evens_lc([2, 5, 6, 4, 1]) result: [8, 216, 64] This version of the function may not use recursion. Write a function cube_evens_rec(values) that takes as input a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT