Question

How do I code these in Python? My final result should be "Monday 4" day =...

How do I code these in Python? My final result should be "Monday 4"

day = Monday

square = 2 ^ 2

print (square)

print(day + square)

Homework Answers

Answer #1

Explanation:

Here is the code which has the variable day in which the String "Monday" is stored.

sqaure variable stores the value of 2 to the power of 2, that is 4.

Then print statement is used to print day and square together as mentioned.

Code:

day = "Monday"

square = 2 ** 2
print(day +" "+ str(square))

Output:

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!

PLEASE COMMENT IF YOU NEED ANY HELP!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I am trying to print an essay in my python code but the words keep getting...
I am trying to print an essay in my python code but the words keep getting cut over two lines. How can i fix this using python code so that it is formatted nicely? thanks
Python Function: How to format phone number "9293827827" to "(929) 382-7827 in python. My code so...
Python Function: How to format phone number "9293827827" to "(929) 382-7827 in python. My code so far: phone_number = input("Enter phone number (numbers only): ") phone_number_formatted = ?????? print(phone_number_formatted)
How can I change my username so that the getuser Python output is different? I am...
How can I change my username so that the getuser Python output is different? I am using a windows pc import datetime import getpass print("\n\nFinished execution at ", datetime.datetime.now()) print(getpass.getuser())
""" ''' Write a python code to push all zeors to the end of an array...
""" ''' Write a python code to push all zeors to the end of an array ''' import numpy as np def Move_a(i):    num = len(a)    for k in range (i, num-1): a[k] = a[k+1] a[num-1] = 0    return a a = np.array([0,1,4,7,0,9,12,0,0,15,0,21]) #length of array (len) num = len(a) print (num) for i in range(0,num): if (a[i] == 0): #Functioon call to Move_a() a = Move_a(i)       print ("the array looks like") print (a) My...
This is my code, python. I have to search through the roster list to find a...
This is my code, python. I have to search through the roster list to find a player using their number. it says list index out of range. it also says there is error in my main. def file_to_dictionary(rosterFile): myDictionary={}       with open(rosterFile,'r') as f: data=f.read().split('\n')       for line in data:    (num,first,last,position)=line.split() myDict=[first, last, position] myDictionary[num]=myDict print (myDictionary) return myDictionary file_to_dictionary((f"../data/playerRoster.txt"))    def find_by_number(number): player=None    second=[] foundplayer= False myDictionary=file_to_dictionary((f"../data/playerRoster.txt")) for p in myDictionary: fullplayer=p.split() second.append([fullplayer[0], (fullplayer[1]+" "+...
HI HOW DO I USE THE RANDOM FUNCTION IN MY CODE TO GET RANDOM NUMBERS OF...
HI HOW DO I USE THE RANDOM FUNCTION IN MY CODE TO GET RANDOM NUMBERS OF DRAWING RANGING FROM 3-6. i am a little confuse because inuse random function for heighet and size and it worked but i get just one output instead of 4 or 3 or 5 depending on the time i run the code sinces its random.
Using Python (pandas as pd) I am trying to use the split, apply, combine method but...
Using Python (pandas as pd) I am trying to use the split, apply, combine method but am getting an "invalid syntax" error at the end of the line that says "for days_name, days_df in grouped_by_day" I declared grouped_by_day in the split function but did not get any errors so I am not sure what happened or how to fix it. Below is a copy of the split, apply, combine section of my code. mean_data_ser = pd.Series() #split grouped_by_day= days_df.groupby("Day of...
how should i run my data when i have 4 categories under 1 policy. should i...
how should i run my data when i have 4 categories under 1 policy. should i use dummy variable for each categories or should i average the 4 categories. this is my model export = β + β1adoption rate + β2 policy
how should i run my data when i have 4 categories under 1 policy. should i...
how should i run my data when i have 4 categories under 1 policy. should i use dummy variable for each categories or should i average the 4 categories. this is my model export = β + β1adoption rate + β2 policy
Write code snippets to do the following. You should write these in a Python editor and...
Write code snippets to do the following. You should write these in a Python editor and test them out as you go. When they work, copy and paste your final code snippet here. Define a function that takes a total bill and the number of people at your table, and prints the amount that each person owes. e.g. divide_bill(100, 5) would produce Each person owes $20 for their meal. e.g. divide_bill(50.25, 4)would produce Each person owes $12.56 for their meal....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • How can you use Bayes’ theorem in light of new information? In Bayes’ theorem, how does...
    asked 33 seconds ago
  • Which of the following is not one of the four states of a working file? Unchanged,...
    asked 3 minutes ago
  • Assume we have CPU instructions that look like this: load register, address save register, address Where...
    asked 16 minutes ago
  • What is the difference between the following two declarations? char array[] = “Hello World”; char *array...
    asked 31 minutes ago
  • Discuss knowledge and understanding gleaned from The Least Dangerous Assumption and Strategies for Presuming Competence. How...
    asked 32 minutes ago
  • Exercise 13-20 (LO13-3) The owner of Maumee Ford-Volvo wants to study the relationship between the age...
    asked 34 minutes ago
  • Scenario The Department of Administrative Services (DAS) provides a number of services to other departments in...
    asked 42 minutes ago
  • Linear Regressions The number of newly reported crime cases in a county in New York State...
    asked 46 minutes ago
  • Specialty courts have been developed for various categories of crimes and offenders (e.g., mental health, substance...
    asked 51 minutes ago
  • An air-track cart with mass m=0.40kg and speed v0=1.2m/s approaches two other carts that are at...
    asked 51 minutes ago
  • Write a program in C# that reverses a collection and removes elements that are divisible by...
    asked 54 minutes ago
  • A gas pipeline with the thickness of 4mm is to be joint together by using welding...
    asked 1 hour ago