4th Apr 2018, 6:10 AM
Pirate
Pirate - avatar
2 Answers
+ 10
When you multiply a string by a number you get repetitions, e.g., so print("Ha" * 3) gives HaHaHa. The input() function always outputs a string, so if you want an integer (or float), use 怌ļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ ļ¼“ļ¼Æ ļ¼Øļ¼„ļ¼¬ļ¼°ć€ 's suggestion, i.e. int(input()) or float(input())
4th Apr 2018, 8:00 AM
David Ashton
David Ashton - avatar
+ 1
Don't forget that input() stores everything in string by default. Thus your '5', when multiplied by 5 goes as '5'*5 ('5' + '5' + '5' . . . ) And, actually, I am to be considered new to coding myself, but your tags are kind of an abuse. SoloLearn's first chapter covers all of the questions of yours, as well as data types and how one works with another. Check Python Tutorial: Basic Concepts - String Operations (3/3)
4th Apr 2018, 7:51 AM
Andrey Vostokov
Andrey Vostokov - avatar