<jupyter_start><jupyter_text>**2022 Python Programming Practical 1**If you do not have one already, create a [GitHub](https://github.com) account.Create a public repository ctcuc22File --> Save a copy in GitHub under this repositoryFor the following questions,*   standard input: keyboard*   standard output: screen **Q1. (Converting Fahrenheit to Celsius)**Write a program that reads a Fahrenheit degree as a float from standard input, then converts it to Celsius and displays the result in standard output. The formula for the conversion is:```celsius = (5/9) * (fahrenheit - 32)```<jupyter_code>fahrenheit_input = float(input("Enter temperature in fahrenheit: "))
celsius = (5/9) * (fahrenheit_input - 32)

print(celsius)<jupyter_output>Enter temperature in fahrenheit: 87
30.555555555555557<jupyter_text>**Q2. (Computing the volume of a cylinder)**Write a program that reads in the radius and length of a cylinder and computes its volume using the formulae:```area = radius * radius * pivolume = area * length```<jupyter_code>import math

radius = float(input("Enter the radius: "))
length = float(input("Enter the length: "))

print("Volume is " + str(math.pi * length * radius**2))<jupyter_output>Enter the radius: 2
Enter the length: 3
Volume is 37.69911184307752<jupyter_text>**Q3. (Converting miles into kilometers)**Write a program that reads a number in miles, converts it to kilometres, and outputs the result. One mile is 1.60934 kilometres. Display your answer correct to 3 decimal places.<jupyter_code>miles = float(input("Enter the miles: "))
print("km: " + str(round(miles * 1.60934,3)))<jupyter_output>Enter the miles: 10
km: 16.093<jupyter_text>**Q4. (Summing the digits in an integer)**Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all its digits is 14.Hint: Use the % operator to extract digits, and use the // operator to remove the extracted digit. For instance, 932 % 10 = 2 and 932 // 10 = 93<jupyter_code>number = int(input("Enter a integer between 0 and 1000: "))

#932//100 # this will get the hundreds position
#932//10%10 # this will get the tens position
#932%10 # this will get the ones position

hundreds = number//100
tens = number//10%10
ones = number%10

print(hundreds + tens + ones)<jupyter_output>Enter a integer between 0 and 1000: 2
2<jupyter_text>**Q5. (Converting an uppercase letter to lowercase)**Write a program that converts an uppercase letter from standard input to a lowercase letter by making use of its ASCII value.http://www.asciitable.com<jupyter_code>upper = input("Enter uppercase letter: ")
lower = ord(upper) + 32 # ordinal
print(chr(lower))<jupyter_output>Enter uppercase letter: Y
y<jupyter_text>**Q6. (Finding the character of an ASCII code)**Write a program that receives an ASCII value (an integer between 0 and 127) and displays its character. For example, if the user enters 97, the program displays character a.http://www.asciitable.com<jupyter_code>value = int(input("Enter a number between 0 and 127: "))
print(chr(value))<jupyter_output>Enter a number between 0 and 127: 97
a<jupyter_text>**Q7. (Payroll)**Write a program that reads in the following information and prints a payroll statement. A sample input and output session is as follows:Sample input:```Enter name: <NAME>Enter number of hours worked weekly: 10Enter hourly pay rate: 6.75Enter CPF contribution rate(%): 20```Sample output:```Payroll statement for <NAME>Number of hours worked in week: 10Hourly pay rate: $6.75Gross pay = $67.50CPF contribution at 20% = $13.50Net pay = $54.00```<jupyter_code>name = input("Enter name: ")
hours_worked = int(input("Enter number of hours worked weekly: "))
hourly_rate = float(input("Enter hourly pay rate: "))
cpf_rate = float(input("Enter CPF contribution rate(%): "))
gross_pay = hours_worked * hourly_rate
cpf_contribution = gross_pay * cpf_rate / 100
net_pay = gross_pay - cpf_contribution

print("Payroll statement for " + name)
print("Number of hours worked in a week: " + str(hours_worked))
print("Hourly pay rate: $" + str("{:.2f}".format(hourly_rate)))
print("Gross pay = $" + str("{:.2f}".format(gross_pay)))
print("CPF contribution at 20% = $" + str("{:.2f}".format(cpf_contribution)))
print("Net pay = $" + str("{:.2f}".format(net_pay)))<jupyter_output>Enter name: <NAME>
Enter number of hours worked weekly: 10
Enter hourly pay rate: 6.75
Enter CPF contribution rate(%): 20
Payroll statement for <NAME>
Number of hours worked in a week: 10
Hourly pay rate: $6.75
Gross pay = $67.50
CPF contribution at 20% = $13.50
Net pay = $54.00
{'fraction_non_alphanumeric': 0.11164101452417083, 'fraction_numerical': 0.04812486451333189, 'mean_word_length': 5.408333333333333, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 27, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '219850', 'license': 'MIT', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1407, 'n_words': 549, 'path': 'Staff_Goh_Terence_2022_Python_Programming_Practical_1.ipynb', 'repo_name': 'tergh/ctcuc22', 'size': '4633'}