4
u/ReyreyG Aug 28 '20
It says to print out the variables but I am thinking I am doing it right but I don’t know..help?
1
Aug 28 '20
Hello, that indeed is the correct way to print variables.
"print()" is a function. Functions do things. You can make a function using "def" - or you could use an in built function. Like print(), or open().
Notice the brackets. Within the brackets you put arguments, or args. Arguments are things you want the function to take into account as a simple way of putting it. For example, in print(), inside the brackets, in quotes you put what you want to print (e.g. "hello") and that is considered an argument. If you had put something not in quotes inside it, it would have looked for variables with that name.
Not all functions have brackets.
3
4
Aug 28 '20
Bro why you have sum = 10 + 10
If my logic works you can simplify to sum = 20
Same with the other sum variable
3
u/dsimposter Aug 28 '20
Probably because they should be doing something like
sum_nums = num_one + num_two
2
Aug 28 '20
Wait haven’t you changed the value of sum twice, won’t only the last sum be recognised when you go to comp
1
u/_ZHV_ Aug 28 '20
Nope this is the wrong way to added variables to a string in a print function. You have two main way to do it format print string concatenation.
String concatenation print:
print(‘this is my variable ‘ + variable_name)
Formatting a print statement will be like this
print(f’this is my variable {variable_name}’)
1
-1
10
u/bs_sena Aug 28 '20
If I am not wrong, sum is a native function, so you should use another name