#basic python
21 messages · Page 1 of 1 (latest)
Remove the int()
ah thanks is there a way to make it so when the list is printed the brackets and commas arent showed?
You can loop and print each thing or use join
!exec
my_awesome_list = ["foo", "bar", "baz"]
for word in my_awesome_list:
print(word, end=" ")
print()
print(" ".join(my_awesome_list))
@umbral cargo
foo bar baz
foo bar baz
!exec
my_awesome_list = ["foo", "bar", "baz"]
print(*my_awesome_list, sep=" ")
@umbral cargo
foo bar baz
Or splat too
any easier way?
Not that I'm aware of off the top of my head, I don't think any of them aren't easy?
items=["iphone12","iphone11","iphone10","PS5","PS4","XBOX","computer"]
yesorno=input ("Hello! This program gives you a price for certain devices. Would you like to continue?")
if yesorno == "yes":
print*(items, sep=" ")
else:
print("Oh, ok see you soon")
would this worl
work
The * needs to be inside te brackets but I don't see why not other than that 🙂
What do you mean?
doesnt matter I did it
Okay 🙂
items=["iphone12","iphone11","iphone10","PS5","PS4","XBOX","computer"]
iphone12=1000
iphone11=700
iphone10=500
PS5=600
PS4=200
XBOX=200
computer=800
yesorno=input ("Hello! This program gives you a price for certain devices. Would you like to continue?")
if yesorno == "yes":
print("these are you choices:",*items, sep=" ")
else:
print("Oh, ok see you soon")
amount=int(input("What is the quantity of your order?"))
total=amount*items