code in Python first: ghesoon last name: karim Stores your first name as a varia
ID: 3911534 • Letter: C
Question
code in Python
first: ghesoon
last name: karim
Stores your first name as a variable using all lowercase letters
Stores your last name as a variable using all uppercase letters
Prints out, "Hello, <first name> <last name>" with the first name converted to uppercase letters and the last name converted to lowercase letters
Prints out two newlines
Prints out the following:
"Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible - Francis of Assisi"
Your output must have quotes at the beginning and the end of your outputted text
Stores 2 decimal numbers as variables
Stores one addition, one subtraction, one multiplication, and one division operation of these variables as variables
Prints out each of the four results as:
<numeric value of variable 1> plus <numeric value of variable 2> equals <value of variable that stored the result of addition>
<numeric value of variable 1> minus <numeric value of variable 2> equals <value of variable that stored the result of subtraction>
...etc. Each output should be on its own line
Stores the current month as a string variable (e.g. March, June, etc.) and day of the month as a numeric variable
Outputs "Today is day <day of month> of the month of <month variable>.
Explanation / Answer
# taking names and storing in the respective cases
first_name = input("Enter first name:").lower()
last_name = input("Enter last name:").upper()
# printing after changing to upper and lower cases
print("Hello,",first_name.upper(), last_name.lower())
# printing quote with quotation marks
print(" "Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible - Francis of Assisi"")
# arithmetic operations
a = int(input(" Enter first number:"))
b = int(input("Enter second number:"))
print(a,"+",b,"=",a+b)
print(a,"-",b,"=",a-b)
print(a,"*",b,"=",a*b)
print(a,"/",b,"=",a/b)
# month and day
month = "July"
day = 9
print("Today is day", day ,"of the month of"+month+".")
''' OUTPUT
Enter first name: John
Enter last name: Nash
Hello, JOHN nash
"Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible - Francis of Assisi"
Enter first number: 6
Enter second number: 2
6 + 2 = 8
6 - 2 = 4
6 * 2 = 12
6 / 2 = 3.0
Today is day 9 of the month ofJuly.
'''
# taking names and storing in the respective cases
first_name = input("Enter first name:").lower()
last_name = input("Enter last name:").upper()
# printing after changing to upper and lower cases
print("Hello,",first_name.upper(), last_name.lower())
# printing quote with quotation marks
print(" "Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible - Francis of Assisi"")
# arithmetic operations
a = int(input(" Enter first number:"))
b = int(input("Enter second number:"))
print(a,"+",b,"=",a+b)
print(a,"-",b,"=",a-b)
print(a,"*",b,"=",a*b)
print(a,"/",b,"=",a/b)
# month and day
month = "July"
day = 9
print("Today is day", day ,"of the month of"+month+".")
''' OUTPUT
Enter first name: John
Enter last name: Nash
Hello, JOHN nash
"Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible - Francis of Assisi"
Enter first number: 6
Enter second number: 2
6 + 2 = 8
6 - 2 = 4
6 * 2 = 12
6 / 2 = 3.0
Today is day 9 of the month ofJuly.
'''
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.