- 4
Please give me the actual code!(python3) I'm stuck here for last 2 days!!!
Today is a holiday at the children's camp, so all the children will be served ice cream. There are 3 groups of children: 23 children in the first group, 27 in the second, and 18 in the third. Every child should get 2 scoops of ice cream. Write a program to calculate and output the total number of ice cream scoops we need.
22 Réponses
+ 3
#slove
g1 = int (input("Total member of group one !"))
g2 = int (input("Total member of group two !"))
g3 = int (input("Total member of group three !")
ice = 2 * (g1 + g2 + g3)
print (ice,"ice cream needed")
print ("End")
+ 2
Okay, post your attempt and we got you!
+ 1
print ( 23 * 2 + 27 * 2 + 18 * 2 )
What's the difference between your code and my code? ArrUn Mohibul Alam
+ 1
print( ( 20 + 30 + 18 ) * 2 )
0
Look over data types. Strings are like words, and you cant add words and expect them to be treated like numbers. '1' + '2' is '12'. But 1 + 2 is 3
0
Nafiz Rahman
Read about data type in programming.
print ( ' 23 * 2 + 27 * 2 + 18 * 2 ' ) - this code print a string because contains quotes
print ( 23 * 2 + 27 * 2 + 18 * 2 ) - this code print the mathematical expression of all numbers
You can f-string too. For example:
print ( f"{ 23 * 2 + 27 * 2 + 18 * 2 }" )
0
Print(68*2)
- 1
The problem with that code is you're attempting to print out the whole equation as a string. Anything in between ' ' or " " is considered a string, even numbers.
Try losing the quotes and get back after that if you still have issues
- 1
print ( '23 * 2' )
print ( '27 * 2' )
print ( '18 * 2' )
- 1
I'm not clear about what are you trynna say...😐
- 1
Thank you so much guys!🖤🖤🖤 It's really kind of you!
- 1
I solved it!
- 1
group_1st = 23
group_2nd = 27
group_3rd = 18
total = group_1st+group_2nd+group_3rd
print (total*2)
- 1
# Group 1
x=(23*2)
# group 2
y=27*2
# group 3
z=18*2
# Total scoops
sccops=x+y+z
print(sccops)
- 1
a = 23;
b = 27;
c = 18;
print((a*2) + (b*2) + (c*2))
136
I'm just learning python, I hope it helps you solve the exercise
- 1
a=2*23
b=2*27
c=2*18
z=a+b+c
print(z)
- 1
print (2*(23+27+18))
- 1
print (62*2)
- 2
Really?! Do you have to program an AI and make it understand what the problem is or what?
Come on, not only you can do it on a calculator, you can do it by hand!
- 2
print ( ' 23 * 2 + 27 * 2 + 18 * 2 ' )