Python Forum
how to make a mathematical operation without the command "print"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to make a mathematical operation without the command "print"
#1
how to make a mathematical operation without the command "print"?

I'm studing in a university, and i need this information to learn about this program for a curse.REALY THANKS to the people that can help me.
Reply
#2
print just shows the value of an expression or an object. Nothing with the mathematics. What do you mean?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
(Mar-15-2018, 04:51 PM)wavic Wrote: print just shows the value of an expression or an object. Nothing with the mathematics. What do you mean?

Okey the problem is that i want to put the result of an operation, but the program not put it, only stay in white when i press run . Sorry i'm a beginner with this
Reply
#4
Put it where? Here is some math in the interpreter:

>>> 2 * 40 / 5
16.0
Do you mean this?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
You need to be more specific. Nothing prints unless you tell it to print (except the interpreter). For example:

def mult(A, b):
    result = a * b

    return result

product = mult(2, 3)
will not print anything unless you add a 'print()' function somewhere, either within the mult() function or as a line after calling the mult() function for example:

def mult(A, b):
    result = a * b

    return result

product = mult(2, 3)
print(product)
Note that you do not need to print anything, you could also use the variable 'result' in another computation or function. Remember, the print() function is for humans to see what is happening within a program, not necessarily a requirement. This ability to see is also why the print() function is a valuable tool when trouble shooting.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  About mathematical equations seyidcemkarakas 3 328 Oct-04-2020, 01:21 PM
Last Post: Gribouillis
  Recognising mathematical expressions from word and pdf file Preeti15 0 345 Aug-19-2020, 09:06 AM
Last Post: Preeti15
  Mathematical Conversion Scripts for Weather Station Mickey53usa 11 1,181 Jun-24-2020, 03:14 AM
Last Post: buran
  Will not print in command prompt PandaCode 12 1,231 May-06-2020, 03:48 AM
Last Post: PandaCode
  Mathematical Operators in String AgileAVS 1 587 Mar-04-2020, 04:14 PM
Last Post: Gribouillis
  how do I make a number only print once but the number keeps on decreasing? syafiq14 5 712 Jan-03-2020, 10:34 AM
Last Post: perfringo
  POS receipt print cannot make paper cut using python AP_Development 1 584 Dec-12-2019, 08:48 AM
Last Post: buran
  Make color for string when print to console hadoan 6 955 Oct-31-2019, 01:40 PM
Last Post: hadoan
  Mathematical function input Tiiill 2 712 Sep-10-2019, 09:25 PM
Last Post: nilamo
  Print command isar 2 858 Dec-28-2018, 05:33 PM
Last Post: isar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020