Describe the difference between a chained conditional and a nested conditional. Give your own example of each. Do not copy examples from the textbook.
You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.
Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.
Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.
Formula to convert from Kelvin K to Celsius C is C = K - 273.
Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.
The input contains the temperature (a number) and the unit of the temperature scale (C, F, K) without any space.
The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.
New Year Countdown
1. Binary Hexadecimal Converter App
Description:
Example Output:
Welcome to the Binary/Hexadecimal Converter App
Compute binary and hexadecimal values up to the following decimal number: 12
Generating lists....complete!
Using slices, we will now show a portion of each list.
What decimal number would you like to start at: 4
What decimal number would you like to stop at: 7
Decimal values from 4 to 7:
4
5
6
7
Binary values from 4 to 7:
0b100
0b101
0b110
0b111
Hexadecimal values from 4 to 7:
0x4
0x5
0x6
0x7
Press Enter to see all values from 1 to 12.
Decimal --- Binary --- Hecadecimal
1----0b1----0x1
2----0b10----0x2
3----0b11----0x3
4----0b100----0x4
5----0b101----0x5
6----0b110----0x6
7----0b111----0x7
8----0b1000----0x8
9----0b1001----0x9
10----0b1010----0xa
11----0b1011----0xb
12----0b1100----0xc
Example Output:
Welcome to the Binary/Hexadecimal Converter App
Compute binary and hexadecimal values up to the following decimal number: 12
Generating lists....complete!
Using slices, we will now show a portion of each list.
What decimal number would you like to start at: 4
What decimal number would you like to stop at: 7
Decimal values from 4 to 7:
4
5
6
7
Binary values from 4 to 7:
0b100
0b101
0b110
0b111
Hexadecimal values from 4 to 7:
0x4
0x5
0x6
0x7
Press Enter to see all values from 1 to 12.
Decimal --- Binary --- Hecadecimal
1----0b1----0x1
2----0b10----0x2
3----0b11----0x3
4----0b100----0x4
5----0b101----0x5
6----0b110----0x6
7----0b111----0x7
8----0b1000----0x8
9----0b1001----0x9
10----0b1010----0xa
11----0b1011----0xb
12----0b1100----0xc1. Binary Hexadecimal Converter App
Assume a text file “Test.txt” is already created. Using this file, write a function to create three
files “LOWER.TXT” which contains all the lowercase vowels and “UPPER.TXT” which contains all
the uppercase vowels and “DIGIT.TXT” which contains all digits
The first line will contain a message prompt to input the first number.
The second line will contain a message prompt to input the second number.
The third line will contain a message prompt to input the third number.
The last line will contain the largest among the three numbers.
Enter·the·first·number:·1
Enter·the·second·number:·2
Enter·the·third·number:·3
The·largest·number·is·3
# Function: Display the Bitcoin price in the menu item – to assist the user when setting price levels
def updateMenuPrice(self):
# Get the latest Bitcoin info (as a Tick object) from getBitMexPrice(). Name it tickObj.
tickObj = self.getBitMexPrice()
# Update the currentPrice property with the Bitcoin price in tickObj.
. . .
# Create a variable called currentPriceLabel consisting of the text 'Current Price: ' followed # by currentPrice.
# Add currentPriceLabel and currentPrice as two separate items to a new list (the sub-List).
# Append the sub-List to displayList.
. . .
# Sort displayList using the SECOND item (price) in its sub-lists
. . .
# For each sub-List in displayList, print only the label (first item) in the sub-List
. . .
#replace ellipsis with applicable code
Given an integer N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below.
In the example, the given starting number is
10, and the number of rows in the pyramid is 5.So, the output should be
10
11 12
13 14 15
16 17 18 19
20 21 22 23 24