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.
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
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...
I want my results to show only once, but it keeps repeating the last result adding...
I want my results to show only once, but it keeps repeating the last result adding to new result making a pyramid. How do i fix this please! so for example when i run the code i want it to be like this: [(12.44, 4.18), (9.57, 3.03), (3.14, 0.46), (13.46, 4.58)], etc, etc NOT LIKE THIS: [(12.44, 4.18)] [(12.44, 4.18), (9.57, 3.03)] [(12.44, 4.18), (9.57, 3.03), (3.14, 0.46)] [(12.44, 4.18), (9.57, 3.03), (3.14, 0.46), (13.46, 4.58)] def choco_and_nobel(minimum_, maximum_):     ...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT