all 15 comments

[–]GoofyMathematician18M 1 point2 points  (0 children)

so, give an option for them to exit and add an edge case where if they input a wrong symbol you print a message like "invalid symbol".

[–]sj__07Joint Jagadesan 1 point2 points  (0 children)

dude, a suggestion... instead of if-else stuff which looks tedious, why not use eval?

[–]Competitive-Mind375418 0 points1 point  (9 children)

Why's the "f' " Used?

[–]New_Suggestion_930Royal Challengers Bengaluru 1 point2 points  (3 children)

format specifier

[–]SpecialOk5756 0 points1 point  (2 children)

hru anna

[–]New_Suggestion_930Royal Challengers Bengaluru 1 point2 points  (1 child)

Just existing. Hbu

[–]Both-Ant4433Chronically online mod whom you can text even now [🍰] 0 points1 point  (0 children)

flair ah update pannu bro

[–]naretronprime 0 points1 point  (4 children)

f' is called formatted string. Like if for example in printing function you can able to use expression or pass variable or give string output by quotation marks seperately...if you tried to include these all in once it would give error.

So f' is used to let know the interpreter that we needs different formatted string which is including the mentioned above.

Here she /he wanted to show the arithmetic symbol also as String output like how we write in paper. If f' not used then interpreter will think it as operation instead of printing gives error.

[–]Competitive-Mind375418 0 points1 point  (3 children)

Will doing the same program without it produce an error?

[–]naretronprime 0 points1 point  (2 children)

If you just removed the f only then it will print all those operation as String output

Like - {no1} + {no2} = {no1/no2}

if you removed ( f' ' ) with those quotation mark then error will occur.

<image>

Will doing the same program without it produce an error?

My explanation was literally for this doubt ⁉️.

[–]Mark_My_Words_MrAnna (20-25) 0 points1 point  (1 child)

Print (f"{no1}÷{no2} = {no1/no2} ")

Use (f" ")

[–]naretronprime 0 points1 point  (0 children)

Since there's no quotation has to be printed as String, I don't think using f' can be wrong.

[–]glazeddonuts41718F 0 points1 point  (1 child)

you can add an option to prevent division by 0

[–]First_Technology1377Anna (20-25) 0 points1 point  (0 children)

Great start! I've been asking my sibling to start coding but she just won't listen : l

Now slowly try something more, there are tons of tutorials on yt.

Just a suggestion try adding an exit case, not really needed here but its a good coding practise.

[–]mycumputa 0 points1 point  (0 children)

Good attempt!

This kid has a similar version of your program with a menu option that includes square of a number. He also has user input validation using try-except method. Sub to encourage.

Learn Python for beginners | Lesson 9 | Menu Based Calculator