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
  How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu BillKochman 13 622 9 hours ago
Last Post: Bronjer
  plotting based on the results of mathematical formulas Timur 1 332 Feb-08-2024, 07:22 PM
Last Post: Gribouillis
  problem with print command in super() akbarza 5 579 Feb-01-2024, 12:25 PM
Last Post: deanhystad
  Taking Mathematical Expressions from Strings quest 2 700 Jul-02-2023, 01:38 PM
Last Post: Pedroski55
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,075 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Why does absence of print command outputs quotes in function? Mark17 2 1,376 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Using print command to send command to rasberry pi terminal MondazeBear 2 1,861 Aug-02-2021, 03:15 PM
Last Post: Larz60+
  How to make print without newline but wait in between each print? Adrian_L 6 3,077 Apr-01-2021, 09:59 PM
Last Post: Adrian_L
  About mathematical equations seyidcemkarakas 3 2,017 Oct-04-2020, 01:21 PM
Last Post: Gribouillis
  Recognising mathematical expressions from word and pdf file Preeti15 0 1,777 Aug-19-2020, 09:06 AM
Last Post: Preeti15

Forum Jump:

User Panel Messages

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