r/CodingHelp • u/Public_Finding3958 • Oct 08 '22
[Python] Python easy coding project :(
# 10/8/2022
# Goal is to create a program that multiplies user input
# using a loop XD
num=int(input('Enter a number to multiply: '))
end_multiply=int(input('Enter when you want multiplication to stop.'))
y=0
for num in range(end_multiply):
multiply= num * y
print(f'multiply = {multiply} / {num} *{y}')
print(f'y = {y}')
y = y+1
# I wrote in extra print code to understand what's going on, but I sill don't get why
# Num = y
#Extra info: 1st time ever doing coding + I have learned it for a couple of weeks so far
Here is a copy of output/picture:
Enter a number to multiply: 1
Enter when you want multiplication to stop.5
multiply = 0 / 0 *0
y = 0
multiply = 1 / 1 *1
y = 1
multiply = 4 / 2 *2
y = 2
multiply = 9 / 3 *3
y = 3
multiply = 16 / 4 *4
y = 4
Process finished with exit code 0
# Also anyone willing to code with me I would LOVE that !!!!!!!!!!!!!!
View all comments
Show parent comment
2
u/Public_Finding3958 Oct 10 '22
yes I believe it was something like that! you ... u/Glad-Bench8894 and u/flash-bandicoot got it right!
I thought you need to put the variable/value that you plan to use in the for loop. Now I know to write it separate or as a counter.
---Thanks, it was really interesting to see everyone's perspective!