Question
can anyone solve this for me, python?
Create a conditional expression that evaluates to string negative if user_val is less than 0, and non-negative otherwise. S
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Note: Brother sometimes while uploading on HomeworkLib the indentations change. So, I request you to verify it with screenshot once. This is the link where I have saved the code too

https://onlinegdb.com/HJ-SiOxVL

user_val=int(input());
cond_str="non-negative";
if(user_val<0):
cond_str="negative";
print(user_val,"is",cond_str);

M Inbox - gurkaranpreet.singh.me x C Can Anyone Solve This For Me, P. X Online Python Compiler - online x C My Q&A | Chegg.co

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
can anyone solve this for me, python? Create a conditional expression that evaluates to string 'negative'...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • java Create a conditional expression that evaluates to string 'negative" if userVal is less than 0,...

    java Create a conditional expression that evaluates to string 'negative" if userVal is less than 0, and 'non-negative' otherwise Ex userVal is-9, output is -9 is negative. inport javo.util.Scanner; public class NegativeOrPositive

  • (Python) Please do NOT solve it by using special functions(like max min, divmod), I have to...

    (Python) Please do NOT solve it by using special functions(like max min, divmod), I have to ask the same questions again and again otherwise, thanks for your understanding. 1. Write a program that prompts the user for an integer, calculates the factorial of the input integer and displays the result as a string with a comma at every third position, starting from the right. Assume that user input is valid. Hint: Think about representing a number as a string. Sample...

  • can anyone show me how this code would look in python, I'm studying python while taking...

    can anyone show me how this code would look in python, I'm studying python while taking some classes. I can't seem to understand what this is asking for. • Phase 1 Requirements Code submitted for Phase 1 will only have the following capability. Any additional coding will result in the loss of point. • code will have the main function, including looping until the user enters input of 12 • code will call the printMenu() function • The printMenu() function...

  • can some one help me solve this and explain it please Input Format A line indicating...

    can some one help me solve this and explain it please Input Format A line indicating the size of the array the array on the next line Constraints n < 10000 Output Format One line printing the array in order input (given to you) One line printing the array, followed by its maximum value Sample Input 0 5 1 3 5 7 9 Sample Output 0 1 3 5 7 9 9 7 5 3 1 9 Contest ends in...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : i have 15 min to submit the solution please help me   You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other...

  • Can anyone help me write a C function that goes through an input string and insert...

    Can anyone help me write a C function that goes through an input string and insert spaces(" ")infront and after "<",">","|"? For example: if my input string is: HELLO<WO|RLD>!, the output of the function will be a array like: HELLO < WO | RLD > ! Thanks!

  • 3. Write Python statements that will do the following: a) Input a string from the user....

    3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...

  • Hi can anyone help me with this question? Please use python when you do it. THANKS...

    Hi can anyone help me with this question? Please use python when you do it. THANKS 1. Arithmetic trees 50 marks You are given an input file with multiple pairs of input lines. The first line of each pair is a tree given as a predecessor array. The second line is the value at the corresponding node. Values at leaf nodes (nodes with no children) are integers. At non-leaf nodes, the two possible values are or * The tree represents...

  • on python Design a function that can generate a histogram of characters in a string with...

    on python Design a function that can generate a histogram of characters in a string with the function prototype: histogram(string) It takes a string as the input parameter and returns a Python dictionary. Then design a function with the following prototype. print_hist_asc(histogram) It takes a histogram generated from your histogram function and print the histogram according to the frequency in the ascending order. Example input: “aaaaabbbbcccdde” Example output: e 1 d 2 c 3 b 4 a 5

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT